DEV-11871, DEV-11872, DEV-11873, DEV-11874 Add missing apis - #35
Conversation
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( |
There was a problem hiding this comment.
_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): |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
we are starting to automate release changelog entries - please add yours in unreleased section
|
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()] |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
uv run pytest)uv run ruff check .)dualentry <command>