Files
accounted/types/skatteverket.ts
T
Jakob Wennberg ec27228a8e style: remove em/en dashes repo-wide, add CLAUDE.md rule against them (#890)
Em dashes (—) and en dashes (–) had spread across comments, docs, tests,
and a few UI strings, reading as AI-generated boilerplate rather than
house style. Replaced each with punctuation matching its context: colon
for explanatory clauses, comma for asides, plain hyphen for numeric/legal
ranges (e.g. "21-23§"), "to"/"till" for date ranges, parentheses for
paired-dash asides. messages/en.json and messages/sv.json were fixed by
hand together to keep sv/en in sync.

Left untouched where the dash is the functional subject rather than
decorative punctuation: date-range-parser.ts's separator regex,
charset-repair.ts's CP1252 byte-mapping table (and its test), the SIE
encoding mojibake docs, generic-csv.ts's minus-sign normalizer, the
agent system-prompt files that already instruct against em dashes, and
a golden iXBRL test fixture compared byte-for-byte.

Also fixes two bugs surfaced along the way: an off-by-one in
ApiKeysPanel's scope-label split (a leftover from an earlier partial
pass), and a charset-repair test that had lost the literal en-dash it
exists to verify.

Regenerated the agent atom seed migration (skills:generate) since 27
SKILL.md files changed. Added a CLAUDE.md rule against em/en dashes,
with an explicit carve-out for the functional-dash cases above.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-04 15:58:06 +02:00

54 lines
1.9 KiB
TypeScript

/**
* Skatteverket data shapes used by core UI (the /transactions page lives
* in core, but renders skattekonto rows alongside bank tx). The DB table
* `skattekonto_transactions` lives in core migrations even when the
* skatteverket extension is disabled: the extension only owns the API
* that populates it. Keeping these types in core means components can
* render the table's shape without depending on the extension module.
*
* If skatteverket is disabled, the API returns 503 and the UI just sees
* an empty list: the types remain valid descriptors of the schema.
*/
/** Row shape for the `skattekonto_transactions` table (DB → app). */
export interface StoredSkattekontoTransaction {
id: string
company_id: string
transaktionsidentitet: number | null
dedup_key: string
transaktionsdatum: string
forfallodatum: string | null
ranteberakningsdatum: string | null
transaktionstext: string
belopp_skatteverket: number
belopp_kronofogden: number | null
status: 'booked' | 'upcoming'
journal_entry_id: string | null
imported_at: string
updated_at: string
}
/**
* Single best candidate verifikat for an unmatched SKV row. Attached by
* the `/skattekonto/transaktioner` endpoint when exactly one strong match
* exists, so the UI can offer a one-click "koppla till A12" hint instead
* of forcing the user to open the full Matcha-dialog.
*/
export interface SkattekontoMatchSuggestion {
journal_entry_id: string
voucher_number: number | null
voucher_series: string | null
entry_date: string
description: string
status: 'draft' | 'posted' | 'reversed'
}
/**
* API response variant: stored row plus optional auto-match suggestion.
* `match_suggestion` is optional because kommande/upcoming rows skip the
* enrichment step entirely (no journal entry can match a future event).
*/
export interface SkattekontoTransactionWithSuggestion extends StoredSkattekontoTransaction {
match_suggestion?: SkattekontoMatchSuggestion | null
}