@churchsoln/dbms 1.0.63 → 1.0.65

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.
Files changed (26) hide show
  1. package/constants/index.js +47 -0
  2. package/migrations/church/20261017170648-create-vendor.js +46 -0
  3. package/migrations/church/20261017170649-create-bill.js +73 -0
  4. package/migrations/church/20261017170650-create-billLine.js +61 -0
  5. package/migrations/church/20261017170651-create-billAttachment.js +43 -0
  6. package/migrations/church/20261017170652-create-billPayment.js +72 -0
  7. package/migrations/church/20261023090000-create-customer.js +46 -0
  8. package/migrations/church/20261023090001-create-invoice.js +71 -0
  9. package/migrations/church/20261023090002-create-invoiceLine.js +57 -0
  10. package/migrations/church/20261023090003-create-invoicePayment.js +72 -0
  11. package/migrations/church/20261026170653-create-bankReconciliation.js +47 -0
  12. package/migrations/church/20261026170654-update-journalEntryLine-add-reconciliation.js +35 -0
  13. package/models/church/bankReconciliation.js +48 -0
  14. package/models/church/bill.js +83 -0
  15. package/models/church/billAttachment.js +34 -0
  16. package/models/church/billLine.js +47 -0
  17. package/models/church/billPayment.js +48 -0
  18. package/models/church/customer.js +45 -0
  19. package/models/church/invoice.js +75 -0
  20. package/models/church/invoiceLine.js +39 -0
  21. package/models/church/invoicePayment.js +48 -0
  22. package/models/church/journalEntryLine.js +10 -0
  23. package/models/church/vendor.js +45 -0
  24. package/package.json +1 -1
  25. package/seeders/church/20261017170653-chartOfAccounts-accountsPayable.js +44 -0
  26. package/seeders/church/20261023090004-chartOfAccounts-accountsReceivable.js +44 -0
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ const { ACCOUNTS_RECEIVABLE_CODE, CHART_OF_ACCOUNTS } = require("../../constants");
4
+
5
+ // The chartOfAccounts seeder is tracked in SequelizeData, so existing churches never re-run it.
6
+ // This seeder adds the Accounts Receivable account that invoices post to.
7
+ module.exports = {
8
+ up: async (queryInterface) => {
9
+ const account = CHART_OF_ACCOUNTS.find((a) => a.code === ACCOUNTS_RECEIVABLE_CODE);
10
+ const existingId = await queryInterface.rawSelect(
11
+ "ChartOfAccounts",
12
+ { where: { code: account.code } },
13
+ ["id"]
14
+ );
15
+ if (existingId) return;
16
+
17
+ const accountingAccountTypeId = await queryInterface.rawSelect(
18
+ "AccountingAccountTypes",
19
+ { where: { name: account.accountingAccountType } },
20
+ ["id"]
21
+ );
22
+ // Account types are seeded by 20260706170638-accountingAccountTypes; without them there is no chart to extend.
23
+ if (!accountingAccountTypeId) return;
24
+ const parentAccountId = await queryInterface.rawSelect(
25
+ "ChartOfAccounts",
26
+ { where: { code: account.parentCode } },
27
+ ["id"]
28
+ );
29
+ await queryInterface.bulkInsert("ChartOfAccounts", [
30
+ {
31
+ code: account.code,
32
+ name: account.name,
33
+ accountingAccountTypeId,
34
+ parentAccountId: parentAccountId || null,
35
+ isPostingAccount: account.isPostingAccount,
36
+ status: true,
37
+ },
38
+ ]);
39
+ },
40
+
41
+ down: async (queryInterface) => {
42
+ await queryInterface.bulkDelete("ChartOfAccounts", { code: ACCOUNTS_RECEIVABLE_CODE });
43
+ },
44
+ };