Skip to content

DEV-11871, DEV-11872, DEV-11873, DEV-11874 Add missing apis - #35

Merged
ivans605 merged 3 commits into
mainfrom
ivans/add-missing-api
Sep 30, 2026
Merged

ivans605 merged 3 commits into
mainfrom
ivans/add-missing-api

Conversation

@ivans605

@ivans605 ivans605 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Changes

Adds commands for custom fields, product tax codes, VAT rates (read-only), and statistical journals (list/get/create/update + attachment upload).

Includes Rich formatters, multipart POST for attachments, and validated comma-separated ID filters on statistical journal list.

Test plan

  • Unit tests pass (uv run pytest)
  • Linter passes (uv run ruff check .)
  • Manually tested with dualentry <command>

ivans605 and others added 2 commits September 30, 2026 18:52
Integrate export-jobs commands and keep parity resource formatters in output.py.

Co-authored-by: Cursor <cursoragent@cursor.com>
return [part.strip() for part in value.split(",") if part.strip()]


def _build_list_filters(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_build_list_filters adds 15 conditional mappings, then list_cmd repeats the same inputs in 15 _supplied calls. The existing run_list path already forwards custom filter arguments through _build_filter_params; bank_match.py:124-136, bank_connections.py:38-47, and export_jobs.py:79-88 use that path. This extra mapping layer makes each journal filter appear twice and adds a 50-line helper without a distinct job.

Proposed fix

Collapse _build_list_filters into a direct run_list call in list_cmd at src/dualentry_cli/commands/statistical_journals.py:117, importing run_list from commands/actions.py:25 and deleting the helper at line 39. Apply at src/dualentry_cli/commands/statistical_journals.py:117:

    run_list(
        "statistical-journals",
        resource="statistical-journal",
        limit=limit,
        offset=offset,
        all_pages=all_pages,
        output=output,
        search=search,
        status=status,
        company_id=company or None,
        date_start=date_start or None,
        date_end=date_end or None,
        period_start=period_start or None,
        period_end=period_end or None,
        number=_csv_ints(number),
        account_id=_csv_ints(account_id),
        account_number=_csv_strings(account_number),
        line_account_id=_csv_ints(line_account_id),
        line_account_number=_csv_strings(line_account_number),
        updated_after=updated_after or None,
        updated_before=updated_before or None,
        ordering=ordering or None,
    )

Puma · architecture · medium severity

# ── Custom field ─────────────────────────────────────────────────────


def _custom_field_list(items):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output.py grows from 1330 to 1504 lines with four more resource-specific formatter pairs. Its entity and reference formatters already form a contiguous section from lines 771–1320; keeping the new pairs there further enlarges a shared dispatcher imported by six production command modules. Moving that section together would take roughly 550 lines out of this file rather than making each subsequent resource extend the same oversized module.

Proposed fix

Move the entity and reference formatter section at src/dualentry_cli/output.py:771-1320, including _custom_field_list below, to src/dualentry_cli/output_entities.py; retain format_output and _RECORD_PREFIX in output.py and register the moved functions there after its shared helpers initialize. Apply at src/dualentry_cli/output.py:1199:

def _custom_field_list(items):
    table = Table(title="Custom Fields", show_lines=False)
    table.add_column("ID", style="dim", justify="right")
    table.add_column("Name", min_width=20, style="bold")
    table.add_column("Type")
    table.add_column("Active")

    for r in items:
        table.add_row(
            str(r.get("id", "")),
            r.get("name", "-"),
            str(r.get("field_type", "-")),
            "yes" if r.get("is_active") else "no",
        )

    console.print(table)

Puma · architecture · medium severity · blast radius medium

@atrsa atrsa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are starting to automate release changelog entries - please add yours in unreleased section

@atrsa

atrsa commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

ideally also to complete checklist

def _csv_ints(value: str | None) -> list[int] | None:
if not value:
return None
return [int(part.strip()) for part in value.split(",") if part.strip()]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since its internal and apparently bound to number arg, ideally it would raise typer.BadParameter for non-numerical csv strings (so a user sees a proper error)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivans605
ivans605 merged commit f6d8dfb into main Sep 30, 2026
4 checks passed
@ivans605
ivans605 deleted the ivans/add-missing-api branch September 30, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants