3ee3565d6d
Final consumer migration of the responsiveness plan: the 35 files still fetching fiscal periods, settings, accounts, cash accounts, dimensions or templates on their own now read lib/reference-data, and every client write site invalidates the shared cache instead of refetching locally. Settings and registries: FiscalYearsManager, FiscalPeriodEditor (period snapshotted once per company so a revalidation cannot reset dates being edited), BookingTemplatesPanel, ChartOfAccounts, ChartOfAccountsManager, EditAccountDialog, CorrectionEntryDialog, StrikeLinesDialog, InvoicePaymentAccountsSettings; the dimensions registry (DimensionsManager, DimensionCombobox, LineDimensionFields, DimensionFilter, bookkeeping/[id]) reads useDimensions and the ad-hoc fetchDimensions/fetchDimensionsCached helpers are deleted. Pages and pickers: CashAccountSelector (FyPicker-shaped restore, once per company load), use-account-names, FiscalYearGapNotice, OpeningBalancePeriodStep, BankFileConfirmStep, ImportReviewStep, the import page (invalidates accounts + periods after a SIE execute), customers list, invoices list + detail, pending, salary employee, asset dispose, year-end and periodisering pages (invalidate periods after closing), reports DimensionPnlView (its pivot picker read the wrong payload key and was always empty; it now populates), SkatteverketPanel, TemplatePicker, ArticleForm (vat_registered). Invoice dialogs and extensions: SendInvoiceDialog, PaymentBookingDialog (init reduced to the credit-note lookup + catalogue, proposal and voucher preview fire on open when cached; a local getSession replaces the network getUser for the fallback CC), InvoiceInboxWorkspace, TicWorkspace, ArcimMigrationWorkspace (invalidates after each SIE import step), enable-banking AccountPickerDialog. raw-reference-fetch ratchet: 35 -> 0 files. Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
64 lines
1.9 KiB
TypeScript
64 lines
1.9 KiB
TypeScript
/**
|
|
* Client-side contract types for the dimensions registry API (PR2 of
|
|
* dev_docs/dimensions_implementation_plan.md).
|
|
*
|
|
* The routes live under /api/dimensions and are built against the same locked
|
|
* contract: this module codes against the contract, not the route files, so
|
|
* the register UI (DimensionsManager) and the shared picker (DimensionCombobox)
|
|
* can ship independently of the API package.
|
|
*/
|
|
|
|
export interface DimensionValueDto {
|
|
id: string
|
|
code: string
|
|
name: string
|
|
is_active: boolean
|
|
start_date: string | null
|
|
end_date: string | null
|
|
}
|
|
|
|
export interface DimensionDto {
|
|
id: string
|
|
/** SIE #DIM number (1 = Kostnadsställe, 6 = Projekt, 20+ = custom). */
|
|
sie_dim_no: number
|
|
name: string
|
|
resets_annually: boolean
|
|
is_system: boolean
|
|
is_active: boolean
|
|
sort_order: number
|
|
/** SIE #UNDERDIM parent — the sie_dim_no of the parent dimension, or null. */
|
|
parent_sie_dim_no: number | null
|
|
/** Sorted by code by the API. */
|
|
values: DimensionValueDto[]
|
|
}
|
|
|
|
export type DimensionRuleType = 'required' | 'default' | 'fixed'
|
|
|
|
/**
|
|
* Per-account dimension rule as served by GET /api/dimensions/rules —
|
|
* a flattened join row (rule + dimension + optional pinned value).
|
|
*/
|
|
export interface AccountDimensionRuleDto {
|
|
account_dimension_rule_id: string
|
|
account_number: string
|
|
dimension_id: string
|
|
sie_dim_no: number
|
|
dimension_name: string
|
|
rule_type: DimensionRuleType
|
|
value_id: string | null
|
|
value_code: string | null
|
|
value_name: string | null
|
|
is_active: boolean
|
|
}
|
|
|
|
/** SIE dimension number whose values carry start/end dates (Projekt). */
|
|
export const PROJECT_DIM_NO = 6
|
|
|
|
/**
|
|
* Strict Fortnox-compatible code format enforced by the API for user-created
|
|
* codes (the DB CHECK is deliberately looser so legacy free-text survives the
|
|
* backfill). Mirrored client-side for inline validation before POST.
|
|
*/
|
|
export const DIMENSION_CODE_PATTERN = /^[A-Za-z0-9ÅÄÖåäö_+\-]{1,20}$/
|
|
|