@tailor-platform/erp-kit 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +35 -7
- package/dist/cli.mjs +783 -272
- package/package.json +5 -4
- package/skills/erp-kit-app-1-requirements/SKILL.md +39 -12
- package/skills/{erp-kit-app-3-plan → erp-kit-app-1-requirements}/references/story-extraction.md +1 -1
- package/skills/erp-kit-app-2-requirements-review/SKILL.md +29 -5
- package/skills/erp-kit-app-2-requirements-review/references/best-practices-check.md +4 -0
- package/skills/erp-kit-app-2-requirements-review/references/boundary-consistency-check.md +4 -0
- package/skills/erp-kit-app-2-requirements-review/references/story-quality-check.md +67 -0
- package/skills/erp-kit-app-3-plan/SKILL.md +51 -50
- package/skills/erp-kit-app-3-plan/references/resolver-extraction.md +24 -18
- package/skills/erp-kit-app-3-plan/references/screen-extraction.md +18 -2
- package/skills/erp-kit-app-4-plan-review/SKILL.md +16 -13
- package/skills/erp-kit-app-5-impl-backend/SKILL.md +19 -11
- package/skills/erp-kit-app-5-impl-backend/references/app-config.md +1 -22
- package/skills/erp-kit-app-5-impl-backend/references/module-wiring.md +0 -1
- package/skills/erp-kit-app-5-impl-backend/references/resolver-patterns.md +13 -4
- package/skills/erp-kit-app-6-impl-frontend/SKILL.md +16 -0
- package/skills/erp-kit-app-6-impl-frontend/references/pages.md +16 -46
- package/skills/erp-kit-app-7-impl-review/SKILL.md +29 -23
- package/skills/erp-kit-app-7-impl-review/references/resolver-doc-code-parity.md +16 -17
- package/skills/erp-kit-module-1-requirements/SKILL.md +6 -12
- package/skills/erp-kit-module-2-requirements-review/SKILL.md +29 -5
- package/skills/erp-kit-module-2-requirements-review/references/requirements-report-format.md +19 -0
- package/skills/erp-kit-module-3-plan/SKILL.md +2 -4
- package/skills/erp-kit-module-4-plan-review/SKILL.md +30 -7
- package/skills/erp-kit-module-4-plan-review/references/parity-report-format.md +15 -0
- package/skills/erp-kit-module-6-impl-review/SKILL.md +21 -7
- package/skills/erp-kit-module-6-impl-review/references/impl-parity-report-format.md +15 -0
- package/skills/erp-kit-module-shared/SKILL.md +4 -0
- package/skills/erp-kit-module-shared/references/commands.md +1 -1
- package/skills/erp-kit-module-shared/references/queries.md +5 -6
- package/src/commands/app/index.ts +28 -17
- package/src/commands/check.test.ts +1 -1
- package/src/commands/check.ts +2 -35
- package/src/commands/doc/index.ts +83 -0
- package/src/commands/doc/module.test.ts +119 -0
- package/src/commands/doc/module.ts +114 -0
- package/src/commands/doc/modules.test.ts +103 -0
- package/src/commands/doc/modules.ts +98 -0
- package/src/commands/doc/search.test.ts +94 -0
- package/src/commands/doc/search.ts +111 -0
- package/src/commands/generate-doc.ts +17 -10
- package/src/commands/index.ts +20 -8
- package/src/commands/lib/command-result.ts +30 -0
- package/src/commands/lib/discovery.test.ts +74 -0
- package/src/commands/lib/discovery.ts +106 -0
- package/src/commands/lib/paths.ts +22 -0
- package/src/commands/lib/sync-check-source.test.ts +197 -0
- package/src/commands/lib/sync-check-source.ts +100 -0
- package/src/commands/lib/sync-check-tests.test.ts +178 -0
- package/src/commands/lib/sync-check-tests.ts +69 -0
- package/src/commands/mock/index.ts +11 -6
- package/src/commands/module/generate.ts +13 -8
- package/src/commands/module/index.ts +17 -21
- package/src/commands/parse-doc-test-cases.ts +13 -2
- package/src/commands/sync-check.test.ts +6 -364
- package/src/commands/sync-check.ts +7 -251
- package/src/generator/generate-app-code.test.ts +121 -0
- package/src/generator/generate-app-code.ts +51 -0
- package/src/generator/generate-code-boilerplate.test.ts +1 -2
- package/src/generator/generate-code.test.ts +43 -12
- package/src/generator/generate-code.ts +12 -226
- package/src/generator/generate-errors.ts +34 -0
- package/src/generator/generate-permissions.ts +12 -0
- package/src/generator/generate-shells.ts +28 -0
- package/src/generator/generate-stubs.ts +31 -0
- package/src/generator/parse-resolver-doc.test.ts +89 -0
- package/src/generator/parse-resolver-doc.ts +125 -0
- package/src/generator/scaffold.ts +57 -0
- package/src/generator/stub-templates.test.ts +55 -0
- package/src/generator/stub-templates.ts +145 -0
- package/src/module.ts +3 -0
- package/src/modules/audit/README.md +46 -0
- package/src/modules/audit/command/activateAuditPolicy.generated.ts +6 -0
- package/src/modules/audit/command/activateAuditPolicy.test.ts +186 -0
- package/src/modules/audit/command/activateAuditPolicy.ts +97 -0
- package/src/modules/audit/command/createAuditPolicy.generated.ts +6 -0
- package/src/modules/audit/command/createAuditPolicy.test.ts +395 -0
- package/src/modules/audit/command/createAuditPolicy.ts +131 -0
- package/src/modules/audit/command/deactivateAuditPolicy.generated.ts +6 -0
- package/src/modules/audit/command/deactivateAuditPolicy.test.ts +138 -0
- package/src/modules/audit/command/deactivateAuditPolicy.ts +58 -0
- package/src/modules/audit/command/deleteAuditPolicy.generated.ts +6 -0
- package/src/modules/audit/command/deleteAuditPolicy.test.ts +121 -0
- package/src/modules/audit/command/deleteAuditPolicy.ts +52 -0
- package/src/modules/audit/command/logAuditEvent.generated.ts +6 -0
- package/src/modules/audit/command/logAuditEvent.test.ts +991 -0
- package/src/modules/audit/command/logAuditEvent.ts +357 -0
- package/src/modules/audit/command/reactivateAuditPolicy.generated.ts +6 -0
- package/src/modules/audit/command/reactivateAuditPolicy.test.ts +143 -0
- package/src/modules/audit/command/reactivateAuditPolicy.ts +79 -0
- package/src/modules/audit/command/registerAuditableEntity.generated.ts +6 -0
- package/src/modules/audit/command/registerAuditableEntity.test.ts +268 -0
- package/src/modules/audit/command/registerAuditableEntity.ts +94 -0
- package/src/modules/audit/command/replaceAuditPolicy.generated.ts +6 -0
- package/src/modules/audit/command/replaceAuditPolicy.test.ts +242 -0
- package/src/modules/audit/command/replaceAuditPolicy.ts +91 -0
- package/src/modules/audit/command/updateAuditPolicy.generated.ts +6 -0
- package/src/modules/audit/command/updateAuditPolicy.test.ts +284 -0
- package/src/modules/audit/command/updateAuditPolicy.ts +151 -0
- package/src/modules/audit/db/auditEntry.ts +47 -0
- package/src/modules/audit/db/auditPolicy.ts +33 -0
- package/src/modules/audit/db/auditableEntity.ts +22 -0
- package/src/modules/audit/db/changeDetail.ts +28 -0
- package/src/modules/audit/db/policyFieldRule.ts +23 -0
- package/src/modules/audit/docs/commands/ActivateAuditPolicy.md +69 -0
- package/src/modules/audit/docs/commands/CreateAuditPolicy.md +79 -0
- package/src/modules/audit/docs/commands/DeactivateAuditPolicy.md +55 -0
- package/src/modules/audit/docs/commands/DeleteAuditPolicy.md +55 -0
- package/src/modules/audit/docs/commands/LogAuditEvent.md +137 -0
- package/src/modules/audit/docs/commands/ReactivateAuditPolicy.md +58 -0
- package/src/modules/audit/docs/commands/RegisterAuditableEntity.md +62 -0
- package/src/modules/audit/docs/commands/ReplaceAuditPolicy.md +72 -0
- package/src/modules/audit/docs/commands/UpdateAuditPolicy.md +77 -0
- package/src/modules/audit/docs/features/audit-event-logging.md +126 -0
- package/src/modules/audit/docs/features/audit-policy-configuration.md +135 -0
- package/src/modules/audit/docs/features/field-level-change-tracking.md +95 -0
- package/src/modules/audit/docs/models/AuditEntry.md +55 -0
- package/src/modules/audit/docs/models/AuditPolicy.md +79 -0
- package/src/modules/audit/docs/models/AuditableEntity.md +38 -0
- package/src/modules/audit/docs/models/ChangeDetail.md +55 -0
- package/src/modules/audit/docs/models/PolicyFieldRule.md +45 -0
- package/src/modules/audit/docs/queries/GetAuditEntry.md +49 -0
- package/src/modules/audit/docs/queries/GetAuditPolicy.md +54 -0
- package/src/modules/audit/docs/queries/GetAuditSummary.md +84 -0
- package/src/modules/audit/docs/queries/GetChangeDetails.md +56 -0
- package/src/modules/audit/docs/queries/ListAuditPolicies.md +58 -0
- package/src/modules/audit/docs/queries/SearchAuditEntries.md +91 -0
- package/src/modules/audit/generated/kysely-tailordb.ts +92 -0
- package/src/modules/audit/index.ts +2 -0
- package/src/modules/audit/lib/_db_deps.ts +13 -0
- package/src/modules/audit/lib/errors.generated.ts +120 -0
- package/src/modules/audit/lib/permissions.generated.ts +14 -0
- package/src/modules/audit/lib/types.ts +33 -0
- package/src/modules/audit/module.ts +57 -0
- package/src/modules/audit/permissions.ts +39 -0
- package/src/modules/audit/query/getAuditEntry.generated.ts +5 -0
- package/src/modules/audit/query/getAuditEntry.test.ts +123 -0
- package/src/modules/audit/query/getAuditEntry.ts +42 -0
- package/src/modules/audit/query/getAuditPolicy.generated.ts +5 -0
- package/src/modules/audit/query/getAuditPolicy.test.ts +169 -0
- package/src/modules/audit/query/getAuditPolicy.ts +48 -0
- package/src/modules/audit/query/getAuditSummary.generated.ts +5 -0
- package/src/modules/audit/query/getAuditSummary.test.ts +632 -0
- package/src/modules/audit/query/getAuditSummary.ts +170 -0
- package/src/modules/audit/query/getChangeDetails.generated.ts +5 -0
- package/src/modules/audit/query/getChangeDetails.test.ts +195 -0
- package/src/modules/audit/query/getChangeDetails.ts +48 -0
- package/src/modules/audit/query/listAuditPolicies.generated.ts +5 -0
- package/src/modules/audit/query/listAuditPolicies.test.ts +239 -0
- package/src/modules/audit/query/listAuditPolicies.ts +100 -0
- package/src/modules/audit/query/searchAuditEntries.generated.ts +5 -0
- package/src/modules/audit/query/searchAuditEntries.test.ts +424 -0
- package/src/modules/audit/query/searchAuditEntries.ts +121 -0
- package/src/modules/audit/tailor.config.ts +13 -0
- package/src/modules/audit/tailor.d.ts +13 -0
- package/src/modules/audit/testing/fixtures.ts +215 -0
- package/src/modules/business-partner/README.md +60 -0
- package/src/modules/business-partner/command/activatePartner.generated.ts +6 -0
- package/src/modules/business-partner/command/activatePartner.test.ts +59 -0
- package/src/modules/business-partner/command/activatePartner.ts +45 -0
- package/src/modules/business-partner/command/assignRoleToPartner.generated.ts +6 -0
- package/src/modules/business-partner/command/assignRoleToPartner.test.ts +113 -0
- package/src/modules/business-partner/command/assignRoleToPartner.ts +72 -0
- package/src/modules/business-partner/command/createContactPerson.generated.ts +6 -0
- package/src/modules/business-partner/command/createContactPerson.test.ts +193 -0
- package/src/modules/business-partner/command/createContactPerson.ts +98 -0
- package/src/modules/business-partner/command/createPartner.generated.ts +6 -0
- package/src/modules/business-partner/command/createPartner.test.ts +179 -0
- package/src/modules/business-partner/command/createPartner.ts +82 -0
- package/src/modules/business-partner/command/createPartnerAddress.generated.ts +6 -0
- package/src/modules/business-partner/command/createPartnerAddress.test.ts +195 -0
- package/src/modules/business-partner/command/createPartnerAddress.ts +119 -0
- package/src/modules/business-partner/command/createPartnerBankAccount.generated.ts +6 -0
- package/src/modules/business-partner/command/createPartnerBankAccount.test.ts +297 -0
- package/src/modules/business-partner/command/createPartnerBankAccount.ts +114 -0
- package/src/modules/business-partner/command/createPartnerIdentification.generated.ts +6 -0
- package/src/modules/business-partner/command/createPartnerIdentification.test.ts +255 -0
- package/src/modules/business-partner/command/createPartnerIdentification.ts +97 -0
- package/src/modules/business-partner/command/deactivateContactPerson.generated.ts +6 -0
- package/src/modules/business-partner/command/deactivateContactPerson.test.ts +70 -0
- package/src/modules/business-partner/command/deactivateContactPerson.ts +54 -0
- package/src/modules/business-partner/command/deactivatePartner.generated.ts +6 -0
- package/src/modules/business-partner/command/deactivatePartner.test.ts +59 -0
- package/src/modules/business-partner/command/deactivatePartner.ts +46 -0
- package/src/modules/business-partner/command/deleteContactPerson.generated.ts +6 -0
- package/src/modules/business-partner/command/deleteContactPerson.test.ts +61 -0
- package/src/modules/business-partner/command/deleteContactPerson.ts +48 -0
- package/src/modules/business-partner/command/deletePartner.generated.ts +6 -0
- package/src/modules/business-partner/command/deletePartner.test.ts +58 -0
- package/src/modules/business-partner/command/deletePartner.ts +46 -0
- package/src/modules/business-partner/command/deletePartnerAddress.generated.ts +6 -0
- package/src/modules/business-partner/command/deletePartnerAddress.test.ts +74 -0
- package/src/modules/business-partner/command/deletePartnerAddress.ts +52 -0
- package/src/modules/business-partner/command/deletePartnerBankAccount.generated.ts +6 -0
- package/src/modules/business-partner/command/deletePartnerBankAccount.test.ts +55 -0
- package/src/modules/business-partner/command/deletePartnerBankAccount.ts +36 -0
- package/src/modules/business-partner/command/deletePartnerIdentification.generated.ts +6 -0
- package/src/modules/business-partner/command/deletePartnerIdentification.test.ts +47 -0
- package/src/modules/business-partner/command/deletePartnerIdentification.ts +37 -0
- package/src/modules/business-partner/command/reactivateContactPerson.generated.ts +6 -0
- package/src/modules/business-partner/command/reactivateContactPerson.test.ts +48 -0
- package/src/modules/business-partner/command/reactivateContactPerson.ts +48 -0
- package/src/modules/business-partner/command/reactivatePartner.generated.ts +6 -0
- package/src/modules/business-partner/command/reactivatePartner.test.ts +59 -0
- package/src/modules/business-partner/command/reactivatePartner.ts +46 -0
- package/src/modules/business-partner/command/removeRoleFromPartner.generated.ts +6 -0
- package/src/modules/business-partner/command/removeRoleFromPartner.test.ts +82 -0
- package/src/modules/business-partner/command/removeRoleFromPartner.ts +73 -0
- package/src/modules/business-partner/command/setDefaultPartnerAddress.generated.ts +6 -0
- package/src/modules/business-partner/command/setDefaultPartnerAddress.test.ts +60 -0
- package/src/modules/business-partner/command/setDefaultPartnerAddress.ts +48 -0
- package/src/modules/business-partner/command/setDefaultPartnerBankAccount.generated.ts +6 -0
- package/src/modules/business-partner/command/setDefaultPartnerBankAccount.test.ts +56 -0
- package/src/modules/business-partner/command/setDefaultPartnerBankAccount.ts +51 -0
- package/src/modules/business-partner/command/setPrimaryContactPerson.generated.ts +6 -0
- package/src/modules/business-partner/command/setPrimaryContactPerson.test.ts +63 -0
- package/src/modules/business-partner/command/setPrimaryContactPerson.ts +55 -0
- package/src/modules/business-partner/command/updateContactPerson.generated.ts +6 -0
- package/src/modules/business-partner/command/updateContactPerson.test.ts +193 -0
- package/src/modules/business-partner/command/updateContactPerson.ts +92 -0
- package/src/modules/business-partner/command/updatePartner.generated.ts +6 -0
- package/src/modules/business-partner/command/updatePartner.test.ts +101 -0
- package/src/modules/business-partner/command/updatePartner.ts +76 -0
- package/src/modules/business-partner/command/updatePartnerAddress.generated.ts +6 -0
- package/src/modules/business-partner/command/updatePartnerAddress.test.ts +148 -0
- package/src/modules/business-partner/command/updatePartnerAddress.ts +64 -0
- package/src/modules/business-partner/command/updatePartnerBankAccount.generated.ts +6 -0
- package/src/modules/business-partner/command/updatePartnerBankAccount.test.ts +249 -0
- package/src/modules/business-partner/command/updatePartnerBankAccount.ts +109 -0
- package/src/modules/business-partner/command/updatePartnerIdentification.generated.ts +6 -0
- package/src/modules/business-partner/command/updatePartnerIdentification.test.ts +162 -0
- package/src/modules/business-partner/command/updatePartnerIdentification.ts +105 -0
- package/src/modules/business-partner/db/.gitkeep +0 -0
- package/src/modules/business-partner/db/businessPartner.ts +59 -0
- package/src/modules/business-partner/db/contactPerson.ts +49 -0
- package/src/modules/business-partner/db/partnerAddress.ts +45 -0
- package/src/modules/business-partner/db/partnerBankAccount.ts +53 -0
- package/src/modules/business-partner/db/partnerIdentification.ts +53 -0
- package/src/modules/business-partner/db/partnerRole.ts +43 -0
- package/src/modules/business-partner/docs/commands/ActivatePartner.md +39 -0
- package/src/modules/business-partner/docs/commands/AssignRoleToPartner.md +49 -0
- package/src/modules/business-partner/docs/commands/CreateContactPerson.md +59 -0
- package/src/modules/business-partner/docs/commands/CreatePartner.md +54 -0
- package/src/modules/business-partner/docs/commands/CreatePartnerAddress.md +60 -0
- package/src/modules/business-partner/docs/commands/CreatePartnerBankAccount.md +68 -0
- package/src/modules/business-partner/docs/commands/CreatePartnerIdentification.md +59 -0
- package/src/modules/business-partner/docs/commands/DeactivateContactPerson.md +42 -0
- package/src/modules/business-partner/docs/commands/DeactivatePartner.md +39 -0
- package/src/modules/business-partner/docs/commands/DeleteContactPerson.md +43 -0
- package/src/modules/business-partner/docs/commands/DeletePartner.md +40 -0
- package/src/modules/business-partner/docs/commands/DeletePartnerAddress.md +40 -0
- package/src/modules/business-partner/docs/commands/DeletePartnerBankAccount.md +35 -0
- package/src/modules/business-partner/docs/commands/DeletePartnerIdentification.md +33 -0
- package/src/modules/business-partner/docs/commands/ReactivateContactPerson.md +38 -0
- package/src/modules/business-partner/docs/commands/ReactivatePartner.md +39 -0
- package/src/modules/business-partner/docs/commands/RemoveRoleFromPartner.md +46 -0
- package/src/modules/business-partner/docs/commands/SetDefaultPartnerAddress.md +38 -0
- package/src/modules/business-partner/docs/commands/SetDefaultPartnerBankAccount.md +38 -0
- package/src/modules/business-partner/docs/commands/SetPrimaryContactPerson.md +43 -0
- package/src/modules/business-partner/docs/commands/UpdateContactPerson.md +66 -0
- package/src/modules/business-partner/docs/commands/UpdatePartner.md +48 -0
- package/src/modules/business-partner/docs/commands/UpdatePartnerAddress.md +46 -0
- package/src/modules/business-partner/docs/commands/UpdatePartnerBankAccount.md +64 -0
- package/src/modules/business-partner/docs/commands/UpdatePartnerIdentification.md +52 -0
- package/src/modules/business-partner/docs/features/contact-person-management.md +70 -0
- package/src/modules/business-partner/docs/features/partner-address-management.md +96 -0
- package/src/modules/business-partner/docs/features/partner-bank-account.md +70 -0
- package/src/modules/business-partner/docs/features/partner-identification.md +76 -0
- package/src/modules/business-partner/docs/features/partner-lifecycle.md +59 -0
- package/src/modules/business-partner/docs/features/partner-role-classification.md +73 -0
- package/src/modules/business-partner/docs/models/BusinessPartner.md +64 -0
- package/src/modules/business-partner/docs/models/ContactPerson.md +62 -0
- package/src/modules/business-partner/docs/models/PartnerAddress.md +52 -0
- package/src/modules/business-partner/docs/models/PartnerBankAccount.md +50 -0
- package/src/modules/business-partner/docs/models/PartnerIdentification.md +46 -0
- package/src/modules/business-partner/docs/models/PartnerRole.md +42 -0
- package/src/modules/business-partner/docs/queries/GetContactPerson.md +34 -0
- package/src/modules/business-partner/docs/queries/GetDefaultPartnerAddress.md +40 -0
- package/src/modules/business-partner/docs/queries/GetDefaultPartnerBankAccount.md +36 -0
- package/src/modules/business-partner/docs/queries/GetPartner.md +35 -0
- package/src/modules/business-partner/docs/queries/GetPartnerAddress.md +34 -0
- package/src/modules/business-partner/docs/queries/GetPartnerBankAccount.md +34 -0
- package/src/modules/business-partner/docs/queries/GetPartnerIdentification.md +34 -0
- package/src/modules/business-partner/docs/queries/GetPartnerRole.md +34 -0
- package/src/modules/business-partner/docs/queries/GetPrimaryContactPerson.md +36 -0
- package/src/modules/business-partner/docs/queries/ListContactPersonsByPartner.md +39 -0
- package/src/modules/business-partner/docs/queries/ListPartnerAddressesByPartner.md +41 -0
- package/src/modules/business-partner/docs/queries/ListPartnerBankAccountsByPartner.md +39 -0
- package/src/modules/business-partner/docs/queries/ListPartnerIdentificationsByPartner.md +41 -0
- package/src/modules/business-partner/docs/queries/ListPartnersByRole.md +47 -0
- package/src/modules/business-partner/executor/.gitkeep +0 -0
- package/src/modules/business-partner/generated/.gitkeep +0 -0
- package/src/modules/business-partner/generated/enums.ts +60 -0
- package/src/modules/business-partner/generated/kysely-tailordb.ts +114 -0
- package/src/modules/business-partner/index.ts +2 -0
- package/src/modules/business-partner/lib/_db_deps.ts +17 -0
- package/src/modules/business-partner/lib/errors.generated.ts +172 -0
- package/src/modules/business-partner/lib/permissions.generated.ts +30 -0
- package/src/modules/business-partner/lib/types.ts +58 -0
- package/src/modules/business-partner/module.ts +181 -0
- package/src/modules/business-partner/permissions.ts +3 -0
- package/src/modules/business-partner/query/.gitkeep +0 -0
- package/src/modules/business-partner/query/getContactPerson.generated.ts +5 -0
- package/src/modules/business-partner/query/getContactPerson.test.ts +31 -0
- package/src/modules/business-partner/query/getContactPerson.ts +16 -0
- package/src/modules/business-partner/query/getDefaultPartnerAddress.generated.ts +5 -0
- package/src/modules/business-partner/query/getDefaultPartnerAddress.test.ts +45 -0
- package/src/modules/business-partner/query/getDefaultPartnerAddress.ts +30 -0
- package/src/modules/business-partner/query/getDefaultPartnerBankAccount.generated.ts +5 -0
- package/src/modules/business-partner/query/getDefaultPartnerBankAccount.test.ts +43 -0
- package/src/modules/business-partner/query/getDefaultPartnerBankAccount.ts +17 -0
- package/src/modules/business-partner/query/getPartner.generated.ts +5 -0
- package/src/modules/business-partner/query/getPartner.test.ts +31 -0
- package/src/modules/business-partner/query/getPartner.ts +16 -0
- package/src/modules/business-partner/query/getPartnerAddress.generated.ts +5 -0
- package/src/modules/business-partner/query/getPartnerAddress.test.ts +31 -0
- package/src/modules/business-partner/query/getPartnerAddress.ts +16 -0
- package/src/modules/business-partner/query/getPartnerBankAccount.generated.ts +5 -0
- package/src/modules/business-partner/query/getPartnerBankAccount.test.ts +31 -0
- package/src/modules/business-partner/query/getPartnerBankAccount.ts +16 -0
- package/src/modules/business-partner/query/getPartnerIdentification.generated.ts +5 -0
- package/src/modules/business-partner/query/getPartnerIdentification.test.ts +31 -0
- package/src/modules/business-partner/query/getPartnerIdentification.ts +16 -0
- package/src/modules/business-partner/query/getPartnerRole.generated.ts +5 -0
- package/src/modules/business-partner/query/getPartnerRole.test.ts +31 -0
- package/src/modules/business-partner/query/getPartnerRole.ts +19 -0
- package/src/modules/business-partner/query/getPrimaryContactPerson.generated.ts +5 -0
- package/src/modules/business-partner/query/getPrimaryContactPerson.test.ts +43 -0
- package/src/modules/business-partner/query/getPrimaryContactPerson.ts +17 -0
- package/src/modules/business-partner/query/listContactPersonsByPartner.generated.ts +5 -0
- package/src/modules/business-partner/query/listContactPersonsByPartner.test.ts +77 -0
- package/src/modules/business-partner/query/listContactPersonsByPartner.ts +32 -0
- package/src/modules/business-partner/query/listPartnerAddressesByPartner.generated.ts +5 -0
- package/src/modules/business-partner/query/listPartnerAddressesByPartner.test.ts +71 -0
- package/src/modules/business-partner/query/listPartnerAddressesByPartner.ts +37 -0
- package/src/modules/business-partner/query/listPartnerBankAccountsByPartner.generated.ts +5 -0
- package/src/modules/business-partner/query/listPartnerBankAccountsByPartner.test.ts +59 -0
- package/src/modules/business-partner/query/listPartnerBankAccountsByPartner.ts +32 -0
- package/src/modules/business-partner/query/listPartnerIdentificationsByPartner.generated.ts +5 -0
- package/src/modules/business-partner/query/listPartnerIdentificationsByPartner.test.ts +72 -0
- package/src/modules/business-partner/query/listPartnerIdentificationsByPartner.ts +40 -0
- package/src/modules/business-partner/query/listPartnersByRole.generated.ts +5 -0
- package/src/modules/business-partner/query/listPartnersByRole.test.ts +103 -0
- package/src/modules/business-partner/query/listPartnersByRole.ts +47 -0
- package/src/modules/business-partner/tailor.config.ts +13 -0
- package/src/modules/business-partner/tailor.d.ts +13 -0
- package/src/modules/business-partner/testing/fixtures.ts +204 -0
- package/src/modules/coa-management/README.md +61 -0
- package/src/modules/coa-management/command/.gitkeep +0 -0
- package/src/modules/coa-management/command/activateAccount.generated.ts +6 -0
- package/src/modules/coa-management/command/activateAccount.test.ts +125 -0
- package/src/modules/coa-management/command/activateAccount.ts +105 -0
- package/src/modules/coa-management/command/activateChartOfAccounts.generated.ts +6 -0
- package/src/modules/coa-management/command/activateChartOfAccounts.test.ts +113 -0
- package/src/modules/coa-management/command/activateChartOfAccounts.ts +104 -0
- package/src/modules/coa-management/command/createAccount.generated.ts +6 -0
- package/src/modules/coa-management/command/createAccount.test.ts +767 -0
- package/src/modules/coa-management/command/createAccount.ts +247 -0
- package/src/modules/coa-management/command/createAccountGroup.generated.ts +6 -0
- package/src/modules/coa-management/command/createAccountGroup.test.ts +494 -0
- package/src/modules/coa-management/command/createAccountGroup.ts +207 -0
- package/src/modules/coa-management/command/createChartOfAccounts.generated.ts +6 -0
- package/src/modules/coa-management/command/createChartOfAccounts.test.ts +502 -0
- package/src/modules/coa-management/command/createChartOfAccounts.ts +267 -0
- package/src/modules/coa-management/command/deactivateAccount.generated.ts +6 -0
- package/src/modules/coa-management/command/deactivateAccount.test.ts +199 -0
- package/src/modules/coa-management/command/deactivateAccount.ts +142 -0
- package/src/modules/coa-management/command/deactivateChartOfAccounts.generated.ts +6 -0
- package/src/modules/coa-management/command/deactivateChartOfAccounts.test.ts +91 -0
- package/src/modules/coa-management/command/deactivateChartOfAccounts.ts +88 -0
- package/src/modules/coa-management/command/deleteAccount.generated.ts +6 -0
- package/src/modules/coa-management/command/deleteAccount.test.ts +122 -0
- package/src/modules/coa-management/command/deleteAccount.ts +103 -0
- package/src/modules/coa-management/command/deleteAccountGroup.generated.ts +6 -0
- package/src/modules/coa-management/command/deleteAccountGroup.test.ts +120 -0
- package/src/modules/coa-management/command/deleteAccountGroup.ts +113 -0
- package/src/modules/coa-management/command/deleteChartOfAccounts.generated.ts +6 -0
- package/src/modules/coa-management/command/deleteChartOfAccounts.test.ts +154 -0
- package/src/modules/coa-management/command/deleteChartOfAccounts.ts +133 -0
- package/src/modules/coa-management/command/moveAccountGroup.generated.ts +6 -0
- package/src/modules/coa-management/command/moveAccountGroup.test.ts +199 -0
- package/src/modules/coa-management/command/moveAccountGroup.ts +145 -0
- package/src/modules/coa-management/command/reactivateAccount.generated.ts +6 -0
- package/src/modules/coa-management/command/reactivateAccount.test.ts +126 -0
- package/src/modules/coa-management/command/reactivateAccount.ts +123 -0
- package/src/modules/coa-management/command/updateAccount.generated.ts +6 -0
- package/src/modules/coa-management/command/updateAccount.test.ts +669 -0
- package/src/modules/coa-management/command/updateAccount.ts +370 -0
- package/src/modules/coa-management/command/updateAccountGroup.generated.ts +6 -0
- package/src/modules/coa-management/command/updateAccountGroup.test.ts +253 -0
- package/src/modules/coa-management/command/updateAccountGroup.ts +191 -0
- package/src/modules/coa-management/command/updateChartOfAccounts.generated.ts +6 -0
- package/src/modules/coa-management/command/updateChartOfAccounts.test.ts +153 -0
- package/src/modules/coa-management/command/updateChartOfAccounts.ts +133 -0
- package/src/modules/coa-management/db/.gitkeep +0 -0
- package/src/modules/coa-management/db/account.ts +119 -0
- package/src/modules/coa-management/db/accountGroup.ts +57 -0
- package/src/modules/coa-management/db/chartOfAccounts.ts +55 -0
- package/src/modules/coa-management/docs/commands/ActivateAccount.md +49 -0
- package/src/modules/coa-management/docs/commands/ActivateChartOfAccounts.md +47 -0
- package/src/modules/coa-management/docs/commands/CreateAccount.md +94 -0
- package/src/modules/coa-management/docs/commands/CreateAccountGroup.md +70 -0
- package/src/modules/coa-management/docs/commands/CreateChartOfAccounts.md +72 -0
- package/src/modules/coa-management/docs/commands/DeactivateAccount.md +65 -0
- package/src/modules/coa-management/docs/commands/DeactivateChartOfAccounts.md +44 -0
- package/src/modules/coa-management/docs/commands/DeleteAccount.md +52 -0
- package/src/modules/coa-management/docs/commands/DeleteAccountGroup.md +50 -0
- package/src/modules/coa-management/docs/commands/DeleteChartOfAccounts.md +48 -0
- package/src/modules/coa-management/docs/commands/MoveAccountGroup.md +57 -0
- package/src/modules/coa-management/docs/commands/ReactivateAccount.md +50 -0
- package/src/modules/coa-management/docs/commands/UpdateAccount.md +102 -0
- package/src/modules/coa-management/docs/commands/UpdateAccountGroup.md +62 -0
- package/src/modules/coa-management/docs/commands/UpdateChartOfAccounts.md +49 -0
- package/src/modules/coa-management/docs/features/account-group-hierarchy.md +81 -0
- package/src/modules/coa-management/docs/features/account-lifecycle.md +80 -0
- package/src/modules/coa-management/docs/features/account-management.md +114 -0
- package/src/modules/coa-management/docs/features/chart-of-accounts-setup.md +86 -0
- package/src/modules/coa-management/docs/models/Account.md +84 -0
- package/src/modules/coa-management/docs/models/AccountGroup.md +55 -0
- package/src/modules/coa-management/docs/models/ChartOfAccounts.md +65 -0
- package/src/modules/coa-management/docs/queries/DetectCircularReference.md +52 -0
- package/src/modules/coa-management/docs/queries/GetAccount.md +42 -0
- package/src/modules/coa-management/docs/queries/GetAccountGroup.md +42 -0
- package/src/modules/coa-management/docs/queries/GetChartOfAccounts.md +48 -0
- package/src/modules/coa-management/docs/queries/ListAccountGroups.md +42 -0
- package/src/modules/coa-management/docs/queries/ListAccounts.md +54 -0
- package/src/modules/coa-management/docs/queries/ListUnassignedAccounts.md +40 -0
- package/src/modules/coa-management/executor/.gitkeep +0 -0
- package/src/modules/coa-management/generated/.gitkeep +0 -0
- package/src/modules/coa-management/generated/enums.ts +45 -0
- package/src/modules/coa-management/generated/kysely-tailordb.ts +81 -0
- package/src/modules/coa-management/index.ts +2 -0
- package/src/modules/coa-management/lib/_db_deps.ts +17 -0
- package/src/modules/coa-management/lib/errors.generated.ts +162 -0
- package/src/modules/coa-management/lib/permissions.generated.ts +20 -0
- package/src/modules/coa-management/lib/types.ts +27 -0
- package/src/modules/coa-management/module.ts +136 -0
- package/src/modules/coa-management/permissions.ts +3 -0
- package/src/modules/coa-management/query/.gitkeep +0 -0
- package/src/modules/coa-management/query/detectCircularReference.generated.ts +5 -0
- package/src/modules/coa-management/query/detectCircularReference.test.ts +88 -0
- package/src/modules/coa-management/query/detectCircularReference.ts +46 -0
- package/src/modules/coa-management/query/getAccount.generated.ts +5 -0
- package/src/modules/coa-management/query/getAccount.test.ts +55 -0
- package/src/modules/coa-management/query/getAccount.ts +25 -0
- package/src/modules/coa-management/query/getAccountGroup.generated.ts +5 -0
- package/src/modules/coa-management/query/getAccountGroup.test.ts +55 -0
- package/src/modules/coa-management/query/getAccountGroup.ts +25 -0
- package/src/modules/coa-management/query/getChartOfAccounts.generated.ts +5 -0
- package/src/modules/coa-management/query/getChartOfAccounts.test.ts +79 -0
- package/src/modules/coa-management/query/getChartOfAccounts.ts +28 -0
- package/src/modules/coa-management/query/listAccountGroups.generated.ts +5 -0
- package/src/modules/coa-management/query/listAccountGroups.test.ts +72 -0
- package/src/modules/coa-management/query/listAccountGroups.ts +49 -0
- package/src/modules/coa-management/query/listAccounts.generated.ts +5 -0
- package/src/modules/coa-management/query/listAccounts.test.ts +136 -0
- package/src/modules/coa-management/query/listAccounts.ts +82 -0
- package/src/modules/coa-management/query/listUnassignedAccounts.generated.ts +5 -0
- package/src/modules/coa-management/query/listUnassignedAccounts.test.ts +96 -0
- package/src/modules/coa-management/query/listUnassignedAccounts.ts +39 -0
- package/src/modules/coa-management/tailor.config.ts +13 -0
- package/src/modules/coa-management/tailor.d.ts +13 -0
- package/src/modules/coa-management/testing/fixtures.ts +201 -0
- package/src/modules/item-management/README.md +1 -1
- package/src/modules/item-management/command/activateItem.generated.ts +1 -1
- package/src/modules/item-management/command/activateItem.ts +1 -1
- package/src/modules/item-management/command/assignItemToTaxonomy.generated.ts +1 -1
- package/src/modules/item-management/command/assignItemToTaxonomy.ts +1 -1
- package/src/modules/item-management/command/createItem.generated.ts +1 -1
- package/src/modules/item-management/command/createItem.test.ts +1 -1
- package/src/modules/item-management/command/createItem.ts +1 -1
- package/src/modules/item-management/command/createTaxonomyNode.generated.ts +1 -1
- package/src/modules/item-management/command/createTaxonomyNode.test.ts +1 -1
- package/src/modules/item-management/command/createTaxonomyNode.ts +1 -1
- package/src/modules/item-management/command/deactivateItem.generated.ts +1 -1
- package/src/modules/item-management/command/deactivateItem.ts +1 -1
- package/src/modules/item-management/command/deleteItem.generated.ts +1 -1
- package/src/modules/item-management/command/deleteItem.ts +1 -1
- package/src/modules/item-management/command/deleteTaxonomyNode.generated.ts +1 -1
- package/src/modules/item-management/command/deleteTaxonomyNode.ts +1 -1
- package/src/modules/item-management/command/moveTaxonomyNode.generated.ts +1 -1
- package/src/modules/item-management/command/moveTaxonomyNode.test.ts +1 -1
- package/src/modules/item-management/command/moveTaxonomyNode.ts +1 -1
- package/src/modules/item-management/command/reactivateItem.generated.ts +1 -1
- package/src/modules/item-management/command/reactivateItem.ts +1 -1
- package/src/modules/item-management/command/removeItemFromTaxonomy.generated.ts +1 -1
- package/src/modules/item-management/command/removeItemFromTaxonomy.ts +1 -1
- package/src/modules/item-management/command/updateItem.generated.ts +1 -1
- package/src/modules/item-management/command/updateItem.test.ts +1 -1
- package/src/modules/item-management/command/updateItem.ts +1 -1
- package/src/modules/item-management/command/updateTaxonomyNode.generated.ts +1 -1
- package/src/modules/item-management/command/updateTaxonomyNode.ts +1 -1
- package/src/modules/item-management/lib/errors.generated.ts +1 -1
- package/src/modules/item-management/lib/permissions.generated.ts +1 -1
- package/src/modules/item-management/lib/types.ts +6 -1
- package/src/modules/item-management/module.ts +1 -1
- package/src/modules/item-management/query/calculateNodeDepth.generated.ts +1 -1
- package/src/modules/item-management/query/calculateNodeDepth.ts +1 -1
- package/src/modules/item-management/query/calculateSubtreeDepth.generated.ts +1 -1
- package/src/modules/item-management/query/calculateSubtreeDepth.ts +1 -1
- package/src/modules/item-management/query/detectCircularReference.generated.ts +1 -1
- package/src/modules/item-management/query/detectCircularReference.ts +1 -1
- package/src/modules/item-management/query/getItem.generated.ts +1 -1
- package/src/modules/item-management/query/getItem.ts +1 -1
- package/src/modules/item-management/query/getItemTaxonomyAssignment.generated.ts +1 -1
- package/src/modules/item-management/query/getItemTaxonomyAssignment.ts +1 -1
- package/src/modules/item-management/query/getTaxonomyNode.generated.ts +1 -1
- package/src/modules/item-management/query/getTaxonomyNode.ts +1 -1
- package/src/modules/item-management/query/getTaxonomyNodeAssignments.generated.ts +1 -1
- package/src/modules/item-management/query/getTaxonomyNodeAssignments.ts +1 -1
- package/src/modules/item-management/query/getTaxonomyNodeChildren.generated.ts +1 -1
- package/src/modules/item-management/query/getTaxonomyNodeChildren.ts +1 -1
- package/src/modules/organization/README.md +57 -0
- package/src/modules/organization/command/.gitkeep +0 -0
- package/src/modules/organization/command/activateCompany.generated.ts +6 -0
- package/src/modules/organization/command/activateCompany.test.ts +184 -0
- package/src/modules/organization/command/activateCompany.ts +92 -0
- package/src/modules/organization/command/createCompany.generated.ts +6 -0
- package/src/modules/organization/command/createCompany.test.ts +156 -0
- package/src/modules/organization/command/createCompany.ts +80 -0
- package/src/modules/organization/command/createDepartment.generated.ts +6 -0
- package/src/modules/organization/command/createDepartment.test.ts +239 -0
- package/src/modules/organization/command/createDepartment.ts +98 -0
- package/src/modules/organization/command/createSite.generated.ts +6 -0
- package/src/modules/organization/command/createSite.test.ts +262 -0
- package/src/modules/organization/command/createSite.ts +155 -0
- package/src/modules/organization/command/deactivateCompany.generated.ts +6 -0
- package/src/modules/organization/command/deactivateCompany.test.ts +58 -0
- package/src/modules/organization/command/deactivateCompany.ts +47 -0
- package/src/modules/organization/command/deactivateDepartment.generated.ts +6 -0
- package/src/modules/organization/command/deactivateDepartment.test.ts +115 -0
- package/src/modules/organization/command/deactivateDepartment.ts +63 -0
- package/src/modules/organization/command/deactivateSite.generated.ts +6 -0
- package/src/modules/organization/command/deactivateSite.test.ts +53 -0
- package/src/modules/organization/command/deactivateSite.ts +47 -0
- package/src/modules/organization/command/deleteCompany.generated.ts +6 -0
- package/src/modules/organization/command/deleteCompany.test.ts +99 -0
- package/src/modules/organization/command/deleteCompany.ts +66 -0
- package/src/modules/organization/command/reactivateCompany.generated.ts +6 -0
- package/src/modules/organization/command/reactivateCompany.test.ts +58 -0
- package/src/modules/organization/command/reactivateCompany.ts +47 -0
- package/src/modules/organization/command/reactivateDepartment.generated.ts +6 -0
- package/src/modules/organization/command/reactivateDepartment.test.ts +59 -0
- package/src/modules/organization/command/reactivateDepartment.ts +47 -0
- package/src/modules/organization/command/reactivateSite.generated.ts +6 -0
- package/src/modules/organization/command/reactivateSite.test.ts +53 -0
- package/src/modules/organization/command/reactivateSite.ts +47 -0
- package/src/modules/organization/command/updateCompany.generated.ts +6 -0
- package/src/modules/organization/command/updateCompany.test.ts +239 -0
- package/src/modules/organization/command/updateCompany.ts +127 -0
- package/src/modules/organization/command/updateDepartment.generated.ts +6 -0
- package/src/modules/organization/command/updateDepartment.test.ts +232 -0
- package/src/modules/organization/command/updateDepartment.ts +120 -0
- package/src/modules/organization/command/updateSite.generated.ts +6 -0
- package/src/modules/organization/command/updateSite.test.ts +274 -0
- package/src/modules/organization/command/updateSite.ts +176 -0
- package/src/modules/organization/db/.gitkeep +0 -0
- package/src/modules/organization/db/company.ts +44 -0
- package/src/modules/organization/db/department.ts +46 -0
- package/src/modules/organization/db/site.ts +44 -0
- package/src/modules/organization/docs/commands/ActivateCompany.md +62 -0
- package/src/modules/organization/docs/commands/CreateCompany.md +49 -0
- package/src/modules/organization/docs/commands/CreateDepartment.md +62 -0
- package/src/modules/organization/docs/commands/CreateSite.md +74 -0
- package/src/modules/organization/docs/commands/DeactivateCompany.md +40 -0
- package/src/modules/organization/docs/commands/DeactivateDepartment.md +44 -0
- package/src/modules/organization/docs/commands/DeactivateSite.md +38 -0
- package/src/modules/organization/docs/commands/DeleteCompany.md +50 -0
- package/src/modules/organization/docs/commands/ReactivateCompany.md +39 -0
- package/src/modules/organization/docs/commands/ReactivateDepartment.md +37 -0
- package/src/modules/organization/docs/commands/ReactivateSite.md +37 -0
- package/src/modules/organization/docs/commands/UpdateCompany.md +58 -0
- package/src/modules/organization/docs/commands/UpdateDepartment.md +64 -0
- package/src/modules/organization/docs/commands/UpdateSite.md +80 -0
- package/src/modules/organization/docs/features/company-lifecycle.md +76 -0
- package/src/modules/organization/docs/features/department-management.md +66 -0
- package/src/modules/organization/docs/features/site-management.md +86 -0
- package/src/modules/organization/docs/models/Company.md +60 -0
- package/src/modules/organization/docs/models/Department.md +57 -0
- package/src/modules/organization/docs/models/Site.md +57 -0
- package/src/modules/organization/docs/queries/DetectDepartmentCircularReference.md +50 -0
- package/src/modules/organization/docs/queries/GetCompany.md +40 -0
- package/src/modules/organization/docs/queries/GetDepartment.md +44 -0
- package/src/modules/organization/docs/queries/GetDepartmentChildren.md +40 -0
- package/src/modules/organization/docs/queries/GetSite.md +37 -0
- package/src/modules/organization/docs/queries/ListDepartmentsByCompany.md +54 -0
- package/src/modules/organization/docs/queries/ListSitesByCompany.md +54 -0
- package/src/modules/organization/executor/.gitkeep +0 -0
- package/src/modules/organization/generated/.gitkeep +0 -0
- package/src/modules/organization/generated/kysely-tailordb.ts +77 -0
- package/src/modules/organization/index.ts +2 -0
- package/src/modules/organization/lib/_db_deps.ts +10 -0
- package/src/modules/organization/lib/errors.generated.ts +117 -0
- package/src/modules/organization/lib/permissions.generated.ts +19 -0
- package/src/modules/organization/lib/types.ts +21 -0
- package/src/modules/organization/module.ts +89 -0
- package/src/modules/organization/permissions.ts +3 -0
- package/src/modules/organization/query/.gitkeep +0 -0
- package/src/modules/organization/query/detectDepartmentCircularReference.generated.ts +5 -0
- package/src/modules/organization/query/detectDepartmentCircularReference.test.ts +102 -0
- package/src/modules/organization/query/detectDepartmentCircularReference.ts +27 -0
- package/src/modules/organization/query/getCompany.generated.ts +5 -0
- package/src/modules/organization/query/getCompany.test.ts +70 -0
- package/src/modules/organization/query/getCompany.ts +16 -0
- package/src/modules/organization/query/getDepartment.generated.ts +5 -0
- package/src/modules/organization/query/getDepartment.test.ts +85 -0
- package/src/modules/organization/query/getDepartment.ts +17 -0
- package/src/modules/organization/query/getDepartmentChildren.generated.ts +5 -0
- package/src/modules/organization/query/getDepartmentChildren.test.ts +75 -0
- package/src/modules/organization/query/getDepartmentChildren.ts +21 -0
- package/src/modules/organization/query/getSite.generated.ts +5 -0
- package/src/modules/organization/query/getSite.test.ts +55 -0
- package/src/modules/organization/query/getSite.ts +16 -0
- package/src/modules/organization/query/listDepartmentsByCompany.generated.ts +5 -0
- package/src/modules/organization/query/listDepartmentsByCompany.test.ts +124 -0
- package/src/modules/organization/query/listDepartmentsByCompany.ts +43 -0
- package/src/modules/organization/query/listSitesByCompany.generated.ts +5 -0
- package/src/modules/organization/query/listSitesByCompany.test.ts +126 -0
- package/src/modules/organization/query/listSitesByCompany.ts +41 -0
- package/src/modules/organization/tailor.config.ts +13 -0
- package/src/modules/organization/tailor.d.ts +13 -0
- package/src/modules/organization/testing/fixtures.ts +155 -0
- package/src/modules/primitives/README.md +1 -1
- package/src/modules/primitives/command/activateCategory.generated.ts +1 -1
- package/src/modules/primitives/command/activateCategory.ts +1 -1
- package/src/modules/primitives/command/activateCurrency.generated.ts +1 -1
- package/src/modules/primitives/command/activateCurrency.ts +1 -1
- package/src/modules/primitives/command/activateUnit.generated.ts +1 -1
- package/src/modules/primitives/command/activateUnit.ts +1 -1
- package/src/modules/primitives/command/createCategory.generated.ts +1 -1
- package/src/modules/primitives/command/createCategory.ts +1 -1
- package/src/modules/primitives/command/createCurrency.generated.ts +1 -1
- package/src/modules/primitives/command/createCurrency.ts +1 -1
- package/src/modules/primitives/command/createExchangeRate.generated.ts +1 -1
- package/src/modules/primitives/command/createExchangeRate.ts +1 -1
- package/src/modules/primitives/command/createUnit.generated.ts +1 -1
- package/src/modules/primitives/command/createUnit.ts +1 -1
- package/src/modules/primitives/command/deactivateCategory.generated.ts +1 -1
- package/src/modules/primitives/command/deactivateCategory.ts +1 -1
- package/src/modules/primitives/command/deactivateCurrency.generated.ts +1 -1
- package/src/modules/primitives/command/deactivateCurrency.ts +1 -1
- package/src/modules/primitives/command/deactivateUnit.generated.ts +1 -1
- package/src/modules/primitives/command/deactivateUnit.ts +1 -1
- package/src/modules/primitives/command/setBaseCurrency.generated.ts +1 -1
- package/src/modules/primitives/command/setBaseCurrency.test.ts +8 -64
- package/src/modules/primitives/command/setBaseCurrency.ts +6 -64
- package/src/modules/primitives/command/setReferenceUnit.generated.ts +1 -1
- package/src/modules/primitives/command/setReferenceUnit.ts +1 -1
- package/src/modules/primitives/docs/commands/ActivateCategory.md +1 -1
- package/src/modules/primitives/docs/commands/ActivateCurrency.md +1 -1
- package/src/modules/primitives/docs/commands/ActivateUnit.md +1 -1
- package/src/modules/primitives/docs/commands/CreateExchangeRate.md +2 -2
- package/src/modules/primitives/docs/commands/CreateUnit.md +1 -1
- package/src/modules/primitives/docs/commands/DeactivateCategory.md +1 -1
- package/src/modules/primitives/docs/commands/DeactivateCurrency.md +1 -1
- package/src/modules/primitives/docs/commands/DeactivateUnit.md +1 -1
- package/src/modules/primitives/docs/commands/SetBaseCurrency.md +13 -23
- package/src/modules/primitives/docs/commands/SetReferenceUnit.md +1 -1
- package/src/modules/primitives/docs/features/currency-definitions.md +13 -14
- package/src/modules/primitives/docs/models/Currency.md +3 -4
- package/src/modules/primitives/docs/queries/ConvertAmount.md +2 -2
- package/src/modules/primitives/docs/queries/ConvertQuantity.md +2 -2
- package/src/modules/primitives/lib/errors.generated.ts +6 -1
- package/src/modules/primitives/lib/permissions.generated.ts +1 -1
- package/src/modules/primitives/lib/types.ts +6 -1
- package/src/modules/primitives/module.ts +1 -1
- package/src/modules/primitives/query/convertAmount.generated.ts +1 -1
- package/src/modules/primitives/query/convertAmount.test.ts +1 -1
- package/src/modules/primitives/query/convertAmount.ts +1 -1
- package/src/modules/primitives/query/convertQuantity.generated.ts +1 -1
- package/src/modules/primitives/query/convertQuantity.test.ts +1 -1
- package/src/modules/primitives/query/convertQuantity.ts +1 -1
- package/src/modules/primitives/query/getBaseCurrency.generated.ts +1 -1
- package/src/modules/primitives/query/getBaseCurrency.test.ts +1 -1
- package/src/modules/primitives/query/getBaseCurrency.ts +1 -1
- package/src/modules/primitives/query/getCurrency.generated.ts +1 -1
- package/src/modules/primitives/query/getCurrency.ts +1 -1
- package/src/modules/primitives/query/getUnit.generated.ts +1 -1
- package/src/modules/primitives/query/getUnit.ts +1 -1
- package/src/modules/primitives/query/getUoMCategory.generated.ts +1 -1
- package/src/modules/primitives/query/getUoMCategory.ts +1 -1
- package/src/modules/primitives/query/listUnitsByCategory.generated.ts +1 -1
- package/src/modules/primitives/query/listUnitsByCategory.ts +2 -2
- package/src/modules/product-management/README.md +1 -1
- package/src/modules/product-management/command/activateProduct.generated.ts +1 -1
- package/src/modules/product-management/command/activateProduct.ts +1 -1
- package/src/modules/product-management/command/assignProductToCategory.generated.ts +1 -1
- package/src/modules/product-management/command/assignProductToCategory.ts +1 -1
- package/src/modules/product-management/command/createProduct.generated.ts +1 -1
- package/src/modules/product-management/command/createProduct.test.ts +1 -1
- package/src/modules/product-management/command/createProduct.ts +1 -1
- package/src/modules/product-management/command/createProductAttribute.generated.ts +1 -1
- package/src/modules/product-management/command/createProductAttribute.ts +1 -1
- package/src/modules/product-management/command/createProductAttributeValue.generated.ts +1 -1
- package/src/modules/product-management/command/createProductAttributeValue.ts +1 -1
- package/src/modules/product-management/command/createProductCategory.generated.ts +1 -1
- package/src/modules/product-management/command/createProductCategory.test.ts +1 -1
- package/src/modules/product-management/command/createProductCategory.ts +1 -1
- package/src/modules/product-management/command/deactivateProduct.generated.ts +1 -1
- package/src/modules/product-management/command/deactivateProduct.ts +1 -1
- package/src/modules/product-management/command/deleteProduct.generated.ts +1 -1
- package/src/modules/product-management/command/deleteProduct.ts +1 -1
- package/src/modules/product-management/command/deleteProductAttribute.generated.ts +1 -1
- package/src/modules/product-management/command/deleteProductAttribute.ts +1 -1
- package/src/modules/product-management/command/deleteProductAttributeValue.generated.ts +1 -1
- package/src/modules/product-management/command/deleteProductAttributeValue.ts +1 -1
- package/src/modules/product-management/command/deleteProductCategory.generated.ts +1 -1
- package/src/modules/product-management/command/deleteProductCategory.ts +1 -1
- package/src/modules/product-management/command/generateVariants.generated.ts +1 -1
- package/src/modules/product-management/command/generateVariants.test.ts +1 -1
- package/src/modules/product-management/command/generateVariants.ts +1 -1
- package/src/modules/product-management/command/moveProductCategory.generated.ts +1 -1
- package/src/modules/product-management/command/moveProductCategory.test.ts +1 -1
- package/src/modules/product-management/command/moveProductCategory.ts +1 -1
- package/src/modules/product-management/command/reactivateProduct.generated.ts +1 -1
- package/src/modules/product-management/command/reactivateProduct.ts +1 -1
- package/src/modules/product-management/command/removeProductFromCategory.generated.ts +1 -1
- package/src/modules/product-management/command/removeProductFromCategory.ts +1 -1
- package/src/modules/product-management/command/setProductAttributeAssignment.generated.ts +1 -1
- package/src/modules/product-management/command/setProductAttributeAssignment.ts +1 -1
- package/src/modules/product-management/command/updateProduct.generated.ts +1 -1
- package/src/modules/product-management/command/updateProduct.test.ts +1 -1
- package/src/modules/product-management/command/updateProduct.ts +1 -1
- package/src/modules/product-management/command/updateProductAttribute.generated.ts +1 -1
- package/src/modules/product-management/command/updateProductAttribute.ts +1 -1
- package/src/modules/product-management/command/updateProductAttributeValue.generated.ts +1 -1
- package/src/modules/product-management/command/updateProductAttributeValue.ts +1 -1
- package/src/modules/product-management/command/updateProductCategory.generated.ts +1 -1
- package/src/modules/product-management/command/updateProductCategory.ts +1 -1
- package/src/modules/product-management/lib/errors.generated.ts +1 -1
- package/src/modules/product-management/lib/permissions.generated.ts +1 -1
- package/src/modules/product-management/lib/types.ts +6 -1
- package/src/modules/product-management/module.ts +1 -1
- package/src/modules/product-management/query/calculateCategoryDepth.generated.ts +1 -1
- package/src/modules/product-management/query/calculateCategoryDepth.ts +1 -1
- package/src/modules/product-management/query/detectCategoryCircularReference.generated.ts +1 -1
- package/src/modules/product-management/query/detectCategoryCircularReference.ts +1 -1
- package/src/modules/product-management/query/getProduct.generated.ts +1 -1
- package/src/modules/product-management/query/getProduct.ts +1 -1
- package/src/modules/product-management/query/getProductAttribute.generated.ts +1 -1
- package/src/modules/product-management/query/getProductAttribute.ts +1 -1
- package/src/modules/product-management/query/getProductAttributeAssignment.generated.ts +1 -1
- package/src/modules/product-management/query/getProductAttributeAssignment.ts +1 -1
- package/src/modules/product-management/query/getProductAttributeValue.generated.ts +1 -1
- package/src/modules/product-management/query/getProductAttributeValue.ts +1 -1
- package/src/modules/product-management/query/getProductCategory.generated.ts +1 -1
- package/src/modules/product-management/query/getProductCategory.ts +1 -1
- package/src/modules/product-management/query/getProductCategoryAssignment.generated.ts +1 -1
- package/src/modules/product-management/query/getProductCategoryAssignment.ts +1 -1
- package/src/modules/product-management/query/getProductVariant.generated.ts +1 -1
- package/src/modules/product-management/query/getProductVariant.ts +1 -1
- package/src/modules/product-management/query/listAttributeAssignmentsByAttribute.generated.ts +1 -1
- package/src/modules/product-management/query/listAttributeAssignmentsByAttribute.ts +1 -1
- package/src/modules/product-management/query/listCategoryAssignmentsByProduct.generated.ts +1 -1
- package/src/modules/product-management/query/listCategoryAssignmentsByProduct.ts +1 -1
- package/src/modules/product-management/query/listProductAttributeAssignments.generated.ts +1 -1
- package/src/modules/product-management/query/listProductAttributeAssignments.ts +1 -1
- package/src/modules/product-management/query/listProductAttributeValues.generated.ts +1 -1
- package/src/modules/product-management/query/listProductAttributeValues.ts +1 -1
- package/src/modules/product-management/query/listProductCategoryAssignments.generated.ts +1 -1
- package/src/modules/product-management/query/listProductCategoryAssignments.ts +1 -1
- package/src/modules/product-management/query/listProductCategoryChildren.generated.ts +1 -1
- package/src/modules/product-management/query/listProductCategoryChildren.ts +1 -1
- package/src/modules/product-management/query/listProductVariants.generated.ts +1 -1
- package/src/modules/product-management/query/listProductVariants.ts +1 -1
- package/src/modules/user-management/command/activateUser.generated.ts +1 -1
- package/src/modules/user-management/command/activateUser.ts +1 -1
- package/src/modules/user-management/command/assignPermissionToRole.generated.ts +1 -1
- package/src/modules/user-management/command/assignPermissionToRole.ts +1 -1
- package/src/modules/user-management/command/assignRoleToUser.generated.ts +1 -1
- package/src/modules/user-management/command/assignRoleToUser.ts +1 -1
- package/src/modules/user-management/command/createPermission.generated.ts +1 -1
- package/src/modules/user-management/command/createPermission.ts +1 -1
- package/src/modules/user-management/command/createRole.generated.ts +1 -1
- package/src/modules/user-management/command/createRole.ts +1 -1
- package/src/modules/user-management/command/createUser.generated.ts +1 -1
- package/src/modules/user-management/command/createUser.ts +1 -1
- package/src/modules/user-management/command/deactivateUser.generated.ts +1 -1
- package/src/modules/user-management/command/deactivateUser.ts +1 -1
- package/src/modules/user-management/command/reactivateUser.generated.ts +1 -1
- package/src/modules/user-management/command/reactivateUser.ts +1 -1
- package/src/modules/user-management/command/revokePermissionFromRole.generated.ts +1 -1
- package/src/modules/user-management/command/revokePermissionFromRole.ts +1 -1
- package/src/modules/user-management/command/revokeRoleFromUser.generated.ts +1 -1
- package/src/modules/user-management/command/revokeRoleFromUser.ts +1 -1
- package/src/modules/user-management/docs/commands/CreatePermission.md +3 -3
- package/src/modules/user-management/docs/commands/CreateRole.md +1 -1
- package/src/modules/user-management/docs/queries/ListRolePermissionsByRole.md +39 -0
- package/src/modules/user-management/docs/queries/ListUserRolesByUser.md +39 -0
- package/src/modules/user-management/generated/enums.ts +0 -15
- package/src/modules/user-management/generated/kysely-tailordb.ts +0 -11
- package/src/modules/user-management/lib/errors.generated.ts +1 -1
- package/src/modules/user-management/lib/permissions.generated.ts +1 -1
- package/src/modules/user-management/lib/types.ts +6 -1
- package/src/modules/user-management/module.ts +1 -1
- package/src/shared/createContext.ts +2 -1
- package/src/shared/defineQuery.ts +36 -1
- package/src/shared/requirePermission.ts +3 -3
- package/src/shared/types.ts +3 -0
- package/templates/scaffold/app/backend/package.json +4 -3
- package/templates/scaffold/app/frontend/eslint.config.js +12 -0
- package/templates/scaffold/app/frontend/package.json +10 -7
- package/templates/scaffold/app/frontend/src/hooks/use-toast.ts +30 -0
- package/templates/scaffold/app/frontend/src/pages/user-management/user/create/components/create-user-form.tsx +3 -2
- package/templates/scaffold/app/frontend/vite.config.ts +5 -5
- package/templates/scaffold/module/lib/types.ts +6 -1
- package/templates/scaffold/module/permissions.ts +1 -1
- package/src/commands/module/list.test.ts +0 -57
- package/src/commands/module/list.ts +0 -64
- package/templates/scaffold/module/lib/errors.ts +0 -1
- /package/src/modules/{accounting → audit/db}/.gitkeep +0 -0
- /package/src/modules/audit/{.gitkeep → executor/.gitkeep} +0 -0
- /package/src/modules/{coa-management → business-partner}/.gitkeep +0 -0
- /package/src/modules/{supplier-management → business-partner/command}/.gitkeep +0 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Chart of Accounts Setup
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The Chart of Accounts (CoA) is the top-level container that organizes all GL accounts, account groups, and hierarchies for a company. Each CoA is scoped to a single legal entity (via `companyId` from the organization module), carries a name, description, and a lifecycle status. The CoA inherits its base currency from the parent company's base currency assignment (owned by the organization module), ensuring a single source of truth for monetary scope. A company may define multiple CoA records over time, but only one can be active at any point, ensuring a single authoritative account structure drives all downstream posting.
|
|
6
|
+
|
|
7
|
+
CoA setup is the first step in configuring a company's financial master data. The process typically starts from a country-specific template or a blank structure, proceeds through creating account groups (which define the allowed account numbering ranges), populating GL accounts, and concludes with activation. Once active, the CoA becomes the reference frame for account management, account group hierarchy, and ultimately for journal entries in the general-ledger module.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
Organizations need a well-defined account container to maintain consistent financial reporting and regulatory compliance:
|
|
12
|
+
|
|
13
|
+
- **Single authoritative structure**: One active CoA per company prevents conflicting account definitions and ensures all ledger postings reference a unified structure
|
|
14
|
+
- **Company scoping**: Each CoA is isolated to a legal entity, supporting multi-entity and multi-country deployments with distinct regulatory requirements
|
|
15
|
+
- **Template-driven setup**: Starting from a localized template (similar to Odoo's 50+ country packages or SAP's country-specific CoA) accelerates initial configuration and reduces errors. Templates are externally managed configuration data — each template is an immutable, pre-defined snapshot containing a set of account groups (with numbering ranges) and GL accounts for a specific country or industry. This module treats templates as an **external dependency**: template storage, versioning, and catalog management are outside the scope of coa-management. The `createChartOfAccounts` command accepts an optional `templateId` and delegates template resolution to the template provider. If no template provider is configured, only blank CoA creation is available
|
|
16
|
+
- **Base currency inheritance**: The CoA inherits its base currency from the parent company (organization module), establishing a consistent reporting currency for all accounts without duplicating currency ownership
|
|
17
|
+
- **Company status dependency**: A CoA can only be created for a company that is in ACTIVE status (as defined by the organization module's company lifecycle). Company ACTIVE status confirms the structural identity (legal name, tax ID, registered address, base currency) is complete — it is a prerequisite for financial master data setup, not a guarantee of transactional readiness
|
|
18
|
+
- **Layered readiness model**: Company ACTIVE status is the first gate (structural identity). CoA ACTIVE status is the second gate (accounting readiness). Transactional modules (e.g., general-ledger) require both an ACTIVE company and an ACTIVE CoA before journal postings are permitted. This layered model means a company can be ACTIVE while its accounting structure is still being configured in a DRAFT CoA
|
|
19
|
+
- **Lifecycle gating**: The CoA lifecycle (DRAFT → ACTIVE → ARCHIVED) controls when GL accounts can be created and modified. Accounts can be added to a CoA in both DRAFT and ACTIVE status, but only accounts under an ACTIVE CoA can receive journal postings from downstream modules
|
|
20
|
+
- **Audit preservation**: Deprecated CoA records are archived rather than deleted, retaining the historical account structure for audit and restatement purposes
|
|
21
|
+
|
|
22
|
+
## Process Flow
|
|
23
|
+
|
|
24
|
+
```mermaid
|
|
25
|
+
stateDiagram-v2
|
|
26
|
+
[*] --> Draft: createChartOfAccounts
|
|
27
|
+
Draft --> Active: activateChartOfAccounts
|
|
28
|
+
Active --> Archived: deactivateChartOfAccounts
|
|
29
|
+
Draft --> [*]: deleteChartOfAccounts
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```mermaid
|
|
33
|
+
flowchart TD
|
|
34
|
+
A[Select template or start blank] --> B[Create CoA in DRAFT]
|
|
35
|
+
B --> C[Create account groups with numbering ranges]
|
|
36
|
+
C --> D[Add GL accounts]
|
|
37
|
+
D --> E{Validation passed?}
|
|
38
|
+
E -- Yes --> F[Activate CoA]
|
|
39
|
+
E -- No --> C
|
|
40
|
+
F --> G[CoA ready for postings]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Scenario Patterns
|
|
44
|
+
|
|
45
|
+
- **Greenfield Company Setup**: A newly incorporated entity creates a CoA from a country-localized template, configures account groups (with their numbering ranges), adds required GL accounts, and activates the CoA before the first fiscal period opens
|
|
46
|
+
- **Blank CoA for Holding Company**: A holding company with non-standard reporting requirements creates a blank CoA, manually defines a minimal account structure tailored to consolidation needs, and activates it
|
|
47
|
+
- **Multi-Entity Rollout**: A parent organization sets up separate CoA records for each subsidiary, each scoped to its own company and base currency, reflecting local GAAP requirements
|
|
48
|
+
- **CoA Replacement**: A company undergoing a regulatory change creates a new CoA in DRAFT alongside the currently active one, migrates account mappings, then archives the old CoA and activates the new one
|
|
49
|
+
- **Draft Cleanup**: An incorrectly configured CoA still in DRAFT is deleted along with all child Account and AccountGroup records via cascade deletion. Because only DRAFT CoAs can be deleted, all child accounts are guaranteed to be in DRAFT status with no posted transactions, making the cascade safe. Each cascade-deleted child emits its own audit event before the CoA deletion event
|
|
50
|
+
- **Currency Inheritance**: When a CoA is created for a company, it inherits the company's base currency (set via the organization module). All accounts within the CoA use this inherited currency as the default reporting currency
|
|
51
|
+
|
|
52
|
+
## Test Cases
|
|
53
|
+
|
|
54
|
+
- CoA lifecycle follows DRAFT -> ACTIVE -> ARCHIVED state machine
|
|
55
|
+
- CoA can only be created in DRAFT status
|
|
56
|
+
- CoA name is required and must be non-empty
|
|
57
|
+
- CoA must reference a valid companyId from the organization module
|
|
58
|
+
- The referenced company must be in ACTIVE status; creating a CoA for a DRAFT or INACTIVE company is rejected
|
|
59
|
+
- CoA inherits its base currency from the parent company's base currency (organization module)
|
|
60
|
+
- The parent company must have a base currency assigned before a CoA can be created (guaranteed by the ACTIVE status requirement, since company activation requires base currency)
|
|
61
|
+
- Only one CoA per company can be in ACTIVE status at a time
|
|
62
|
+
- Activating a DRAFT CoA transitions status to ACTIVE
|
|
63
|
+
- Activating an already ACTIVE CoA fails with an invalid status transition error
|
|
64
|
+
- Archiving an ACTIVE CoA transitions status to ARCHIVED
|
|
65
|
+
- Archiving a DRAFT CoA fails with an invalid status transition error
|
|
66
|
+
- Reactivating an ARCHIVED CoA is not permitted
|
|
67
|
+
- Only DRAFT CoA records can be deleted; ACTIVE and ARCHIVED records cannot
|
|
68
|
+
- Deleting a DRAFT CoA cascade-deletes all child Account and AccountGroup records belonging to it; all children are guaranteed to be in DRAFT status with no posted transactions since account activation requires an ACTIVE CoA
|
|
69
|
+
- Each cascade-deleted child record (Account and AccountGroup) emits its own audit event, followed by the CoA deletion audit event
|
|
70
|
+
- GL accounts can be created under a CoA in DRAFT or ACTIVE status
|
|
71
|
+
- GL accounts under an ACTIVE CoA can receive journal postings from downstream modules
|
|
72
|
+
- CoA records are scoped to a company; CoA records from different companies are isolated
|
|
73
|
+
- Creating a second ACTIVE CoA for the same company fails with a uniqueness constraint error
|
|
74
|
+
- CoA description is optional and can be updated while in DRAFT or ACTIVE status
|
|
75
|
+
- Creating a CoA emits an audit event via the audit module recording the acting user, timestamp, and initial field values
|
|
76
|
+
- Updating a CoA (name, description) emits an audit event recording the previous and new field values
|
|
77
|
+
- Activating a CoA emits an audit event recording the status transition from DRAFT to ACTIVE
|
|
78
|
+
- Archiving a CoA emits an audit event recording the status transition from ACTIVE to ARCHIVED
|
|
79
|
+
- Deleting a DRAFT CoA emits an audit event recording the deletion and acting user
|
|
80
|
+
|
|
81
|
+
## Reference Links
|
|
82
|
+
|
|
83
|
+
- [SAP Chart of Accounts Configuration](https://help.sap.com/docs/SAP_S4HANA_ON-PREMISE/ee3509643e954b3da2e0ebfa846c02e1/5c20e46f4ce446a592e69e26ee3c0b37.html)
|
|
84
|
+
- [Oracle Fusion Chart of Accounts Structure](https://docs.oracle.com/en/cloud/saas/financials/24d/oafcf/chart-of-accounts.html)
|
|
85
|
+
- [Odoo Chart of Accounts and Localization](https://www.odoo.com/documentation/19.0/applications/finance/accounting/get_started/chart_of_accounts.html)
|
|
86
|
+
- [NetSuite Chart of Accounts Overview](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N671498.html)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Account
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Account is the fundamental GL account entity in the ERP system — every journal entry, sub-ledger posting, and financial report ultimately references one or more GL accounts. Each account carries a structured numeric code, a descriptive name, an account type (ASSET, LIABILITY, EQUITY, REVENUE, EXPENSE), an account classification describing its operational role (REGULAR, RECEIVABLE, PAYABLE, BANK_CASH, FIXED_ASSET, RETAINED_EARNINGS, NON_POSTING), optional currency restriction, reconciliation flag, default tax code reference, and tags.
|
|
6
|
+
|
|
7
|
+
Accounts are always scoped to a parent CoA and may optionally belong to an account group. The account follows a lifecycle state machine (DRAFT -> ACTIVE <-> INACTIVE) that governs posting eligibility, mutability, and deletion.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Stateful
|
|
14
|
+
|
|
15
|
+
#### State Transitions
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
stateDiagram-v2
|
|
19
|
+
[*] --> Draft: createAccount
|
|
20
|
+
Draft --> Active: activateAccount
|
|
21
|
+
Active --> Inactive: deactivateAccount
|
|
22
|
+
Inactive --> Active: reactivateAccount
|
|
23
|
+
Draft --> [*]: deleteAccount
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Command Definitions
|
|
27
|
+
|
|
28
|
+
- [createAccount](../commands/CreateAccount.md) - Create a new GL account in DRAFT status within a CoA
|
|
29
|
+
- [updateAccount](../commands/UpdateAccount.md) - Update mutable fields of an existing account (structural fields immutable after posting)
|
|
30
|
+
- [activateAccount](../commands/ActivateAccount.md) - Transition account from DRAFT to ACTIVE
|
|
31
|
+
- [deactivateAccount](../commands/DeactivateAccount.md) - Transition account from ACTIVE to INACTIVE with optional successor mapping
|
|
32
|
+
- [reactivateAccount](../commands/ReactivateAccount.md) - Transition account from INACTIVE to ACTIVE
|
|
33
|
+
- [deleteAccount](../commands/DeleteAccount.md) - Permanently delete a DRAFT account with no posted transactions
|
|
34
|
+
|
|
35
|
+
### Query Definitions
|
|
36
|
+
|
|
37
|
+
- [GetAccount](../queries/GetAccount.md) - Retrieve an account by id or by code within a CoA
|
|
38
|
+
- [ListAccounts](../queries/ListAccounts.md) - List accounts within a CoA with optional filters (type, classification, group, tags, status)
|
|
39
|
+
|
|
40
|
+
### Models
|
|
41
|
+
|
|
42
|
+
- Account
|
|
43
|
+
|
|
44
|
+
### Invariants
|
|
45
|
+
|
|
46
|
+
- Accounts can only be created in DRAFT status
|
|
47
|
+
- Account creation and update require the parent CoA to be in DRAFT or ACTIVE status; operations on accounts under an ARCHIVED CoA are rejected
|
|
48
|
+
- Account deactivation and reactivation require the parent CoA to be in ACTIVE status; the DRAFT CoA case is unreachable because these operations act on ACTIVE or INACTIVE accounts, which can only exist under an ACTIVE CoA (since account activation requires an ACTIVE CoA). Operations on accounts under an ARCHIVED CoA are rejected
|
|
49
|
+
- Account deletion requires the parent CoA to be in DRAFT or ACTIVE status; operations on accounts under an ARCHIVED CoA are rejected
|
|
50
|
+
- Account activation (activateAccount) specifically requires the parent CoA to be in ACTIVE status — not DRAFT. This ensures that all accounts under a DRAFT CoA remain in DRAFT status, which is a prerequisite for safe cascade deletion of DRAFT CoAs
|
|
51
|
+
- Account code is required, must be a structured numeric identifier, and must be unique within its CoA
|
|
52
|
+
- Account code is immutable after the account has posted transactions
|
|
53
|
+
- Account name is required and must be non-empty
|
|
54
|
+
- Account type must be one of ASSET, LIABILITY, EQUITY, REVENUE, or EXPENSE
|
|
55
|
+
- Account classification must be one of REGULAR, RECEIVABLE, PAYABLE, BANK_CASH, FIXED_ASSET, RETAINED_EARNINGS, or NON_POSTING
|
|
56
|
+
- Account classification defaults to REGULAR when not explicitly set
|
|
57
|
+
- Classification must be compatible with account type: RECEIVABLE, BANK_CASH, and FIXED_ASSET require type ASSET; PAYABLE requires type LIABILITY; RETAINED_EARNINGS requires type EQUITY; REGULAR and NON_POSTING are allowed with any type
|
|
58
|
+
- Only one account per CoA may carry the RETAINED_EARNINGS classification
|
|
59
|
+
- Reconciliation flag defaults to false for REGULAR, FIXED_ASSET, RETAINED_EARNINGS, and NON_POSTING classifications
|
|
60
|
+
- Accounts with RECEIVABLE, PAYABLE, or BANK_CASH classification must have reconciliation enabled (enforced invariant, not a default); attempting to set reconciliation to false for these classifications is rejected
|
|
61
|
+
- RECEIVABLE and PAYABLE accounts block direct manual journal postings (control account constraint stored here, enforced by GL/posting layer)
|
|
62
|
+
- NON_POSTING accounts are excluded from journal entry target selection (postability attribute only, not a hierarchy mechanism)
|
|
63
|
+
- Currency restriction, when provided, must reference a valid currency from the primitives module
|
|
64
|
+
- An account with currency restriction only accepts postings in that currency
|
|
65
|
+
- Once an account has posted transactions, structural fields (code, type, classification, currency restriction) become immutable
|
|
66
|
+
- Only ACTIVE accounts can receive new journal postings
|
|
67
|
+
- Only DRAFT accounts with no posted transactions can be deleted; ACTIVE and INACTIVE accounts cannot be deleted regardless of transaction history
|
|
68
|
+
- Deleting a DRAFT account that has posted transactions is rejected to preserve ledger integrity
|
|
69
|
+
- Default tax code is optional free-text (future migration to validated reference when tax-configuration module is implemented)
|
|
70
|
+
- Tags are optional; when provided, stored as a comma-separated string of labels (e.g. `"tag1,tag2"`)
|
|
71
|
+
- An account can optionally belong to an account group within the same CoA; assigning an account to a group in a different CoA fails validation
|
|
72
|
+
- When an account belongs to a group with a defined number range, the account code must always fall within that range — this invariant is enforced on creation, on group reassignment, and on code changes while the account remains in the same group
|
|
73
|
+
- Deactivation exposes a pre-deactivation hook for the general-ledger module to block the transition when open or unreconciled balances exist
|
|
74
|
+
- A successor account can optionally be mapped during deactivation; the successor must be in ACTIVE status
|
|
75
|
+
- Reactivating an account clears any previously mapped successor account
|
|
76
|
+
- All account lifecycle operations (create, update, activate, deactivate, reactivate, delete) emit audit events via the audit module recording the acting user, timestamp, CoA reference, account code, classification, and relevant field values
|
|
77
|
+
|
|
78
|
+
### Relationships
|
|
79
|
+
|
|
80
|
+
- **References ChartOfAccounts**: Each account belongs to a ChartOfAccounts via chartOfAccountsId
|
|
81
|
+
- **References AccountGroup**: Each account optionally references an AccountGroup via accountGroupId
|
|
82
|
+
- **References Currency**: Each account optionally references a Currency from the primitives module via currencyRestriction
|
|
83
|
+
- **References Account (successor)**: Each account optionally references another Account as successor via successorAccountId
|
|
84
|
+
- **Referenced By Downstream Modules**: Accounts are referenced by general-ledger, AP, AR, and fixed-asset modules
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# AccountGroup
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
AccountGroup organizes GL accounts into logical categories and nestable hierarchical tree structures within a Chart of Accounts. Each group has a code, name, optional parent group reference for nesting, a sort order that controls display sequencing, and an optional account number range that constrains which account codes can be assigned to the group's members.
|
|
6
|
+
|
|
7
|
+
Groups can be nested to form a multi-level tree hierarchy. A root group with no parent represents a top-level section (e.g., "Assets"), while child groups subdivide it into progressively finer categories. The hierarchy defines structural metadata for the CoA; how that structure is consumed for balance aggregation or financial statement rendering is the responsibility of downstream modules.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Standard
|
|
14
|
+
|
|
15
|
+
### Command Definitions
|
|
16
|
+
|
|
17
|
+
- [createAccountGroup](../commands/CreateAccountGroup.md) - Create a new root or child account group within a CoA
|
|
18
|
+
- [updateAccountGroup](../commands/UpdateAccountGroup.md) - Update the name, sort order, or number range of an existing group
|
|
19
|
+
- [moveAccountGroup](../commands/MoveAccountGroup.md) - Reparent a group within the same CoA hierarchy
|
|
20
|
+
- [deleteAccountGroup](../commands/DeleteAccountGroup.md) - Delete a group with no children or assigned accounts
|
|
21
|
+
|
|
22
|
+
### Query Definitions
|
|
23
|
+
|
|
24
|
+
- [GetAccountGroup](../queries/GetAccountGroup.md) - Retrieve an account group by id or code within a CoA
|
|
25
|
+
- [ListAccountGroups](../queries/ListAccountGroups.md) - List account groups within a CoA, optionally filtered by parent
|
|
26
|
+
- [ListUnassignedAccounts](../queries/ListUnassignedAccounts.md) - List active accounts within a CoA that are not assigned to any group
|
|
27
|
+
- [DetectCircularReference](../queries/DetectCircularReference.md) - Validate that reparenting a group would not create a cycle
|
|
28
|
+
|
|
29
|
+
### Models
|
|
30
|
+
|
|
31
|
+
- AccountGroup
|
|
32
|
+
|
|
33
|
+
### Invariants
|
|
34
|
+
|
|
35
|
+
- All account group mutation operations (create, update, move, delete) require the parent CoA to be in DRAFT or ACTIVE status; operations on groups under an ARCHIVED CoA are rejected
|
|
36
|
+
- Account group code is required and must be unique within its CoA
|
|
37
|
+
- Account group code is immutable after creation; it cannot be changed via updateAccountGroup
|
|
38
|
+
- Account group name is required and must be non-empty
|
|
39
|
+
- A group with no parent reference is treated as a root-level group
|
|
40
|
+
- A group with a parent reference must reference a valid group within the same CoA
|
|
41
|
+
- Circular parent references are rejected (a group cannot be its own ancestor)
|
|
42
|
+
- Hierarchy depth is not artificially limited but must remain acyclic
|
|
43
|
+
- Sort order controls the display sequence of sibling groups under the same parent
|
|
44
|
+
- Account number range, when defined, must be a valid non-overlapping interval within the CoA
|
|
45
|
+
- Accounts assigned to a group must have account numbers within the group's allowed range (when a range is defined)
|
|
46
|
+
- A group that contains child groups or assigned accounts cannot be deleted
|
|
47
|
+
- Moving a group to a new parent within the same CoA updates the hierarchy without breaking existing account assignments
|
|
48
|
+
- Account group assignment is optional; accounts can exist in a CoA without belonging to any group
|
|
49
|
+
- All account group operations (create, update, move, delete) emit audit events via the audit module recording the acting user, timestamp, and relevant field values
|
|
50
|
+
|
|
51
|
+
### Relationships
|
|
52
|
+
|
|
53
|
+
- **References ChartOfAccounts**: Each group belongs to a ChartOfAccounts via chartOfAccountsId
|
|
54
|
+
- **Self-Referential Parent-Child**: Each group optionally references another AccountGroup as its parent, forming a tree
|
|
55
|
+
- **Referenced By Accounts**: Accounts optionally reference an AccountGroup for hierarchical organization
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# ChartOfAccounts
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
ChartOfAccounts is the top-level container that organizes all GL accounts and account groups for a company. Each CoA is scoped to a single legal entity (via companyId from the organization module), carries a name, description, and a lifecycle status. The CoA inherits its base currency from the parent company's base currency assignment. A company may define multiple CoA records over time, but only one can be ACTIVE at any point, ensuring a single authoritative account structure drives all downstream posting.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> Draft: createChartOfAccounts
|
|
18
|
+
Draft --> Active: activateChartOfAccounts
|
|
19
|
+
Active --> Archived: deactivateChartOfAccounts
|
|
20
|
+
Draft --> [*]: deleteChartOfAccounts
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Command Definitions
|
|
24
|
+
|
|
25
|
+
- [createChartOfAccounts](../commands/CreateChartOfAccounts.md) - Create a new CoA in DRAFT status for a company
|
|
26
|
+
- [updateChartOfAccounts](../commands/UpdateChartOfAccounts.md) - Update mutable fields (name, description) of an existing CoA
|
|
27
|
+
- [activateChartOfAccounts](../commands/ActivateChartOfAccounts.md) - Transition CoA from DRAFT to ACTIVE
|
|
28
|
+
- [deactivateChartOfAccounts](../commands/DeactivateChartOfAccounts.md) - Transition CoA from ACTIVE to ARCHIVED
|
|
29
|
+
- [deleteChartOfAccounts](../commands/DeleteChartOfAccounts.md) - Permanently delete a DRAFT CoA
|
|
30
|
+
|
|
31
|
+
### Query Definitions
|
|
32
|
+
|
|
33
|
+
- [GetChartOfAccounts](../queries/GetChartOfAccounts.md) - Retrieve a CoA by id or companyId
|
|
34
|
+
- [ListAccounts](../queries/ListAccounts.md) - List accounts within this CoA (cross-reference)
|
|
35
|
+
- [ListAccountGroups](../queries/ListAccountGroups.md) - List account groups within this CoA (cross-reference)
|
|
36
|
+
|
|
37
|
+
### Models
|
|
38
|
+
|
|
39
|
+
- ChartOfAccounts
|
|
40
|
+
|
|
41
|
+
### Invariants
|
|
42
|
+
|
|
43
|
+
- CoA name is required and must be non-empty
|
|
44
|
+
- CoA description is optional and can be updated while in DRAFT or ACTIVE status
|
|
45
|
+
- CoA must reference a valid companyId from the organization module
|
|
46
|
+
- The referenced company must be in ACTIVE status at CoA creation time; creating a CoA for a DRAFT or INACTIVE company is rejected
|
|
47
|
+
- CoA inherits its base currency from the parent company; the company must have a base currency assigned (guaranteed by the ACTIVE status requirement, since company activation requires base currency)
|
|
48
|
+
- Only one CoA per company can be in ACTIVE status at a time; activating a second CoA for the same company fails with a uniqueness constraint error
|
|
49
|
+
- Activating an already ACTIVE CoA fails with an invalid status transition error
|
|
50
|
+
- Archiving a DRAFT CoA fails with an invalid status transition error (only ACTIVE CoA can be archived)
|
|
51
|
+
- Reactivating an ARCHIVED CoA is not permitted (one-way transition from ACTIVE to ARCHIVED)
|
|
52
|
+
- Only DRAFT CoA records can be deleted; ACTIVE and ARCHIVED records are preserved
|
|
53
|
+
- Deleting a DRAFT CoA cascade-deletes all child Account and AccountGroup records; since the CoA is DRAFT, all child accounts are guaranteed to be in DRAFT status with no posted transactions
|
|
54
|
+
- GL accounts can be created under a CoA in DRAFT or ACTIVE status
|
|
55
|
+
- Only accounts under an ACTIVE CoA can receive journal postings from downstream modules
|
|
56
|
+
- All CoA lifecycle operations (create, update, activate, deactivate/archive, delete) emit audit events via the audit module recording the acting user, timestamp, and relevant field values
|
|
57
|
+
|
|
58
|
+
### Relationships
|
|
59
|
+
|
|
60
|
+
- **References Company**: Each CoA references a Company from the organization module via companyId
|
|
61
|
+
- **References Currency**: CoA persists the base currency inherited from the parent Company at creation time via baseCurrencyId (foreign key to Currency from the primitives module)
|
|
62
|
+
- **Referenced By Accounts**: GL accounts belong to a CoA (one-to-many)
|
|
63
|
+
- **Referenced By AccountGroups**: Account groups belong to a CoA (one-to-many)
|
|
64
|
+
- **Referenced By Downstream Modules**: The general-ledger module requires an ACTIVE CoA before journal postings are permitted
|
|
65
|
+
- **Template Provider (external dependency)**: CoA creation optionally accepts a templateId resolved by an external template provider. Templates are immutable snapshots containing pre-defined account groups and GL accounts. Template storage, versioning, and catalog management are outside the scope of this module
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# DetectCircularReference
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
DetectCircularReference validates that reparenting an account group would not create a circular reference in the tree hierarchy. It walks up the ancestor chain from the proposed new parent, checking whether the group being moved appears as an ancestor. If the moved group is found in the ancestor chain, the move would create a cycle.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Accepts `groupId` (the group being moved) and `newParentId` (the proposed new parent)
|
|
10
|
+
- Returns `{ isCircular: boolean }` — true if the move would create a cycle, false otherwise
|
|
11
|
+
- A group cannot be moved to become a descendant of itself
|
|
12
|
+
- Self-referencing is explicitly rejected: newParentId === groupId
|
|
13
|
+
- Ancestor chain is traversed from the new parent upward to the root
|
|
14
|
+
- If the moved group's ID is found in the ancestor chain, the move is circular
|
|
15
|
+
- Traversal stops at root (parentAccountGroupId = null) or broken chain (parent not found)
|
|
16
|
+
- Only relevant when newParentId is non-null (promoting to root cannot create a cycle)
|
|
17
|
+
|
|
18
|
+
## Process Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart TD
|
|
22
|
+
A[Receive groupId + newParentId] --> B{newParentId === groupId?}
|
|
23
|
+
B -->|Yes| C[Return isCircular: true]
|
|
24
|
+
B -->|No| D[Set ancestorId = newParentId]
|
|
25
|
+
D --> E[SELECT ancestor where id = ancestorId]
|
|
26
|
+
E --> F{Ancestor found?}
|
|
27
|
+
F -->|No| G[Return isCircular: false]
|
|
28
|
+
F -->|Yes| H[Set ancestorId = ancestor.parentAccountGroupId]
|
|
29
|
+
H --> I{ancestorId === groupId?}
|
|
30
|
+
I -->|Yes| C
|
|
31
|
+
I -->|No| J{ancestorId is null?}
|
|
32
|
+
J -->|Yes| G
|
|
33
|
+
J -->|No| E
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## External Dependencies
|
|
37
|
+
|
|
38
|
+
- None
|
|
39
|
+
|
|
40
|
+
## Error Scenarios
|
|
41
|
+
|
|
42
|
+
- **CIRCULAR_REFERENCE**: The moved group appears in the ancestor chain of the new parent — returns isCircular: true
|
|
43
|
+
- **SELF_REFERENCE**: Group is moved to itself as parent — returns isCircular: true
|
|
44
|
+
|
|
45
|
+
## Test Cases
|
|
46
|
+
|
|
47
|
+
- detects self-reference as circular
|
|
48
|
+
- detects moving group under its child as circular
|
|
49
|
+
- detects moving group under its grandchild as circular
|
|
50
|
+
- returns not circular for valid move
|
|
51
|
+
- returns not circular when new parent is root
|
|
52
|
+
- handles broken ancestor chain gracefully (not circular)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# GetAccount
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetAccount retrieves a single GL account record by id or by code within a CoA. The input is a union type — callers specify exactly one lookup variant. This serves as the core account lookup for existence checks, uniqueness validation, and all account lifecycle commands.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Accepts one of two lookup variants:
|
|
10
|
+
- `{ id }` — retrieves by unique identifier
|
|
11
|
+
- `{ chartOfAccountsId, code }` — retrieves by account code within a specific CoA
|
|
12
|
+
- Returns the full account record including all fields (id, chartOfAccountsId, accountGroupId, code, name, accountType, classification, currencyRestriction, reconciliation, defaultTaxCode, tags, status, successorAccountId, hasPostedTransactions, timestamps)
|
|
13
|
+
- Returns null if no matching account is found
|
|
14
|
+
- All comparisons are exact
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive input] --> B{Which variant?}
|
|
21
|
+
B -->|id| C[SELECT from Account where id = input.id]
|
|
22
|
+
B -->|chartOfAccountsId + code| D[SELECT from Account where chartOfAccountsId = input.chartOfAccountsId AND code = input.code]
|
|
23
|
+
C --> E{Account found?}
|
|
24
|
+
D --> E
|
|
25
|
+
E -->|Yes| F[Return account record]
|
|
26
|
+
E -->|No| G[Return null]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## External Dependencies
|
|
30
|
+
|
|
31
|
+
- None
|
|
32
|
+
|
|
33
|
+
## Error Scenarios
|
|
34
|
+
|
|
35
|
+
- **ACCOUNT_NOT_FOUND**: No account matches the given criteria — caller receives null
|
|
36
|
+
|
|
37
|
+
## Test Cases
|
|
38
|
+
|
|
39
|
+
- returns account when found by id
|
|
40
|
+
- returns null when account not found by id
|
|
41
|
+
- returns account when found by code within CoA
|
|
42
|
+
- returns null when account not found by code within CoA
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# GetAccountGroup
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetAccountGroup retrieves a single account group record by id or by code within a CoA. The input is a union type — callers specify exactly one lookup variant. This serves as the core group lookup for existence checks, hierarchy validation, and group management commands.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Accepts one of two lookup variants:
|
|
10
|
+
- `{ id }` — retrieves by unique identifier
|
|
11
|
+
- `{ chartOfAccountsId, code }` — retrieves by group code within a specific CoA
|
|
12
|
+
- Returns the full group record including all fields (id, chartOfAccountsId, parentAccountGroupId, code, name, sortOrder, rangeStart, rangeEnd, timestamps)
|
|
13
|
+
- Returns null if no matching group is found
|
|
14
|
+
- All comparisons are exact
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive input] --> B{Which variant?}
|
|
21
|
+
B -->|id| C[SELECT from AccountGroup where id = input.id]
|
|
22
|
+
B -->|chartOfAccountsId + code| D[SELECT from AccountGroup where chartOfAccountsId = input.chartOfAccountsId AND code = input.code]
|
|
23
|
+
C --> E{Group found?}
|
|
24
|
+
D --> E
|
|
25
|
+
E -->|Yes| F[Return group record]
|
|
26
|
+
E -->|No| G[Return null]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## External Dependencies
|
|
30
|
+
|
|
31
|
+
- None
|
|
32
|
+
|
|
33
|
+
## Error Scenarios
|
|
34
|
+
|
|
35
|
+
- **ACCOUNT_GROUP_NOT_FOUND**: No group matches the given criteria — caller receives null
|
|
36
|
+
|
|
37
|
+
## Test Cases
|
|
38
|
+
|
|
39
|
+
- returns group when found by id
|
|
40
|
+
- returns null when group not found by id
|
|
41
|
+
- returns group when found by code within CoA
|
|
42
|
+
- returns null when group not found by code within CoA
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# GetChartOfAccounts
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
GetChartOfAccounts retrieves a single Chart of Accounts record by id or by companyId. The input is a union type — callers specify exactly one lookup field. This serves as the core CoA lookup for existence checks, company-scoped retrieval, and all CoA lifecycle commands.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Accepts one of two lookup variants:
|
|
10
|
+
- `{ id }` — retrieves by unique identifier
|
|
11
|
+
- `{ companyId, status? }` — retrieves the CoA for a specific company, optionally filtered by status (e.g., pass `ACTIVE` to find the current active CoA for uniqueness checks during activation)
|
|
12
|
+
- When looking up by companyId without a status filter, returns the most recently created CoA
|
|
13
|
+
- Returns the full CoA record including all fields (id, companyId, name, description, baseCurrencyId, status, timestamps)
|
|
14
|
+
- Returns null if no matching CoA is found
|
|
15
|
+
- All comparisons are exact
|
|
16
|
+
|
|
17
|
+
## Process Flow
|
|
18
|
+
|
|
19
|
+
```mermaid
|
|
20
|
+
flowchart TD
|
|
21
|
+
A[Receive input] --> B{Which variant?}
|
|
22
|
+
B -->|id| C[SELECT from ChartOfAccounts where id = input.id]
|
|
23
|
+
B -->|companyId| D{Status filter provided?}
|
|
24
|
+
D -->|Yes| D1[SELECT from ChartOfAccounts where companyId = input.companyId AND status = input.status]
|
|
25
|
+
D -->|No| D2[SELECT from ChartOfAccounts where companyId = input.companyId ORDER BY createdAt DESC LIMIT 1]
|
|
26
|
+
C --> E{CoA found?}
|
|
27
|
+
D1 --> E
|
|
28
|
+
D2 --> E
|
|
29
|
+
E -->|Yes| F[Return CoA record]
|
|
30
|
+
E -->|No| G[Return null]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## External Dependencies
|
|
34
|
+
|
|
35
|
+
- None
|
|
36
|
+
|
|
37
|
+
## Error Scenarios
|
|
38
|
+
|
|
39
|
+
- **CHART_OF_ACCOUNTS_NOT_FOUND**: No CoA matches the given criteria — caller receives null
|
|
40
|
+
|
|
41
|
+
## Test Cases
|
|
42
|
+
|
|
43
|
+
- returns CoA when found by id
|
|
44
|
+
- returns null when CoA not found by id
|
|
45
|
+
- returns CoA when found by companyId
|
|
46
|
+
- returns null when CoA not found by companyId
|
|
47
|
+
- returns CoA when found by companyId with status filter
|
|
48
|
+
- returns null when no CoA matches companyId and status filter
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# ListAccountGroups
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
ListAccountGroups retrieves account groups within a Chart of Accounts, optionally filtered by parent group. This supports hierarchical tree traversal by enabling consumers to query root groups (parent = null) or children of a specific parent. Results are sorted by sort order within each sibling set.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- chartOfAccountsId is required — groups are always scoped to a CoA
|
|
10
|
+
- Optional filter:
|
|
11
|
+
- `parentAccountGroupId` — filter by parent group (null for root groups)
|
|
12
|
+
- Returns full group records (same shape as GetAccountGroup output)
|
|
13
|
+
- Results are sorted by sortOrder ascending within each sibling set
|
|
14
|
+
- Returns an empty list if no groups match
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive input with chartOfAccountsId] --> B{Parent filter provided?}
|
|
21
|
+
B -->|Yes| C[SELECT groups where parentAccountGroupId = input.parentAccountGroupId]
|
|
22
|
+
B -->|No| D[SELECT all groups in CoA]
|
|
23
|
+
C --> E[Sort by sortOrder ascending]
|
|
24
|
+
D --> E
|
|
25
|
+
E --> F[Return group list]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## External Dependencies
|
|
29
|
+
|
|
30
|
+
- None
|
|
31
|
+
|
|
32
|
+
## Error Scenarios
|
|
33
|
+
|
|
34
|
+
- **EMPTY_RESULT**: No groups match the given criteria — returns empty list
|
|
35
|
+
|
|
36
|
+
## Test Cases
|
|
37
|
+
|
|
38
|
+
- returns all groups in a CoA when no parent filter applied
|
|
39
|
+
- returns root groups when parent filter is null
|
|
40
|
+
- returns child groups of a specific parent
|
|
41
|
+
- returns groups sorted by sort order
|
|
42
|
+
- returns empty list when no groups match
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# ListAccounts
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
ListAccounts retrieves a list of GL accounts within a Chart of Accounts, with optional filters for type, classification, account group, tags, status, and currency restriction. Results are sorted by account code by default.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- chartOfAccountsId is required — accounts are always scoped to a CoA
|
|
10
|
+
- Optional filters:
|
|
11
|
+
- `accountType` — filter by ASSET, LIABILITY, EQUITY, REVENUE, or EXPENSE
|
|
12
|
+
- `accountClassification` — filter by REGULAR, RECEIVABLE, PAYABLE, BANK_CASH, FIXED_ASSET, RETAINED_EARNINGS, or NON_POSTING
|
|
13
|
+
- `accountGroupId` — filter by account group membership
|
|
14
|
+
- `tags` — filter by one or more tag labels (accounts matching any of the provided tags)
|
|
15
|
+
- `status` — filter by DRAFT, ACTIVE, or INACTIVE
|
|
16
|
+
- `currencyRestriction` — filter by currency code
|
|
17
|
+
- All filters can be combined; when multiple filters are provided, results must match all criteria (AND logic)
|
|
18
|
+
- Returns full account records (same shape as GetAccount output)
|
|
19
|
+
- Results are sorted by account code ascending by default
|
|
20
|
+
- Returns an empty list if no accounts match the filters
|
|
21
|
+
|
|
22
|
+
## Process Flow
|
|
23
|
+
|
|
24
|
+
```mermaid
|
|
25
|
+
flowchart TD
|
|
26
|
+
A[Receive input with chartOfAccountsId] --> B[Build query with CoA scope]
|
|
27
|
+
B --> C{Filters provided?}
|
|
28
|
+
C -->|Yes| D[Apply filters to query]
|
|
29
|
+
C -->|No| E[Return all accounts in CoA]
|
|
30
|
+
D --> E
|
|
31
|
+
E --> F[Sort by account code ascending]
|
|
32
|
+
F --> G[Return account list]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## External Dependencies
|
|
36
|
+
|
|
37
|
+
- None
|
|
38
|
+
|
|
39
|
+
## Error Scenarios
|
|
40
|
+
|
|
41
|
+
- **EMPTY_RESULT**: No accounts match the given criteria — returns empty list
|
|
42
|
+
|
|
43
|
+
## Test Cases
|
|
44
|
+
|
|
45
|
+
- returns all accounts in a CoA when no filters applied
|
|
46
|
+
- returns accounts filtered by account type
|
|
47
|
+
- returns accounts filtered by classification
|
|
48
|
+
- returns accounts filtered by account group
|
|
49
|
+
- returns accounts filtered by tags (matches accounts having any of the provided tags)
|
|
50
|
+
- returns accounts filtered by status
|
|
51
|
+
- returns accounts filtered by currency restriction
|
|
52
|
+
- returns accounts filtered by multiple criteria combined
|
|
53
|
+
- returns accounts sorted by code ascending
|
|
54
|
+
- returns empty list when no accounts match
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# ListUnassignedAccounts
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
ListUnassignedAccounts retrieves all active accounts within a Chart of Accounts that are not assigned to any account group. This enables downstream consumers (e.g., reporting module) to validate hierarchy completeness according to their own requirements.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- chartOfAccountsId is required — accounts are always scoped to a CoA
|
|
10
|
+
- Returns only accounts where accountGroupId is null
|
|
11
|
+
- Returns only ACTIVE accounts (DRAFT and INACTIVE accounts are excluded as they are not yet or no longer operationally relevant for hierarchy completeness checks)
|
|
12
|
+
- Returns full account records (same shape as GetAccount output)
|
|
13
|
+
- Results are sorted by account code ascending
|
|
14
|
+
- Returns an empty list if all active accounts are assigned to groups
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive input with chartOfAccountsId] --> B[SELECT accounts where chartOfAccountsId = input AND accountGroupId IS NULL AND status = ACTIVE]
|
|
21
|
+
B --> C[Sort by account code ascending]
|
|
22
|
+
C --> D[Return unassigned account list]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## External Dependencies
|
|
26
|
+
|
|
27
|
+
- None
|
|
28
|
+
|
|
29
|
+
## Error Scenarios
|
|
30
|
+
|
|
31
|
+
- **EMPTY_RESULT**: No unassigned active accounts found — returns empty list
|
|
32
|
+
|
|
33
|
+
## Test Cases
|
|
34
|
+
|
|
35
|
+
- returns unassigned active accounts in a CoA
|
|
36
|
+
- excludes accounts that are assigned to a group
|
|
37
|
+
- excludes DRAFT accounts
|
|
38
|
+
- excludes INACTIVE accounts
|
|
39
|
+
- returns accounts sorted by code ascending
|
|
40
|
+
- returns empty list when all active accounts are assigned
|
|
File without changes
|
|
File without changes
|