@things-factory/accounting 10.1.134 → 10.1.135
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/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +0 -12
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/index.d.ts +0 -1
- package/dist-server/index.js +0 -1
- package/dist-server/index.js.map +1 -1
- package/dist-server/service/account/account-history.d.ts +13 -6
- package/dist-server/service/account/account-history.js +44 -17
- package/dist-server/service/account/account-history.js.map +1 -1
- package/dist-server/service/account/account-mutation.js +2 -2
- package/dist-server/service/account/account-mutation.js.map +1 -1
- package/dist-server/service/account/account-type.d.ts +16 -0
- package/dist-server/service/account/account-type.js +71 -13
- package/dist-server/service/account/account-type.js.map +1 -1
- package/dist-server/service/account/account.d.ts +9 -3
- package/dist-server/service/account/account.js +34 -8
- package/dist-server/service/account/account.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category-mutation.js +2 -2
- package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -1
- package/dist-server/service/accounting-document/accounting-document-mutation.js +12 -3
- package/dist-server/service/accounting-document/accounting-document-mutation.js.map +1 -1
- package/dist-server/service/accounting-document/accounting-document-query.js +2 -0
- package/dist-server/service/accounting-document/accounting-document-query.js.map +1 -1
- package/dist-server/service/bank-account/bank-account-history.d.ts +11 -14
- package/dist-server/service/bank-account/bank-account-history.js +46 -59
- package/dist-server/service/bank-account/bank-account-history.js.map +1 -1
- package/dist-server/service/bank-account/bank-account-mutation.d.ts +1 -2
- package/dist-server/service/bank-account/bank-account-mutation.js +25 -69
- package/dist-server/service/bank-account/bank-account-mutation.js.map +1 -1
- package/dist-server/service/bank-account/bank-account-query.js +2 -0
- package/dist-server/service/bank-account/bank-account-query.js.map +1 -1
- package/dist-server/service/bank-account/bank-account-service.d.ts +5 -0
- package/dist-server/service/bank-account/bank-account-service.js +21 -0
- package/dist-server/service/bank-account/bank-account-service.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-type.d.ts +13 -19
- package/dist-server/service/bank-account/bank-account-type.js +45 -69
- package/dist-server/service/bank-account/bank-account-type.js.map +1 -1
- package/dist-server/service/bank-account/bank-account.d.ts +14 -17
- package/dist-server/service/bank-account/bank-account.js +45 -57
- package/dist-server/service/bank-account/bank-account.js.map +1 -1
- package/dist-server/service/bank-statement/bank-statement-query.d.ts +14 -0
- package/dist-server/service/bank-statement/bank-statement-query.js +92 -0
- package/dist-server/service/bank-statement/bank-statement-query.js.map +1 -0
- package/dist-server/service/bank-statement/bank-statement.d.ts +26 -0
- package/dist-server/service/bank-statement/bank-statement.js +109 -0
- package/dist-server/service/bank-statement/bank-statement.js.map +1 -0
- package/dist-server/service/bank-statement/index.d.ts +5 -0
- package/dist-server/service/bank-statement/index.js +9 -0
- package/dist-server/service/bank-statement/index.js.map +1 -0
- package/dist-server/service/cash-flow-type.d.ts +5 -0
- package/dist-server/service/cash-flow-type.js +15 -0
- package/dist-server/service/cash-flow-type.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.js +10 -1
- package/dist-server/service/financial-institution/financial-institution-mutation.js.map +1 -1
- package/dist-server/service/financial-institution/financial-institution-query.js +14 -6
- package/dist-server/service/financial-institution/financial-institution-query.js.map +1 -1
- package/dist-server/service/financial-institution/index.d.ts +1 -1
- package/dist-server/service/financial-statement/financial-statement-history.d.ts +11 -9
- package/dist-server/service/financial-statement/financial-statement-history.js +47 -36
- package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-line.d.ts +24 -0
- package/dist-server/service/financial-statement/financial-statement-line.js +108 -0
- package/dist-server/service/financial-statement/financial-statement-line.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-mutation.d.ts +1 -8
- package/dist-server/service/financial-statement/financial-statement-mutation.js +10 -135
- package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-query.d.ts +8 -7
- package/dist-server/service/financial-statement/financial-statement-query.js +40 -30
- package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-service.d.ts +33 -0
- package/dist-server/service/financial-statement/financial-statement-service.js +44 -0
- package/dist-server/service/financial-statement/financial-statement-service.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement.d.ts +19 -11
- package/dist-server/service/financial-statement/financial-statement.js +73 -65
- package/dist-server/service/financial-statement/financial-statement.js.map +1 -1
- package/dist-server/service/financial-statement/index.d.ts +3 -2
- package/dist-server/service/financial-statement/index.js +2 -2
- package/dist-server/service/financial-statement/index.js.map +1 -1
- package/dist-server/service/index.d.ts +15 -3
- package/dist-server/service/index.js +30 -13
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/payment/index.d.ts +1 -0
- package/dist-server/service/payment/index.js +1 -0
- package/dist-server/service/payment/index.js.map +1 -1
- package/dist-server/service/payment/payment-history.d.ts +9 -16
- package/dist-server/service/payment/payment-history.js +36 -70
- package/dist-server/service/payment/payment-history.js.map +1 -1
- package/dist-server/service/payment/payment-mutation.d.ts +0 -1
- package/dist-server/service/payment/payment-mutation.js +14 -79
- package/dist-server/service/payment/payment-mutation.js.map +1 -1
- package/dist-server/service/payment/payment-query.d.ts +3 -0
- package/dist-server/service/payment/payment-query.js +30 -1
- package/dist-server/service/payment/payment-query.js.map +1 -1
- package/dist-server/service/payment/payment-service.d.ts +16 -0
- package/dist-server/service/payment/payment-service.js +140 -0
- package/dist-server/service/payment/payment-service.js.map +1 -0
- package/dist-server/service/payment/payment-targets.d.ts +31 -0
- package/dist-server/service/payment/payment-targets.js +19 -0
- package/dist-server/service/payment/payment-targets.js.map +1 -0
- package/dist-server/service/payment/payment-type.d.ts +13 -17
- package/dist-server/service/payment/payment-type.js +35 -51
- package/dist-server/service/payment/payment-type.js.map +1 -1
- package/dist-server/service/payment/payment.d.ts +23 -22
- package/dist-server/service/payment/payment.js +66 -94
- package/dist-server/service/payment/payment.js.map +1 -1
- package/dist-server/service/payment/transfer-target.d.ts +1 -0
- package/dist-server/service/payment/transfer-target.js +43 -0
- package/dist-server/service/payment/transfer-target.js.map +1 -0
- package/dist-server/service/recurring-cash-item/index.d.ts +6 -0
- package/dist-server/service/recurring-cash-item/index.js +10 -0
- package/dist-server/service/recurring-cash-item/index.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.d.ts +7 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.js +63 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-mutation.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-query.d.ts +15 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-query.js +101 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-query.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-service.d.ts +23 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-service.js +91 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-service.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-type.d.ts +23 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-type.js +85 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item-type.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item.d.ts +35 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item.js +142 -0
- package/dist-server/service/recurring-cash-item/recurring-cash-item.js.map +1 -0
- package/dist-server/service/recurring-cash-item/recurring-schedule.d.ts +36 -0
- package/dist-server/service/recurring-cash-item/recurring-schedule.js +41 -0
- package/dist-server/service/recurring-cash-item/recurring-schedule.js.map +1 -0
- package/dist-server/service/transaction/transaction-history.d.ts +42 -15
- package/dist-server/service/transaction/transaction-history.js +160 -54
- package/dist-server/service/transaction/transaction-history.js.map +1 -1
- package/dist-server/service/transaction/transaction-mutation.d.ts +0 -1
- package/dist-server/service/transaction/transaction-mutation.js +13 -78
- package/dist-server/service/transaction/transaction-mutation.js.map +1 -1
- package/dist-server/service/transaction/transaction-period.d.ts +16 -0
- package/dist-server/service/transaction/transaction-period.js +49 -0
- package/dist-server/service/transaction/transaction-period.js.map +1 -0
- package/dist-server/service/transaction/transaction-query.d.ts +12 -0
- package/dist-server/service/transaction/transaction-query.js +84 -2
- package/dist-server/service/transaction/transaction-query.js.map +1 -1
- package/dist-server/service/transaction/transaction-service.d.ts +30 -0
- package/dist-server/service/transaction/transaction-service.js +130 -0
- package/dist-server/service/transaction/transaction-service.js.map +1 -0
- package/dist-server/service/transaction/transaction-type.d.ts +39 -7
- package/dist-server/service/transaction/transaction-type.js +145 -23
- package/dist-server/service/transaction/transaction-type.js.map +1 -1
- package/dist-server/service/transaction/transaction.d.ts +58 -31
- package/dist-server/service/transaction/transaction.js +216 -102
- package/dist-server/service/transaction/transaction.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -3
- package/things-factory.config.js +0 -4
- package/translations/en.json +34 -2
- package/translations/ja.json +0 -1
- package/translations/ko.json +34 -2
- package/translations/ms.json +0 -1
- package/translations/zh.json +0 -1
- package/dist-client/pages/account/account-importer.d.ts +0 -22
- package/dist-client/pages/account/account-importer.js +0 -99
- package/dist-client/pages/account/account-importer.js.map +0 -1
- package/dist-client/pages/account/account-list-page.d.ts +0 -57
- package/dist-client/pages/account/account-list-page.js +0 -306
- package/dist-client/pages/account/account-list-page.js.map +0 -1
- package/dist-client/pages/bank-account/bank-account-importer.d.ts +0 -23
- package/dist-client/pages/bank-account/bank-account-importer.js +0 -92
- package/dist-client/pages/bank-account/bank-account-importer.js.map +0 -1
- package/dist-client/pages/bank-account/bank-account-list-page.d.ts +0 -60
- package/dist-client/pages/bank-account/bank-account-list-page.js +0 -317
- package/dist-client/pages/bank-account/bank-account-list-page.js.map +0 -1
- package/dist-client/pages/financial-statement/financial-statement-importer.d.ts +0 -22
- package/dist-client/pages/financial-statement/financial-statement-importer.js +0 -99
- package/dist-client/pages/financial-statement/financial-statement-importer.js.map +0 -1
- package/dist-client/pages/financial-statement/financial-statement-list-page.d.ts +0 -57
- package/dist-client/pages/financial-statement/financial-statement-list-page.js +0 -280
- package/dist-client/pages/financial-statement/financial-statement-list-page.js.map +0 -1
- package/dist-client/pages/income-statement/income-statement-importer.d.ts +0 -22
- package/dist-client/pages/income-statement/income-statement-importer.js +0 -99
- package/dist-client/pages/income-statement/income-statement-importer.js.map +0 -1
- package/dist-client/pages/income-statement/income-statement-list-page.d.ts +0 -57
- package/dist-client/pages/income-statement/income-statement-list-page.js +0 -280
- package/dist-client/pages/income-statement/income-statement-list-page.js.map +0 -1
- package/dist-client/pages/payment/payment-importer.d.ts +0 -23
- package/dist-client/pages/payment/payment-importer.js +0 -92
- package/dist-client/pages/payment/payment-importer.js.map +0 -1
- package/dist-client/pages/payment/payment-list-page.d.ts +0 -60
- package/dist-client/pages/payment/payment-list-page.js +0 -317
- package/dist-client/pages/payment/payment-list-page.js.map +0 -1
- package/dist-client/pages/transaction/transaction-importer.d.ts +0 -22
- package/dist-client/pages/transaction/transaction-importer.js +0 -99
- package/dist-client/pages/transaction/transaction-importer.js.map +0 -1
- package/dist-client/pages/transaction/transaction-list-page.d.ts +0 -57
- package/dist-client/pages/transaction/transaction-list-page.js +0 -280
- package/dist-client/pages/transaction/transaction-list-page.js.map +0 -1
- package/dist-server/controllers/index.d.ts +0 -1
- package/dist-server/controllers/index.js +0 -5
- package/dist-server/controllers/index.js.map +0 -1
- package/dist-server/controllers/summary-statements.d.ts +0 -4
- package/dist-server/controllers/summary-statements.js +0 -149
- package/dist-server/controllers/summary-statements.js.map +0 -1
- package/dist-server/migrations/1725201567284-seed-country-codes.d.ts +0 -5
- package/dist-server/migrations/1725201567284-seed-country-codes.js +0 -255
- package/dist-server/migrations/1725201567284-seed-country-codes.js.map +0 -1
- package/dist-server/service/financial-statement/financial-statement-line-item.d.ts +0 -19
- package/dist-server/service/financial-statement/financial-statement-line-item.js +0 -95
- package/dist-server/service/financial-statement/financial-statement-line-item.js.map +0 -1
- package/dist-server/service/financial-statement/financial-statement-type.d.ts +0 -20
- package/dist-server/service/financial-statement/financial-statement-type.js +0 -77
- package/dist-server/service/financial-statement/financial-statement-type.js.map +0 -1
- package/dist-server/service/income-statement/event-subscriber.d.ts +0 -7
- package/dist-server/service/income-statement/event-subscriber.js +0 -21
- package/dist-server/service/income-statement/event-subscriber.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-history.d.ts +0 -28
- package/dist-server/service/income-statement/income-statement-history.js +0 -146
- package/dist-server/service/income-statement/income-statement-history.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-line-item.d.ts +0 -19
- package/dist-server/service/income-statement/income-statement-line-item.js +0 -97
- package/dist-server/service/income-statement/income-statement-line-item.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-mutation.d.ts +0 -10
- package/dist-server/service/income-statement/income-statement-mutation.js +0 -159
- package/dist-server/service/income-statement/income-statement-mutation.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-query.d.ts +0 -11
- package/dist-server/service/income-statement/income-statement-query.js +0 -81
- package/dist-server/service/income-statement/income-statement-query.js.map +0 -1
- package/dist-server/service/income-statement/income-statement-type.d.ts +0 -20
- package/dist-server/service/income-statement/income-statement-type.js +0 -77
- package/dist-server/service/income-statement/income-statement-type.js.map +0 -1
- package/dist-server/service/income-statement/income-statement.d.ts +0 -28
- package/dist-server/service/income-statement/income-statement.js +0 -137
- package/dist-server/service/income-statement/income-statement.js.map +0 -1
- package/dist-server/service/income-statement/index.d.ts +0 -8
- package/dist-server/service/income-statement/index.js +0 -13
- package/dist-server/service/income-statement/index.js.map +0 -1
|
@@ -70,12 +70,12 @@ let AccountingCategoryMutation = class AccountingCategoryMutation {
|
|
|
70
70
|
}
|
|
71
71
|
async deleteAccountingCategory(id, context) {
|
|
72
72
|
const { domain, tx } = context.state;
|
|
73
|
-
await (0, shell_1.getRepository)(accounting_category_1.AccountingCategory, tx).
|
|
73
|
+
await (0, shell_1.getRepository)(accounting_category_1.AccountingCategory, tx).softDelete({ domain: { id: domain.id }, id });
|
|
74
74
|
return true;
|
|
75
75
|
}
|
|
76
76
|
async deleteAccountingCategories(ids, context) {
|
|
77
77
|
const { domain, tx } = context.state;
|
|
78
|
-
await (0, shell_1.getRepository)(accounting_category_1.AccountingCategory, tx).
|
|
78
|
+
await (0, shell_1.getRepository)(accounting_category_1.AccountingCategory, tx).softDelete({
|
|
79
79
|
domain: { id: domain.id },
|
|
80
80
|
id: (0, typeorm_1.In)(ids)
|
|
81
81
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounting-category-mutation.js","sourceRoot":"","sources":["../../../server/service/accounting-category/accounting-category-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,iDAAqD;AAErD,+DAA0D;AAC1D,yEAA2F;AAGpF,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAI/B,AAAN,KAAK,CAAC,wBAAwB,CACD,kBAAyC,EAC7D,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,wCAAkB,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;YAC9D,GAAG,kBAAkB;YACrB,MAAM;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,wBAAwB,CACjB,EAAU,EACP,KAA8B,EACrC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,wCAAkB,EAAE,EAAE,CAAC,CAAA;QACxD,MAAM,kBAAkB,GAAG,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AA,IAAA,kBAAG,GAAE,CAAA;;;;4EAUP;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,qFAAqF,CAAC;IAChG,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;IAEtF,mBAAA,IAAA,kBAAG,EAAC,sBAAsB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kDAAuB,CAAC,CAAC,CAAA;IAC9D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;4EAaP;qCA/IU,0BAA0B;IADtC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,0BAA0B,CAgJtC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { AccountingCategory } from './accounting-category'\nimport { NewAccountingCategory, AccountingCategoryPatch } from './accounting-category-type'\n\n@Resolver(AccountingCategory)\nexport class AccountingCategoryMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => AccountingCategory, { description: 'To create new AccountingCategory' })\n async createAccountingCategory(\n @Arg('accountingCategory') accountingCategory: NewAccountingCategory,\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategory> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(AccountingCategory, tx).save({\n ...accountingCategory,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => AccountingCategory, { description: 'To modify AccountingCategory information' })\n async updateAccountingCategory(\n @Arg('id') id: string,\n @Arg('patch') patch: AccountingCategoryPatch,\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategory> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(AccountingCategory, tx)\n const accountingCategory = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...accountingCategory,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [AccountingCategory], { description: \"To modify multiple AccountingCategories' information\" })\n async updateMultipleAccountingCategory(\n @Arg('patches', type => [AccountingCategoryPatch]) patches: AccountingCategoryPatch[],\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategory[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const accountingCategoryRepo = getRepository(AccountingCategory, tx)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await accountingCategoryRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const accountingCategory = await accountingCategoryRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!accountingCategory) {\n throw new Error(`failed to find accountingCategory to update: ${updateRecord.id}`)\n }\n\n const result = await accountingCategoryRepo.save({\n ...accountingCategory,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete AccountingCategory' })\n async deleteAccountingCategory(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(AccountingCategory, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple AccountingCategories' })\n async deleteAccountingCategories(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(AccountingCategory, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple AccountingCategories' })\n async importAccountingCategories(\n @Arg('accountingCategories', type => [AccountingCategoryPatch]) accountingCategories: AccountingCategoryPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n accountingCategories.map(async (accountingCategory: AccountingCategoryPatch) => {\n const createdAccountingCategory: AccountingCategory = await tx\n .getRepository(AccountingCategory)\n .save({ domain, ...accountingCategory })\n })\n )\n\n return true\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"accounting-category-mutation.js","sourceRoot":"","sources":["../../../server/service/accounting-category/accounting-category-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,iDAAqD;AAErD,+DAA0D;AAC1D,yEAA2F;AAGpF,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAI/B,AAAN,KAAK,CAAC,wBAAwB,CACD,kBAAyC,EAC7D,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,wCAAkB,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;YAC9D,GAAG,kBAAkB;YACrB,MAAM;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,C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M3D;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,qFAAqF,CAAC;IAChG,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;IAEtF,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;4EAUP;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,qFAAqF,CAAC;IAChG,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;IAEtF,mBAAA,IAAA,kBAAG,EAAC,sBAAsB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kDAAuB,CAAC,CAAC,CAAA;IAC9D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;4EAaP;qCA/IU,0BAA0B;IADtC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,0BAA0B,CAgJtC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { AccountingCategory } from './accounting-category'\nimport { NewAccountingCategory, AccountingCategoryPatch } from './accounting-category-type'\n\n@Resolver(AccountingCategory)\nexport class AccountingCategoryMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => AccountingCategory, { description: 'To create new AccountingCategory' })\n async createAccountingCategory(\n @Arg('accountingCategory') accountingCategory: NewAccountingCategory,\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategory> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(AccountingCategory, tx).save({\n ...accountingCategory,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => AccountingCategory, { description: 'To modify AccountingCategory information' })\n async updateAccountingCategory(\n @Arg('id') id: string,\n @Arg('patch') patch: AccountingCategoryPatch,\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategory> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(AccountingCategory, tx)\n const accountingCategory = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...accountingCategory,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [AccountingCategory], { description: \"To modify multiple AccountingCategories' information\" })\n async updateMultipleAccountingCategory(\n @Arg('patches', type => [AccountingCategoryPatch]) patches: AccountingCategoryPatch[],\n @Ctx() context: ResolverContext\n ): Promise<AccountingCategory[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const accountingCategoryRepo = getRepository(AccountingCategory, tx)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await accountingCategoryRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const accountingCategory = await accountingCategoryRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!accountingCategory) {\n throw new Error(`failed to find accountingCategory to update: ${updateRecord.id}`)\n }\n\n const result = await accountingCategoryRepo.save({\n ...accountingCategory,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete AccountingCategory' })\n async deleteAccountingCategory(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(AccountingCategory, tx).softDelete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple AccountingCategories' })\n async deleteAccountingCategories(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(AccountingCategory, tx).softDelete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple AccountingCategories' })\n async importAccountingCategories(\n @Arg('accountingCategories', type => [AccountingCategoryPatch]) accountingCategories: AccountingCategoryPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n accountingCategories.map(async (accountingCategory: AccountingCategoryPatch) => {\n const createdAccountingCategory: AccountingCategory = await tx\n .getRepository(AccountingCategory)\n .save({ domain, ...accountingCategory })\n })\n )\n\n return true\n }\n}\n"]}
|
|
@@ -70,12 +70,12 @@ let AccountingDocumentMutation = class AccountingDocumentMutation {
|
|
|
70
70
|
}
|
|
71
71
|
async deleteAccountingDocument(id, context) {
|
|
72
72
|
const { domain, tx } = context.state;
|
|
73
|
-
await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx).
|
|
73
|
+
await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx).softDelete({ domain: { id: domain.id }, id });
|
|
74
74
|
return true;
|
|
75
75
|
}
|
|
76
76
|
async deleteAccountingDocuments(ids, context) {
|
|
77
77
|
const { domain, tx } = context.state;
|
|
78
|
-
await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx).
|
|
78
|
+
await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx).softDelete({
|
|
79
79
|
domain: { id: domain.id },
|
|
80
80
|
id: (0, typeorm_1.In)(ids)
|
|
81
81
|
});
|
|
@@ -84,7 +84,10 @@ let AccountingDocumentMutation = class AccountingDocumentMutation {
|
|
|
84
84
|
async importAccountingDocuments(accountingDocuments, context) {
|
|
85
85
|
const { domain, tx } = context.state;
|
|
86
86
|
await Promise.all(accountingDocuments.map(async (accountingDocument) => {
|
|
87
|
-
const createdAccountingDocument = await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx).save({
|
|
87
|
+
const createdAccountingDocument = await (0, shell_1.getRepository)(accounting_document_1.AccountingDocument, tx).save({
|
|
88
|
+
domain,
|
|
89
|
+
...accountingDocument
|
|
90
|
+
});
|
|
88
91
|
}));
|
|
89
92
|
return true;
|
|
90
93
|
}
|
|
@@ -92,6 +95,7 @@ let AccountingDocumentMutation = class AccountingDocumentMutation {
|
|
|
92
95
|
exports.AccountingDocumentMutation = AccountingDocumentMutation;
|
|
93
96
|
tslib_1.__decorate([
|
|
94
97
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
98
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
|
|
95
99
|
(0, type_graphql_1.Mutation)(returns => accounting_document_1.AccountingDocument, { description: 'To create new AccountingDocument' }),
|
|
96
100
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('accountingDocument')),
|
|
97
101
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -101,6 +105,7 @@ tslib_1.__decorate([
|
|
|
101
105
|
], AccountingDocumentMutation.prototype, "createAccountingDocument", null);
|
|
102
106
|
tslib_1.__decorate([
|
|
103
107
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
108
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
|
|
104
109
|
(0, type_graphql_1.Mutation)(returns => accounting_document_1.AccountingDocument, { description: 'To modify AccountingDocument information' }),
|
|
105
110
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
106
111
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
@@ -111,6 +116,7 @@ tslib_1.__decorate([
|
|
|
111
116
|
], AccountingDocumentMutation.prototype, "updateAccountingDocument", null);
|
|
112
117
|
tslib_1.__decorate([
|
|
113
118
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
119
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
|
|
114
120
|
(0, type_graphql_1.Mutation)(returns => [accounting_document_1.AccountingDocument], { description: "To modify multiple AccountingDocuments' information" }),
|
|
115
121
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [accounting_document_type_1.AccountingDocumentPatch])),
|
|
116
122
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -120,6 +126,7 @@ tslib_1.__decorate([
|
|
|
120
126
|
], AccountingDocumentMutation.prototype, "updateMultipleAccountingDocument", null);
|
|
121
127
|
tslib_1.__decorate([
|
|
122
128
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
129
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
|
|
123
130
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete AccountingDocument' }),
|
|
124
131
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
125
132
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -129,6 +136,7 @@ tslib_1.__decorate([
|
|
|
129
136
|
], AccountingDocumentMutation.prototype, "deleteAccountingDocument", null);
|
|
130
137
|
tslib_1.__decorate([
|
|
131
138
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
139
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
|
|
132
140
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple AccountingDocuments' }),
|
|
133
141
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
134
142
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -138,6 +146,7 @@ tslib_1.__decorate([
|
|
|
138
146
|
], AccountingDocumentMutation.prototype, "deleteAccountingDocuments", null);
|
|
139
147
|
tslib_1.__decorate([
|
|
140
148
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
149
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "mutation", domainOwnerGranted: true)'),
|
|
141
150
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple AccountingDocuments' }),
|
|
142
151
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('accountingDocuments', type => [accounting_document_type_1.AccountingDocumentPatch])),
|
|
143
152
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounting-document-mutation.js","sourceRoot":"","sources":["../../../server/service/accounting-document/accounting-document-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,+DAA0D;AAC1D,yEAA2F;AAGpF,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAG/B,AAAN,KAAK,CAAC,wBAAwB,CAA4B,kBAAyC,EAAS,OAAwB;QAClI,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,wCAAkB,EAAE,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AAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAErF,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAWP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAErF,mBAAA,IAAA,kBAAG,EAAC,qBAAqB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kDAAuB,CAAC,CAAC,CAAA;IAC7D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAWP;qCArIU,0BAA0B;IADtC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,0BAA0B,CAsItC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { AccountingDocument } from './accounting-document'\nimport { NewAccountingDocument, AccountingDocumentPatch } from './accounting-document-type'\n\n@Resolver(AccountingDocument)\nexport class AccountingDocumentMutation {\n @Directive('@transaction')\n @Mutation(returns => AccountingDocument, { description: 'To create new AccountingDocument' })\n async createAccountingDocument(@Arg('accountingDocument') accountingDocument: NewAccountingDocument, @Ctx() context: ResolverContext): Promise<AccountingDocument> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(AccountingDocument, tx).save({\n ...accountingDocument,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => AccountingDocument, { description: 'To modify AccountingDocument information' })\n async updateAccountingDocument(\n @Arg('id') id: string,\n @Arg('patch') patch: AccountingDocumentPatch,\n @Ctx() context: ResolverContext\n ): Promise<AccountingDocument> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(AccountingDocument, tx)\n const accountingDocument = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...accountingDocument,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [AccountingDocument], { description: \"To modify multiple AccountingDocuments' information\" })\n async updateMultipleAccountingDocument(\n @Arg('patches', type => [AccountingDocumentPatch]) patches: AccountingDocumentPatch[],\n @Ctx() context: ResolverContext\n ): Promise<AccountingDocument[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const accountingDocumentRepo = getRepository(AccountingDocument, tx)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await accountingDocumentRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const accountingDocument = await accountingDocumentRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!accountingDocument) {\n throw new Error(`failed to find accountingDocument to update: ${updateRecord.id}`)\n }\n\n const result = await accountingDocumentRepo.save({\n ...accountingDocument,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete AccountingDocument' })\n async deleteAccountingDocument(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(AccountingDocument, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple AccountingDocuments' })\n async deleteAccountingDocuments(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(AccountingDocument, tx).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple AccountingDocuments' })\n async importAccountingDocuments(\n @Arg('accountingDocuments', type => [AccountingDocumentPatch]) accountingDocuments: AccountingDocumentPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n accountingDocuments.map(async (accountingDocument: AccountingDocumentPatch) => {\n const createdAccountingDocument: AccountingDocument = await getRepository(AccountingDocument, tx).save({ domain, ...accountingDocument })\n })\n )\n\n return true\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"accounting-document-mutation.js","sourceRoot":"","sources":["../../../server/service/accounting-document/accounting-document-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,iDAAqD;AAErD,+DAA0D;AAC1D,yEAA2F;AAGpF,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAI/B,AAAN,KAAK,CAAC,wBAAwB,CACD,kBAAyC,EAC7D,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAa,EAAC,wCAAkB,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;YAC9D,GAAG,kBAAkB;YACrB,MAAM;YACN,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC;IAKK,AAAN,KAAK,CAAC,wBAAwB,CACjB,EAAU,EACP,KAA8B,EACrC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI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O,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAErF,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAUP;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,qFAAqF,CAAC;IAChG,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAErF,mBAAA,IAAA,kBAAG,EAAC,qBAAqB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,kDAAuB,CAAC,CAAC,CAAA;IAC7D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAcP;qCAhJU,0BAA0B;IADtC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,0BAA0B,CAiJtC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { AccountingDocument } from './accounting-document'\nimport { NewAccountingDocument, AccountingDocumentPatch } from './accounting-document-type'\n\n@Resolver(AccountingDocument)\nexport class AccountingDocumentMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => AccountingDocument, { description: 'To create new AccountingDocument' })\n async createAccountingDocument(\n @Arg('accountingDocument') accountingDocument: NewAccountingDocument,\n @Ctx() context: ResolverContext\n ): Promise<AccountingDocument> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(AccountingDocument, tx).save({\n ...accountingDocument,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => AccountingDocument, { description: 'To modify AccountingDocument information' })\n async updateAccountingDocument(\n @Arg('id') id: string,\n @Arg('patch') patch: AccountingDocumentPatch,\n @Ctx() context: ResolverContext\n ): Promise<AccountingDocument> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(AccountingDocument, tx)\n const accountingDocument = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...accountingDocument,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [AccountingDocument], { description: \"To modify multiple AccountingDocuments' information\" })\n async updateMultipleAccountingDocument(\n @Arg('patches', type => [AccountingDocumentPatch]) patches: AccountingDocumentPatch[],\n @Ctx() context: ResolverContext\n ): Promise<AccountingDocument[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const accountingDocumentRepo = getRepository(AccountingDocument, tx)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await accountingDocumentRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const accountingDocument = await accountingDocumentRepo.findOne({\n where: { domain: { id: domain.id }, id: updateRecord.id }\n })\n\n if (!accountingDocument) {\n throw new Error(`failed to find accountingDocument to update: ${updateRecord.id}`)\n }\n\n const result = await accountingDocumentRepo.save({\n ...accountingDocument,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete AccountingDocument' })\n async deleteAccountingDocument(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(AccountingDocument, tx).softDelete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple AccountingDocuments' })\n async deleteAccountingDocuments(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(AccountingDocument, tx).softDelete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"accounting\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple AccountingDocuments' })\n async importAccountingDocuments(\n @Arg('accountingDocuments', type => [AccountingDocumentPatch]) accountingDocuments: AccountingDocumentPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n accountingDocuments.map(async (accountingDocument: AccountingDocumentPatch) => {\n const createdAccountingDocument: AccountingDocument = await getRepository(AccountingDocument, tx).save({\n domain,\n ...accountingDocument\n })\n })\n )\n\n return true\n }\n}\n"]}
|
|
@@ -37,6 +37,7 @@ let AccountingDocumentQuery = class AccountingDocumentQuery {
|
|
|
37
37
|
};
|
|
38
38
|
exports.AccountingDocumentQuery = AccountingDocumentQuery;
|
|
39
39
|
tslib_1.__decorate([
|
|
40
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query", domainOwnerGranted: true)'),
|
|
40
41
|
(0, type_graphql_1.Query)(returns => accounting_document_1.AccountingDocument, { nullable: true, description: 'To fetch a AccountingDocument' }),
|
|
41
42
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
42
43
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -45,6 +46,7 @@ tslib_1.__decorate([
|
|
|
45
46
|
tslib_1.__metadata("design:returntype", Promise)
|
|
46
47
|
], AccountingDocumentQuery.prototype, "accountingDocument", null);
|
|
47
48
|
tslib_1.__decorate([
|
|
49
|
+
(0, type_graphql_1.Directive)('@privilege(category: "accounting", privilege: "query", domainOwnerGranted: true)'),
|
|
48
50
|
(0, type_graphql_1.Query)(returns => accounting_document_type_1.AccountingDocumentList, { description: 'To fetch multiple AccountingDocuments' }),
|
|
49
51
|
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
50
52
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounting-document-query.js","sourceRoot":"","sources":["../../../server/service/accounting-document/accounting-document-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,+DAA0D;AAC1D,yEAAmE;AAG5D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;
|
|
1
|
+
{"version":3,"file":"accounting-document-query.js","sourceRoot":"","sources":["../../../server/service/accounting-document/accounting-document-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,+DAA0D;AAC1D,yEAAmE;AAG5D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAG5B,AAAN,KAAK,CAAC,kBAAkB,CAAY,EAAU,EAAS,OAAwB;QAC7E,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAAM,IAAA,qBAAa,EAAC,wCAAkB,CAAC,CAAC,OAAO,CAAC;YACrD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACzC,CAAC,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,mB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EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAC9E,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iEAMrD;AAIK;IAFL,IAAA,wBAAS,EAAC,kFAAkF,CAAC;IAC7F,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,iDAAsB,EAAE,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;IAEhG,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,CAAC,CAAA;IACvB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAD2B,iBAAS;;kEAe3C;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;qDAE1D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAE3D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAE3D;kCA5CU,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,uBAAuB,CA6CnC","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { AccountingDocument } from './accounting-document'\nimport { AccountingDocumentList } from './accounting-document-type'\n\n@Resolver(AccountingDocument)\nexport class AccountingDocumentQuery {\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => AccountingDocument!, { nullable: true, description: 'To fetch a AccountingDocument' })\n async accountingDocument(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<AccountingDocument> {\n const { domain } = context.state\n\n return await getRepository(AccountingDocument).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Directive('@privilege(category: \"accounting\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => AccountingDocumentList, { description: 'To fetch multiple AccountingDocuments' })\n async accountingDocuments(\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<AccountingDocumentList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(AccountingDocument),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() accountingDocument: AccountingDocument): Promise<Domain> {\n return accountingDocument.domainId && (await getRepository(Domain).findOneBy({ id: accountingDocument.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() accountingDocument: AccountingDocument): Promise<User> {\n return accountingDocument.updaterId && (await getRepository(User).findOneBy({ id: accountingDocument.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() accountingDocument: AccountingDocument): Promise<User> {\n return accountingDocument.creatorId && (await getRepository(User).findOneBy({ id: accountingDocument.creatorId }))\n }\n}\n"]}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import { HistoryActionType, HistoryEntityInterface } from '@operato/typeorm-history';
|
|
2
2
|
import { User } from '@things-factory/auth-base';
|
|
3
3
|
import { Domain } from '@things-factory/shell';
|
|
4
|
-
import { AccountType, BankAccount,
|
|
4
|
+
import { AccountType, BankAccount, BankAccountPurpose } from './bank-account';
|
|
5
|
+
/** Each version of a bank account, written when it changes. */
|
|
5
6
|
export declare class BankAccountHistory implements HistoryEntityInterface<BankAccount> {
|
|
6
7
|
readonly id: string;
|
|
7
8
|
version?: number;
|
|
8
9
|
domain?: Domain;
|
|
9
10
|
domainId?: string;
|
|
10
11
|
name: string;
|
|
11
|
-
description
|
|
12
|
-
|
|
13
|
-
accountNumber
|
|
14
|
-
bankName?: string;
|
|
12
|
+
description: string;
|
|
13
|
+
bankName: string;
|
|
14
|
+
accountNumber: string;
|
|
15
15
|
accountType: AccountType;
|
|
16
|
-
currency
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
country?: string;
|
|
23
|
-
image?: string;
|
|
16
|
+
currency: string;
|
|
17
|
+
timezone: string;
|
|
18
|
+
purpose: BankAccountPurpose;
|
|
19
|
+
statedBalance: number;
|
|
20
|
+
statedBalanceDate: string;
|
|
21
|
+
active: boolean;
|
|
24
22
|
createdAt?: Date;
|
|
25
23
|
updatedAt?: Date;
|
|
26
24
|
deletedAt?: Date;
|
|
@@ -28,7 +26,6 @@ export declare class BankAccountHistory implements HistoryEntityInterface<BankAc
|
|
|
28
26
|
creatorId?: string;
|
|
29
27
|
updater?: User;
|
|
30
28
|
updaterId?: string;
|
|
31
|
-
thumbnail?: string;
|
|
32
29
|
originalId: string;
|
|
33
30
|
action: HistoryActionType;
|
|
34
31
|
}
|
|
@@ -11,6 +11,7 @@ const shell_1 = require("@things-factory/shell");
|
|
|
11
11
|
const bank_account_1 = require("./bank-account");
|
|
12
12
|
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
|
13
13
|
const DATABASE_TYPE = ORMCONFIG.type;
|
|
14
|
+
/** Each version of a bank account, written when it changes. */
|
|
14
15
|
let BankAccountHistory = class BankAccountHistory {
|
|
15
16
|
constructor() {
|
|
16
17
|
this.version = 1;
|
|
@@ -19,130 +20,111 @@ let BankAccountHistory = class BankAccountHistory {
|
|
|
19
20
|
exports.BankAccountHistory = BankAccountHistory;
|
|
20
21
|
tslib_1.__decorate([
|
|
21
22
|
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
22
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
23
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier of the version' }),
|
|
23
24
|
tslib_1.__metadata("design:type", String)
|
|
24
25
|
], BankAccountHistory.prototype, "id", void 0);
|
|
25
26
|
tslib_1.__decorate([
|
|
26
27
|
(0, typeorm_1.Column)({ nullable: true, default: 1 }),
|
|
27
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
28
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Version number' }),
|
|
28
29
|
tslib_1.__metadata("design:type", Number)
|
|
29
30
|
], BankAccountHistory.prototype, "version", void 0);
|
|
30
31
|
tslib_1.__decorate([
|
|
31
32
|
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
32
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
33
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain' }),
|
|
33
34
|
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
34
35
|
], BankAccountHistory.prototype, "domain", void 0);
|
|
35
36
|
tslib_1.__decorate([
|
|
36
|
-
(0, typeorm_1.RelationId)((
|
|
37
|
+
(0, typeorm_1.RelationId)((bankAccountHistory) => bankAccountHistory.domain),
|
|
37
38
|
tslib_1.__metadata("design:type", String)
|
|
38
39
|
], BankAccountHistory.prototype, "domainId", void 0);
|
|
39
40
|
tslib_1.__decorate([
|
|
40
|
-
(0, typeorm_1.Column)(),
|
|
41
|
-
(0, type_graphql_1.Field)(),
|
|
41
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
42
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'name at this version' }),
|
|
42
43
|
tslib_1.__metadata("design:type", String)
|
|
43
44
|
], BankAccountHistory.prototype, "name", void 0);
|
|
44
45
|
tslib_1.__decorate([
|
|
45
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
46
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
46
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
47
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'description at this version' }),
|
|
47
48
|
tslib_1.__metadata("design:type", String)
|
|
48
49
|
], BankAccountHistory.prototype, "description", void 0);
|
|
49
50
|
tslib_1.__decorate([
|
|
50
51
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
51
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
52
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'bankName at this version' }),
|
|
52
53
|
tslib_1.__metadata("design:type", String)
|
|
53
|
-
], BankAccountHistory.prototype, "
|
|
54
|
+
], BankAccountHistory.prototype, "bankName", void 0);
|
|
54
55
|
tslib_1.__decorate([
|
|
55
|
-
(0, typeorm_1.Column)(),
|
|
56
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
56
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
57
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'accountNumber at this version' }),
|
|
57
58
|
tslib_1.__metadata("design:type", String)
|
|
58
59
|
], BankAccountHistory.prototype, "accountNumber", void 0);
|
|
59
60
|
tslib_1.__decorate([
|
|
60
|
-
(0, typeorm_1.Column)(),
|
|
61
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
62
|
-
tslib_1.__metadata("design:type", String)
|
|
63
|
-
], BankAccountHistory.prototype, "bankName", void 0);
|
|
64
|
-
tslib_1.__decorate([
|
|
65
|
-
(0, typeorm_1.Column)({ nullable: false }),
|
|
66
|
-
(0, type_graphql_1.Field)(type => bank_account_1.AccountType, { description: 'Type of the account (Bank or Card)' }),
|
|
61
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
62
|
+
(0, type_graphql_1.Field)(type => bank_account_1.AccountType, { nullable: true, description: 'accountType at this version' }),
|
|
67
63
|
tslib_1.__metadata("design:type", String)
|
|
68
64
|
], BankAccountHistory.prototype, "accountType", void 0);
|
|
69
65
|
tslib_1.__decorate([
|
|
70
66
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
71
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
67
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'currency at this version' }),
|
|
72
68
|
tslib_1.__metadata("design:type", String)
|
|
73
69
|
], BankAccountHistory.prototype, "currency", void 0);
|
|
74
|
-
tslib_1.__decorate([
|
|
75
|
-
(0, typeorm_1.Column)({ nullable: false, default: false }),
|
|
76
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
77
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
78
|
-
], BankAccountHistory.prototype, "active", void 0);
|
|
79
|
-
tslib_1.__decorate([
|
|
80
|
-
(0, typeorm_1.Column)({ nullable: false }),
|
|
81
|
-
(0, type_graphql_1.Field)(type => bank_account_1.OwnerType, { description: 'Type of the owner of the bank account' }),
|
|
82
|
-
tslib_1.__metadata("design:type", String)
|
|
83
|
-
], BankAccountHistory.prototype, "ownerType", void 0);
|
|
84
|
-
tslib_1.__decorate([
|
|
85
|
-
(0, typeorm_1.Column)(),
|
|
86
|
-
(0, type_graphql_1.Field)({ description: 'ID of the owner of the bank account' }),
|
|
87
|
-
tslib_1.__metadata("design:type", String)
|
|
88
|
-
], BankAccountHistory.prototype, "ownerId", void 0);
|
|
89
70
|
tslib_1.__decorate([
|
|
90
71
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
91
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
72
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'timezone at this version' }),
|
|
92
73
|
tslib_1.__metadata("design:type", String)
|
|
93
|
-
], BankAccountHistory.prototype, "
|
|
74
|
+
], BankAccountHistory.prototype, "timezone", void 0);
|
|
94
75
|
tslib_1.__decorate([
|
|
95
76
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
96
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
77
|
+
(0, type_graphql_1.Field)(type => bank_account_1.BankAccountPurpose, { nullable: true, description: 'purpose at this version' }),
|
|
97
78
|
tslib_1.__metadata("design:type", String)
|
|
98
|
-
], BankAccountHistory.prototype, "
|
|
79
|
+
], BankAccountHistory.prototype, "purpose", void 0);
|
|
80
|
+
tslib_1.__decorate([
|
|
81
|
+
(0, typeorm_1.Column)((0, shell_1.moneyColumn)({ nullable: true })),
|
|
82
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'statedBalance at this version' }),
|
|
83
|
+
tslib_1.__metadata("design:type", Number)
|
|
84
|
+
], BankAccountHistory.prototype, "statedBalance", void 0);
|
|
99
85
|
tslib_1.__decorate([
|
|
100
86
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
101
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
87
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'statedBalanceDate at this version' }),
|
|
102
88
|
tslib_1.__metadata("design:type", String)
|
|
103
|
-
], BankAccountHistory.prototype, "
|
|
89
|
+
], BankAccountHistory.prototype, "statedBalanceDate", void 0);
|
|
104
90
|
tslib_1.__decorate([
|
|
105
91
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
106
|
-
(0, type_graphql_1.Field)({ nullable: true, description: '
|
|
107
|
-
tslib_1.__metadata("design:type",
|
|
108
|
-
], BankAccountHistory.prototype, "
|
|
92
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'active at this version' }),
|
|
93
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
94
|
+
], BankAccountHistory.prototype, "active", void 0);
|
|
109
95
|
tslib_1.__decorate([
|
|
110
96
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
111
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
97
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was created' }),
|
|
112
98
|
tslib_1.__metadata("design:type", Date)
|
|
113
99
|
], BankAccountHistory.prototype, "createdAt", void 0);
|
|
114
100
|
tslib_1.__decorate([
|
|
115
101
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
116
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
102
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When this version was written' }),
|
|
117
103
|
tslib_1.__metadata("design:type", Date)
|
|
118
104
|
], BankAccountHistory.prototype, "updatedAt", void 0);
|
|
119
105
|
tslib_1.__decorate([
|
|
120
106
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
121
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
107
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was deleted' }),
|
|
122
108
|
tslib_1.__metadata("design:type", Date)
|
|
123
109
|
], BankAccountHistory.prototype, "deletedAt", void 0);
|
|
124
110
|
tslib_1.__decorate([
|
|
125
111
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
126
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
112
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who created it' }),
|
|
127
113
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
128
114
|
], BankAccountHistory.prototype, "creator", void 0);
|
|
129
115
|
tslib_1.__decorate([
|
|
130
|
-
(0, typeorm_1.RelationId)((
|
|
116
|
+
(0, typeorm_1.RelationId)((bankAccountHistory) => bankAccountHistory.creator),
|
|
131
117
|
tslib_1.__metadata("design:type", String)
|
|
132
118
|
], BankAccountHistory.prototype, "creatorId", void 0);
|
|
133
119
|
tslib_1.__decorate([
|
|
134
120
|
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
135
|
-
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
121
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who wrote this version' }),
|
|
136
122
|
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
137
123
|
], BankAccountHistory.prototype, "updater", void 0);
|
|
138
124
|
tslib_1.__decorate([
|
|
139
|
-
(0, typeorm_1.RelationId)((
|
|
125
|
+
(0, typeorm_1.RelationId)((bankAccountHistory) => bankAccountHistory.updater),
|
|
140
126
|
tslib_1.__metadata("design:type", String)
|
|
141
127
|
], BankAccountHistory.prototype, "updaterId", void 0);
|
|
142
|
-
tslib_1.__decorate([
|
|
143
|
-
(0, type_graphql_1.Field)(type => String, { nullable: true }),
|
|
144
|
-
tslib_1.__metadata("design:type", String)
|
|
145
|
-
], BankAccountHistory.prototype, "thumbnail", void 0);
|
|
146
128
|
tslib_1.__decorate([
|
|
147
129
|
(0, typeorm_history_1.HistoryOriginalIdColumn)(),
|
|
148
130
|
tslib_1.__metadata("design:type", String)
|
|
@@ -154,15 +136,20 @@ tslib_1.__decorate([
|
|
|
154
136
|
? 'enum'
|
|
155
137
|
: DATABASE_TYPE == 'oracle'
|
|
156
138
|
? 'varchar2'
|
|
157
|
-
: '
|
|
158
|
-
|
|
139
|
+
: DATABASE_TYPE == 'mssql'
|
|
140
|
+
? 'nvarchar'
|
|
141
|
+
: 'varchar',
|
|
142
|
+
enum: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
143
|
+
? typeorm_history_1.HistoryActionType
|
|
144
|
+
: undefined,
|
|
145
|
+
length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 10
|
|
159
146
|
}),
|
|
160
147
|
tslib_1.__metadata("design:type", String)
|
|
161
148
|
], BankAccountHistory.prototype, "action", void 0);
|
|
162
149
|
exports.BankAccountHistory = BankAccountHistory = tslib_1.__decorate([
|
|
163
150
|
(0, typeorm_1.Entity)(),
|
|
164
|
-
(0, typeorm_1.Index)('
|
|
165
|
-
(0, typeorm_1.Index)('
|
|
151
|
+
(0, typeorm_1.Index)('ix_bank_account_history_0', (bankAccountHistory) => [bankAccountHistory.originalId, bankAccountHistory.version], { unique: true }),
|
|
152
|
+
(0, typeorm_1.Index)('ix_bank_account_history_1', (bankAccountHistory) => [
|
|
166
153
|
bankAccountHistory.domain,
|
|
167
154
|
bankAccountHistory.originalId,
|
|
168
155
|
bankAccountHistory.version
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bank-account-history.js","sourceRoot":"","sources":["../../../server/service/bank-account/bank-account-history.ts"],"names":[],"mappings":";;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"bank-account-history.js","sourceRoot":"","sources":["../../../server/service/bank-account/bank-account-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAgD;AAChD,6CAA4C;AAC5C,iDAA2D;AAE3D,iDAA6E;AAE7E,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAEpC,+DAA+D;AAiBxD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAAxB;QAOL,YAAO,GAAY,CAAC,CAAA;IAmGtB,CAAC;CAAA,CAAA;AA1GY,gDAAkB;AAGpB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;;8CACpD;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;;mDACrC;AAIpB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,CAA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AAC,CAAC,UAAU;oBACZ,CAAC,CAAC,SAAS;QACnB,IAAI,EACF,aAAa,IAAI,UAAU,IAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,SAAS;YACnF,CAAC,CAAC,mCAAiB;YACnB,CAAC,CAAC,SAAS;QACf,MAAM,EAAE,aAAa,IAAI,UAAU,IAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;KAC/G,CAAC;;kDAC+B;6BAzGtB,kBAAkB;IAhB9B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,2BAA2B,EAC3B,CAAC,kBAAsC,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC,EACvG,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,eAAK,EACJ,2BAA2B,EAC3B,CAAC,kBAAsC,EAAE,EAAE,CAAC;QAC1C,kBAAkB,CAAC,MAAM;QACzB,kBAAkB,CAAC,UAAU;QAC7B,kBAAkB,CAAC,OAAO;KAC3B,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;GAChD,kBAAkB,CA0G9B","sourcesContent":["import { Field, Float, ID, Int, ObjectType } from 'type-graphql'\nimport { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'\n\nimport {\n HistoryActionColumn,\n HistoryActionType,\n HistoryEntityInterface,\n HistoryOriginalIdColumn\n} from '@operato/typeorm-history'\nimport { User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain, moneyColumn } from '@things-factory/shell'\n\nimport { AccountType, BankAccount, BankAccountPurpose } from './bank-account'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n/** Each version of a bank account, written when it changes. */\n@Entity()\n@Index(\n 'ix_bank_account_history_0',\n (bankAccountHistory: BankAccountHistory) => [bankAccountHistory.originalId, bankAccountHistory.version],\n { unique: true }\n)\n@Index(\n 'ix_bank_account_history_1',\n (bankAccountHistory: BankAccountHistory) => [\n bankAccountHistory.domain,\n bankAccountHistory.originalId,\n bankAccountHistory.version\n ],\n { unique: true }\n)\n@ObjectType({ description: 'History Entity of BankAccount' })\nexport class BankAccountHistory implements HistoryEntityInterface<BankAccount> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Unique identifier of the version' })\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field({ nullable: true, description: 'Version number' })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain' })\n domain?: Domain\n\n @RelationId((bankAccountHistory: BankAccountHistory) => bankAccountHistory.domain)\n domainId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'name at this version' })\n name: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true, description: 'description at this version' })\n description: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'bankName at this version' })\n bankName: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'accountNumber at this version' })\n accountNumber: string\n\n @Column({ nullable: true })\n @Field(type => AccountType, { nullable: true, description: 'accountType at this version' })\n accountType: AccountType\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'currency at this version' })\n currency: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'timezone at this version' })\n timezone: string\n\n @Column({ nullable: true })\n @Field(type => BankAccountPurpose, { nullable: true, description: 'purpose at this version' })\n purpose: BankAccountPurpose\n\n @Column(moneyColumn({ nullable: true }))\n @Field(type => Float, { nullable: true, description: 'statedBalance at this version' })\n statedBalance: number\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'statedBalanceDate at this version' })\n statedBalanceDate: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'active at this version' })\n active: boolean\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'When it was created' })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'When this version was written' })\n updatedAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'When it was deleted' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who created it' })\n creator?: User\n\n @RelationId((bankAccountHistory: BankAccountHistory) => bankAccountHistory.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who wrote this version' })\n updater?: User\n\n @RelationId((bankAccountHistory: BankAccountHistory) => bankAccountHistory.updater)\n updaterId?: string\n\n @HistoryOriginalIdColumn()\n public originalId!: string\n\n @HistoryActionColumn({\n nullable: false,\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n enum:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? HistoryActionType\n : undefined,\n length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 10\n })\n public action!: HistoryActionType\n}\n"]}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { BankAccount } from './bank-account';
|
|
2
|
-
import {
|
|
2
|
+
import { BankAccountPatch, NewBankAccount } from './bank-account-type';
|
|
3
3
|
export declare class BankAccountMutation {
|
|
4
4
|
createBankAccount(bankAccount: NewBankAccount, context: ResolverContext): Promise<BankAccount>;
|
|
5
5
|
updateBankAccount(id: string, patch: BankAccountPatch, context: ResolverContext): Promise<BankAccount>;
|
|
6
6
|
updateMultipleBankAccount(patches: BankAccountPatch[], context: ResolverContext): Promise<BankAccount[]>;
|
|
7
7
|
deleteBankAccount(id: string, context: ResolverContext): Promise<boolean>;
|
|
8
8
|
deleteBankAccounts(ids: string[], context: ResolverContext): Promise<boolean>;
|
|
9
|
-
importBankAccounts(bankAccounts: BankAccountPatch[], context: ResolverContext): Promise<boolean>;
|
|
10
9
|
}
|