@things-factory/accounting 8.0.0-alpha.3 → 8.0.0-alpha.31
Sign up to get free protection for your applications and to get access to all the features.
- package/client/pages/accounting-category/accounting-category-tree-page.ts +1 -1
- package/client/pages/bank/bank-importer.ts +90 -0
- package/client/pages/bank/bank-list-page.ts +398 -0
- package/client/pages/bank-account/bank-account-importer.ts +90 -0
- package/client/pages/bank-account/bank-account-list-page.ts +398 -0
- package/client/pages/financial-institution/financial-institution-importer.ts +90 -0
- package/client/pages/financial-institution/financial-institution-list-page.ts +398 -0
- package/dist-client/pages/accounting-category/accounting-category-tree-page.js +1 -1
- package/dist-client/pages/accounting-category/accounting-category-tree-page.js.map +1 -1
- package/dist-client/pages/bank/bank-importer.d.ts +23 -0
- package/dist-client/pages/bank/bank-importer.js +93 -0
- package/dist-client/pages/bank/bank-importer.js.map +1 -0
- package/dist-client/pages/bank/bank-list-page.d.ts +66 -0
- package/dist-client/pages/bank/bank-list-page.js +370 -0
- package/dist-client/pages/bank/bank-list-page.js.map +1 -0
- package/dist-client/pages/bank-account/bank-account-importer.d.ts +23 -0
- package/dist-client/pages/bank-account/bank-account-importer.js +93 -0
- package/dist-client/pages/bank-account/bank-account-importer.js.map +1 -0
- package/dist-client/pages/bank-account/bank-account-list-page.d.ts +66 -0
- package/dist-client/pages/bank-account/bank-account-list-page.js +370 -0
- package/dist-client/pages/bank-account/bank-account-list-page.js.map +1 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.d.ts +23 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.js +93 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.js.map +1 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.d.ts +66 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.js +370 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/migrations/1725201567284-seed-country-codes.d.ts +5 -0
- package/dist-server/migrations/1725201567284-seed-country-codes.js +248 -0
- package/dist-server/migrations/1725201567284-seed-country-codes.js.map +1 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.d.ts +5 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.js +348 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.js.map +1 -0
- package/dist-server/service/account/account-history.js +7 -2
- package/dist-server/service/account/account-history.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category-history.js +7 -2
- package/dist-server/service/accounting-category/accounting-category-history.js.map +1 -1
- package/dist-server/service/accounting-document/accounting-document-history.js +7 -2
- package/dist-server/service/accounting-document/accounting-document-history.js.map +1 -1
- package/dist-server/service/bank-account/bank-account-history.d.ts +34 -0
- package/dist-server/service/bank-account/bank-account-history.js +172 -0
- package/dist-server/service/bank-account/bank-account-history.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-mutation.d.ts +10 -0
- package/dist-server/service/bank-account/bank-account-mutation.js +128 -0
- package/dist-server/service/bank-account/bank-account-mutation.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-query.d.ts +11 -0
- package/dist-server/service/bank-account/bank-account-query.js +79 -0
- package/dist-server/service/bank-account/bank-account-query.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-type.d.ts +39 -0
- package/dist-server/service/bank-account/bank-account-type.js +153 -0
- package/dist-server/service/bank-account/bank-account-type.js.map +1 -0
- package/dist-server/service/bank-account/bank-account.d.ts +38 -0
- package/dist-server/service/bank-account/bank-account.js +164 -0
- package/dist-server/service/bank-account/bank-account.js.map +1 -0
- package/dist-server/service/bank-account/event-subscriber.d.ts +7 -0
- package/dist-server/service/bank-account/event-subscriber.js +21 -0
- package/dist-server/service/bank-account/event-subscriber.js.map +1 -0
- package/dist-server/service/bank-account/index.d.ts +7 -0
- package/dist-server/service/bank-account/index.js +12 -0
- package/dist-server/service/bank-account/index.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.d.ts +10 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.js +169 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-query.d.ts +12 -0
- package/dist-server/service/financial-institution/financial-institution-query.js +97 -0
- package/dist-server/service/financial-institution/financial-institution-query.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-type.d.ts +32 -0
- package/dist-server/service/financial-institution/financial-institution-type.js +126 -0
- package/dist-server/service/financial-institution/financial-institution-type.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution.d.ts +34 -0
- package/dist-server/service/financial-institution/financial-institution.js +137 -0
- package/dist-server/service/financial-institution/financial-institution.js.map +1 -0
- package/dist-server/service/financial-institution/index.d.ts +6 -0
- package/dist-server/service/financial-institution/index.js +10 -0
- package/dist-server/service/financial-institution/index.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-history.js +7 -2
- package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -1
- package/dist-server/service/income-statement/income-statement-history.js +7 -2
- package/dist-server/service/income-statement/income-statement-history.js.map +1 -1
- package/dist-server/service/index.d.ts +1 -1
- package/dist-server/service/payment/index.d.ts +1 -2
- package/dist-server/service/payment/payment-history.d.ts +8 -1
- package/dist-server/service/payment/payment-history.js +48 -12
- package/dist-server/service/payment/payment-history.js.map +1 -1
- package/dist-server/service/payment/payment-type.d.ts +7 -1
- package/dist-server/service/payment/payment-type.js +24 -0
- package/dist-server/service/payment/payment-type.js.map +1 -1
- package/dist-server/service/payment/payment.d.ts +12 -0
- package/dist-server/service/payment/payment.js +36 -1
- package/dist-server/service/payment/payment.js.map +1 -1
- package/dist-server/service/transaction/transaction-history.js +7 -2
- package/dist-server/service/transaction/transaction-history.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/accounting/bank-account.md +160 -0
- package/helps/accounting/bank.md +160 -0
- package/helps/accounting/financial-institution.md +160 -0
- package/package.json +5 -5
- package/server/migrations/1725201567284-seed-country-codes.ts +261 -0
- package/server/migrations/1725201667385-seed-financial-institutions.ts +348 -0
- package/server/service/account/account-history.ts +8 -2
- package/server/service/accounting-category/accounting-category-history.ts +8 -2
- package/server/service/accounting-document/accounting-document-history.ts +8 -2
- package/server/service/bank-account/bank-account-history.ts +149 -0
- package/server/service/bank-account/bank-account-mutation.ts +137 -0
- package/server/service/bank-account/bank-account-query.ts +48 -0
- package/server/service/bank-account/bank-account-type.ts +112 -0
- package/server/service/bank-account/bank-account.ts +142 -0
- package/server/service/bank-account/event-subscriber.ts +17 -0
- package/server/service/bank-account/index.ts +9 -0
- package/server/service/financial-institution/financial-institution-mutation.ts +198 -0
- package/server/service/financial-institution/financial-institution-query.ts +62 -0
- package/server/service/financial-institution/financial-institution-type.ts +91 -0
- package/server/service/financial-institution/financial-institution.ts +122 -0
- package/server/service/financial-institution/index.ts +7 -0
- package/server/service/financial-statement/financial-statement-history.ts +8 -2
- package/server/service/income-statement/income-statement-history.ts +8 -2
- package/server/service/payment/payment-history.ts +49 -20
- package/server/service/payment/payment-type.ts +19 -1
- package/server/service/payment/payment.ts +31 -0
- package/server/service/transaction/transaction-history.ts +8 -2
@@ -0,0 +1,172 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.BankAccountHistory = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
6
|
+
const typeorm_1 = require("typeorm");
|
7
|
+
const typeorm_history_1 = require("@operato/typeorm-history");
|
8
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
9
|
+
const env_1 = require("@things-factory/env");
|
10
|
+
const shell_1 = require("@things-factory/shell");
|
11
|
+
const bank_account_1 = require("./bank-account");
|
12
|
+
const ORMCONFIG = env_1.config.get('ormconfig', {});
|
13
|
+
const DATABASE_TYPE = ORMCONFIG.type;
|
14
|
+
let BankAccountHistory = class BankAccountHistory {
|
15
|
+
constructor() {
|
16
|
+
this.version = 1;
|
17
|
+
}
|
18
|
+
};
|
19
|
+
exports.BankAccountHistory = BankAccountHistory;
|
20
|
+
tslib_1.__decorate([
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
22
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
23
|
+
tslib_1.__metadata("design:type", String)
|
24
|
+
], BankAccountHistory.prototype, "id", void 0);
|
25
|
+
tslib_1.__decorate([
|
26
|
+
(0, typeorm_1.Column)({ nullable: true, default: 1 }),
|
27
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
28
|
+
tslib_1.__metadata("design:type", Number)
|
29
|
+
], BankAccountHistory.prototype, "version", void 0);
|
30
|
+
tslib_1.__decorate([
|
31
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
32
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
33
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
34
|
+
], BankAccountHistory.prototype, "domain", void 0);
|
35
|
+
tslib_1.__decorate([
|
36
|
+
(0, typeorm_1.RelationId)((bankAccount) => bankAccount.domain),
|
37
|
+
tslib_1.__metadata("design:type", String)
|
38
|
+
], BankAccountHistory.prototype, "domainId", void 0);
|
39
|
+
tslib_1.__decorate([
|
40
|
+
(0, typeorm_1.Column)(),
|
41
|
+
(0, type_graphql_1.Field)(),
|
42
|
+
tslib_1.__metadata("design:type", String)
|
43
|
+
], BankAccountHistory.prototype, "name", void 0);
|
44
|
+
tslib_1.__decorate([
|
45
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
46
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
47
|
+
tslib_1.__metadata("design:type", String)
|
48
|
+
], BankAccountHistory.prototype, "description", void 0);
|
49
|
+
tslib_1.__decorate([
|
50
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
51
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Name of the account holder' }),
|
52
|
+
tslib_1.__metadata("design:type", String)
|
53
|
+
], BankAccountHistory.prototype, "accountHolderName", void 0);
|
54
|
+
tslib_1.__decorate([
|
55
|
+
(0, typeorm_1.Column)(),
|
56
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Bank account number' }),
|
57
|
+
tslib_1.__metadata("design:type", String)
|
58
|
+
], BankAccountHistory.prototype, "accountNumber", void 0);
|
59
|
+
tslib_1.__decorate([
|
60
|
+
(0, typeorm_1.Column)(),
|
61
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Bank name' }),
|
62
|
+
tslib_1.__metadata("design:type", String)
|
63
|
+
], BankAccountHistory.prototype, "bankName", void 0);
|
64
|
+
tslib_1.__decorate([
|
65
|
+
(0, typeorm_1.Column)({ type: 'enum', enum: bank_account_1.AccountType }),
|
66
|
+
(0, type_graphql_1.Field)(type => bank_account_1.AccountType, { description: 'Type of the account (Bank or Card)' }),
|
67
|
+
tslib_1.__metadata("design:type", String)
|
68
|
+
], BankAccountHistory.prototype, "accountType", void 0);
|
69
|
+
tslib_1.__decorate([
|
70
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
71
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Currency of the account' }),
|
72
|
+
tslib_1.__metadata("design:type", String)
|
73
|
+
], 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)({ type: 'enum', enum: bank_account_1.OwnerType }),
|
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
|
+
tslib_1.__decorate([
|
90
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
91
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'IBAN of the bank account' }),
|
92
|
+
tslib_1.__metadata("design:type", String)
|
93
|
+
], BankAccountHistory.prototype, "iban", void 0);
|
94
|
+
tslib_1.__decorate([
|
95
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
96
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'BIC of the bank account' }),
|
97
|
+
tslib_1.__metadata("design:type", String)
|
98
|
+
], BankAccountHistory.prototype, "bic", void 0);
|
99
|
+
tslib_1.__decorate([
|
100
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
101
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Country of the bank account' }),
|
102
|
+
tslib_1.__metadata("design:type", String)
|
103
|
+
], BankAccountHistory.prototype, "country", void 0);
|
104
|
+
tslib_1.__decorate([
|
105
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
106
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Cover image of the bank account' }),
|
107
|
+
tslib_1.__metadata("design:type", String)
|
108
|
+
], BankAccountHistory.prototype, "image", void 0);
|
109
|
+
tslib_1.__decorate([
|
110
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
111
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
112
|
+
tslib_1.__metadata("design:type", Date)
|
113
|
+
], BankAccountHistory.prototype, "createdAt", void 0);
|
114
|
+
tslib_1.__decorate([
|
115
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
116
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
117
|
+
tslib_1.__metadata("design:type", Date)
|
118
|
+
], BankAccountHistory.prototype, "updatedAt", void 0);
|
119
|
+
tslib_1.__decorate([
|
120
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
121
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
122
|
+
tslib_1.__metadata("design:type", Date)
|
123
|
+
], BankAccountHistory.prototype, "deletedAt", void 0);
|
124
|
+
tslib_1.__decorate([
|
125
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
126
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
127
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
128
|
+
], BankAccountHistory.prototype, "creator", void 0);
|
129
|
+
tslib_1.__decorate([
|
130
|
+
(0, typeorm_1.RelationId)((bankAccount) => bankAccount.creator),
|
131
|
+
tslib_1.__metadata("design:type", String)
|
132
|
+
], BankAccountHistory.prototype, "creatorId", void 0);
|
133
|
+
tslib_1.__decorate([
|
134
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
135
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
136
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
137
|
+
], BankAccountHistory.prototype, "updater", void 0);
|
138
|
+
tslib_1.__decorate([
|
139
|
+
(0, typeorm_1.RelationId)((bankAccount) => bankAccount.updater),
|
140
|
+
tslib_1.__metadata("design:type", String)
|
141
|
+
], 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
|
+
tslib_1.__decorate([
|
147
|
+
(0, typeorm_history_1.HistoryOriginalIdColumn)(),
|
148
|
+
tslib_1.__metadata("design:type", String)
|
149
|
+
], BankAccountHistory.prototype, "originalId", void 0);
|
150
|
+
tslib_1.__decorate([
|
151
|
+
(0, typeorm_history_1.HistoryActionColumn)({
|
152
|
+
nullable: false,
|
153
|
+
type: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
154
|
+
? 'enum'
|
155
|
+
: DATABASE_TYPE == 'oracle'
|
156
|
+
? 'varchar2'
|
157
|
+
: 'smallint',
|
158
|
+
enum: typeorm_history_1.HistoryActionType
|
159
|
+
}),
|
160
|
+
tslib_1.__metadata("design:type", String)
|
161
|
+
], BankAccountHistory.prototype, "action", void 0);
|
162
|
+
exports.BankAccountHistory = BankAccountHistory = tslib_1.__decorate([
|
163
|
+
(0, typeorm_1.Entity)(),
|
164
|
+
(0, typeorm_1.Index)('ix_bank-account_history_0', (bankAccountHistory) => [bankAccountHistory.originalId, bankAccountHistory.version], { unique: true }),
|
165
|
+
(0, typeorm_1.Index)('ix_bank-account_history_1', (bankAccountHistory) => [
|
166
|
+
bankAccountHistory.domain,
|
167
|
+
bankAccountHistory.originalId,
|
168
|
+
bankAccountHistory.version
|
169
|
+
], { unique: true }),
|
170
|
+
(0, type_graphql_1.ObjectType)({ description: 'History Entity of BankAccount' })
|
171
|
+
], BankAccountHistory);
|
172
|
+
//# sourceMappingURL=bank-account-history.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bank-account-history.js","sourceRoot":"","sources":["../../../server/service/bank-account/bank-account-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAA8F;AAE9F,8DAKiC;AACjC,yDAAsD;AACtD,6CAA4C;AAC5C,iDAA8C;AAE9C,iDAAoE;AAEpE,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAkB7B,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAAxB;QAOL,YAAO,GAAY,CAAC,CAAA;IA2GtB,CAAC;CAAA,CAAA;AAlHY,gDAAkB;AAGpB;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;8CACC;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C,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACxB;AAGX;IADN,IAAA,yCAAuB,GAAE;;sDACA;AAYnB;IAVN,IAAA,qCAAmB,EAAC;QACnB,QAAQ,EAAE,KAAK;QACf,IAAI,EACF,aAAa,IAAI,UAAU,IAAI,aAAa,IAAI,OAAO,IAAI,aAAa,IAAI,SAAS;YACnF,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,aAAa,IAAI,QAAQ;gBACzB,CAAC,CAAC,UAAU;gBACZ,CAAC,CAAC,UAAU;QAClB,IAAI,EAAE,mCAAiB;KACxB,CAAC;;kDAC+B;6BAjHtB,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,CAkH9B","sourcesContent":["import { Field, ID, 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 { Role, User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { AccountType, BankAccount, OwnerType } from './bank-account'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\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)\n readonly id: string\n\n @Column({ nullable: true, default: 1 })\n @Field({ nullable: true })\n version?: number = 1\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((bankAccount: BankAccount) => bankAccount.domain)\n domainId?: string\n\n @Column()\n @Field()\n name: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Name of the account holder' })\n accountHolderName?: string // 계좌 소유자의 이름\n\n @Column()\n @Field({ nullable: true, description: 'Bank account number' })\n accountNumber?: string\n\n @Column()\n @Field({ nullable: true, description: 'Bank name' })\n bankName?: string\n\n @Column({ type: 'enum', enum: AccountType })\n @Field(type => AccountType, { description: 'Type of the account (Bank or Card)' })\n accountType: AccountType\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Currency of the account' })\n currency?: string\n\n @Column({ nullable: false, default: false })\n @Field({ nullable: true })\n active?: boolean\n\n @Column({ type: 'enum', enum: OwnerType })\n @Field(type => OwnerType, { description: 'Type of the owner of the bank account' })\n ownerType: OwnerType\n\n @Column()\n @Field({ description: 'ID of the owner of the bank account' })\n ownerId: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'IBAN of the bank account' })\n iban?: string // 은행 계좌의 IBAN\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'BIC of the bank account' })\n bic?: string // 은행 계좌의 BIC\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Country of the bank account' })\n country?: string // 은행 계좌의 국적\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Cover image of the bank account' })\n image?: string // 은행 계좌의 커버이미지\n @Column({ nullable: true })\n @Field({ nullable: true })\n createdAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n updatedAt?: Date\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((bankAccount: BankAccount) => bankAccount.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((bankAccount: BankAccount) => bankAccount.updater)\n updaterId?: string\n\n @Field(type => String, { nullable: true })\n thumbnail?: 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 : 'smallint',\n enum: HistoryActionType\n })\n public action!: HistoryActionType\n}\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { BankAccount } from './bank-account';
|
2
|
+
import { NewBankAccount, BankAccountPatch } from './bank-account-type';
|
3
|
+
export declare class BankAccountMutation {
|
4
|
+
createBankAccount(bankAccount: NewBankAccount, context: ResolverContext): Promise<BankAccount>;
|
5
|
+
updateBankAccount(id: string, patch: BankAccountPatch, context: ResolverContext): Promise<BankAccount>;
|
6
|
+
updateMultipleBankAccount(patches: BankAccountPatch[], context: ResolverContext): Promise<BankAccount[]>;
|
7
|
+
deleteBankAccount(id: string, context: ResolverContext): Promise<boolean>;
|
8
|
+
deleteBankAccounts(ids: string[], context: ResolverContext): Promise<boolean>;
|
9
|
+
importBankAccounts(bankAccounts: BankAccountPatch[], context: ResolverContext): Promise<boolean>;
|
10
|
+
}
|
@@ -0,0 +1,128 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.BankAccountMutation = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
6
|
+
const typeorm_1 = require("typeorm");
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
8
|
+
const bank_account_1 = require("./bank-account");
|
9
|
+
const bank_account_type_1 = require("./bank-account-type");
|
10
|
+
let BankAccountMutation = class BankAccountMutation {
|
11
|
+
async createBankAccount(bankAccount, context) {
|
12
|
+
const { domain, user, tx } = context.state;
|
13
|
+
const result = await (0, shell_1.getRepository)(bank_account_1.BankAccount, tx).save(Object.assign(Object.assign({}, bankAccount), { domain, creator: user, updater: user }));
|
14
|
+
return result;
|
15
|
+
}
|
16
|
+
async updateBankAccount(id, patch, context) {
|
17
|
+
const { domain, user, tx } = context.state;
|
18
|
+
const repository = (0, shell_1.getRepository)(bank_account_1.BankAccount, tx);
|
19
|
+
const bankAccount = await repository.findOne({
|
20
|
+
where: { domain: { id: domain.id }, id }
|
21
|
+
});
|
22
|
+
const result = await repository.save(Object.assign(Object.assign(Object.assign({}, bankAccount), patch), { updater: user }));
|
23
|
+
return result;
|
24
|
+
}
|
25
|
+
async updateMultipleBankAccount(patches, context) {
|
26
|
+
const { domain, user, tx } = context.state;
|
27
|
+
let results = [];
|
28
|
+
const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
|
29
|
+
const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
|
30
|
+
const bankAccountRepo = (0, shell_1.getRepository)(bank_account_1.BankAccount, tx);
|
31
|
+
if (_createRecords.length > 0) {
|
32
|
+
for (let i = 0; i < _createRecords.length; i++) {
|
33
|
+
const newRecord = _createRecords[i];
|
34
|
+
const result = await bankAccountRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
|
35
|
+
results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
|
36
|
+
}
|
37
|
+
}
|
38
|
+
if (_updateRecords.length > 0) {
|
39
|
+
for (let i = 0; i < _updateRecords.length; i++) {
|
40
|
+
const updateRecord = _updateRecords[i];
|
41
|
+
const bankAccount = await bankAccountRepo.findOneBy({ id: updateRecord.id });
|
42
|
+
const result = await bankAccountRepo.save(Object.assign(Object.assign(Object.assign({}, bankAccount), updateRecord), { updater: user }));
|
43
|
+
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
44
|
+
}
|
45
|
+
}
|
46
|
+
return results;
|
47
|
+
}
|
48
|
+
async deleteBankAccount(id, context) {
|
49
|
+
const { domain, tx } = context.state;
|
50
|
+
await (0, shell_1.getRepository)(bank_account_1.BankAccount, tx).delete({ domain: { id: domain.id }, id });
|
51
|
+
return true;
|
52
|
+
}
|
53
|
+
async deleteBankAccounts(ids, context) {
|
54
|
+
const { domain, tx } = context.state;
|
55
|
+
await (0, shell_1.getRepository)(bank_account_1.BankAccount, tx).delete({
|
56
|
+
domain: { id: domain.id },
|
57
|
+
id: (0, typeorm_1.In)(ids)
|
58
|
+
});
|
59
|
+
return true;
|
60
|
+
}
|
61
|
+
async importBankAccounts(bankAccounts, context) {
|
62
|
+
const { domain, tx } = context.state;
|
63
|
+
await Promise.all(bankAccounts.map(async (bankAccount) => {
|
64
|
+
const createdBankAccount = await (0, shell_1.getRepository)(bank_account_1.BankAccount, tx).save(Object.assign({ domain }, bankAccount));
|
65
|
+
}));
|
66
|
+
return true;
|
67
|
+
}
|
68
|
+
};
|
69
|
+
exports.BankAccountMutation = BankAccountMutation;
|
70
|
+
tslib_1.__decorate([
|
71
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
72
|
+
(0, type_graphql_1.Mutation)(returns => bank_account_1.BankAccount, { description: 'To create new BankAccount' }),
|
73
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('bankAccount')),
|
74
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
75
|
+
tslib_1.__metadata("design:type", Function),
|
76
|
+
tslib_1.__metadata("design:paramtypes", [bank_account_type_1.NewBankAccount, Object]),
|
77
|
+
tslib_1.__metadata("design:returntype", Promise)
|
78
|
+
], BankAccountMutation.prototype, "createBankAccount", null);
|
79
|
+
tslib_1.__decorate([
|
80
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
81
|
+
(0, type_graphql_1.Mutation)(returns => bank_account_1.BankAccount, { description: 'To modify BankAccount information' }),
|
82
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
83
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
84
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
85
|
+
tslib_1.__metadata("design:type", Function),
|
86
|
+
tslib_1.__metadata("design:paramtypes", [String, bank_account_type_1.BankAccountPatch, Object]),
|
87
|
+
tslib_1.__metadata("design:returntype", Promise)
|
88
|
+
], BankAccountMutation.prototype, "updateBankAccount", null);
|
89
|
+
tslib_1.__decorate([
|
90
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
91
|
+
(0, type_graphql_1.Mutation)(returns => [bank_account_1.BankAccount], { description: "To modify multiple BankAccounts' information" }),
|
92
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [bank_account_type_1.BankAccountPatch])),
|
93
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
94
|
+
tslib_1.__metadata("design:type", Function),
|
95
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
96
|
+
tslib_1.__metadata("design:returntype", Promise)
|
97
|
+
], BankAccountMutation.prototype, "updateMultipleBankAccount", null);
|
98
|
+
tslib_1.__decorate([
|
99
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
100
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete BankAccount' }),
|
101
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
102
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
103
|
+
tslib_1.__metadata("design:type", Function),
|
104
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
105
|
+
tslib_1.__metadata("design:returntype", Promise)
|
106
|
+
], BankAccountMutation.prototype, "deleteBankAccount", null);
|
107
|
+
tslib_1.__decorate([
|
108
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
109
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple BankAccounts' }),
|
110
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
111
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
112
|
+
tslib_1.__metadata("design:type", Function),
|
113
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
114
|
+
tslib_1.__metadata("design:returntype", Promise)
|
115
|
+
], BankAccountMutation.prototype, "deleteBankAccounts", null);
|
116
|
+
tslib_1.__decorate([
|
117
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
118
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple BankAccounts' }),
|
119
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('bankAccounts', type => [bank_account_type_1.BankAccountPatch])),
|
120
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
121
|
+
tslib_1.__metadata("design:type", Function),
|
122
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
123
|
+
tslib_1.__metadata("design:returntype", Promise)
|
124
|
+
], BankAccountMutation.prototype, "importBankAccounts", null);
|
125
|
+
exports.BankAccountMutation = BankAccountMutation = tslib_1.__decorate([
|
126
|
+
(0, type_graphql_1.Resolver)(bank_account_1.BankAccount)
|
127
|
+
], BankAccountMutation);
|
128
|
+
//# sourceMappingURL=bank-account-mutation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bank-account-mutation.js","sourceRoot":"","sources":["../../../server/service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BAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAE9E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6DAWP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;IAE9E,mBAAA,IAAA,kBAAG,EAAC,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,oCAAgB,CAAC,CAAC,CAAA;IAC/C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6DAWP;8BA/HU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,0BAAW,CAAC;GACT,mBAAmB,CAgI/B","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { getRepository } from '@things-factory/shell'\n\nimport { BankAccount } from './bank-account'\nimport { NewBankAccount, BankAccountPatch } from './bank-account-type'\n\n@Resolver(BankAccount)\nexport class BankAccountMutation {\n @Directive('@transaction')\n @Mutation(returns => BankAccount, { description: 'To create new BankAccount' })\n async createBankAccount(@Arg('bankAccount') bankAccount: NewBankAccount, @Ctx() context: ResolverContext): Promise<BankAccount> {\n const { domain, user, tx } = context.state\n\n const result = await getRepository(BankAccount, tx).save({\n ...bankAccount,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => BankAccount, { description: 'To modify BankAccount information' })\n async updateBankAccount(\n @Arg('id') id: string,\n @Arg('patch') patch: BankAccountPatch,\n @Ctx() context: ResolverContext\n ): Promise<BankAccount> {\n const { domain, user, tx } = context.state\n\n const repository = getRepository(BankAccount, tx)\n const bankAccount = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...bankAccount,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => [BankAccount], { description: \"To modify multiple BankAccounts' information\" })\n async updateMultipleBankAccount(\n @Arg('patches', type => [BankAccountPatch]) patches: BankAccountPatch[],\n @Ctx() context: ResolverContext\n ): Promise<BankAccount[]> {\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 bankAccountRepo = getRepository(BankAccount, 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 bankAccountRepo.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 bankAccount = await bankAccountRepo.findOneBy({ id: updateRecord.id })\n\n const result = await bankAccountRepo.save({\n ...bankAccount,\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 BankAccount' })\n async deleteBankAccount(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(BankAccount, tx).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple BankAccounts' })\n async deleteBankAccounts(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await getRepository(BankAccount, 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 BankAccounts' })\n async importBankAccounts(\n @Arg('bankAccounts', type => [BankAccountPatch]) bankAccounts: BankAccountPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n bankAccounts.map(async (bankAccount: BankAccountPatch) => {\n const createdBankAccount: BankAccount = await getRepository(BankAccount, tx).save({ domain, ...bankAccount })\n })\n )\n\n return true\n }\n}\n"]}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { Domain, ListParam } from '@things-factory/shell';
|
2
|
+
import { User } from '@things-factory/auth-base';
|
3
|
+
import { BankAccount } from './bank-account';
|
4
|
+
import { BankAccountList } from './bank-account-type';
|
5
|
+
export declare class BankAccountQuery {
|
6
|
+
bankAccount(id: string, context: ResolverContext): Promise<BankAccount>;
|
7
|
+
bankAccounts(params: ListParam, context: ResolverContext): Promise<BankAccountList>;
|
8
|
+
domain(bankAccount: BankAccount): Promise<Domain>;
|
9
|
+
updater(bankAccount: BankAccount): Promise<User>;
|
10
|
+
creator(bankAccount: BankAccount): Promise<User>;
|
11
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.BankAccountQuery = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
6
|
+
const shell_1 = require("@things-factory/shell");
|
7
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
8
|
+
const bank_account_1 = require("./bank-account");
|
9
|
+
const bank_account_type_1 = require("./bank-account-type");
|
10
|
+
let BankAccountQuery = class BankAccountQuery {
|
11
|
+
async bankAccount(id, context) {
|
12
|
+
const { domain } = context.state;
|
13
|
+
return await (0, shell_1.getRepository)(bank_account_1.BankAccount).findOne({
|
14
|
+
where: { domain: { id: domain.id }, id }
|
15
|
+
});
|
16
|
+
}
|
17
|
+
async bankAccounts(params, context) {
|
18
|
+
const { domain } = context.state;
|
19
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
20
|
+
domain,
|
21
|
+
params,
|
22
|
+
repository: await (0, shell_1.getRepository)(bank_account_1.BankAccount),
|
23
|
+
searchables: ['name', 'description']
|
24
|
+
});
|
25
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
26
|
+
return { items, total };
|
27
|
+
}
|
28
|
+
async domain(bankAccount) {
|
29
|
+
return bankAccount.domainId && (await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: bankAccount.domainId }));
|
30
|
+
}
|
31
|
+
async updater(bankAccount) {
|
32
|
+
return bankAccount.updaterId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: bankAccount.updaterId }));
|
33
|
+
}
|
34
|
+
async creator(bankAccount) {
|
35
|
+
return bankAccount.creatorId && (await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: bankAccount.creatorId }));
|
36
|
+
}
|
37
|
+
};
|
38
|
+
exports.BankAccountQuery = BankAccountQuery;
|
39
|
+
tslib_1.__decorate([
|
40
|
+
(0, type_graphql_1.Query)(returns => bank_account_1.BankAccount, { nullable: true, description: 'To fetch a BankAccount' }),
|
41
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
42
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
43
|
+
tslib_1.__metadata("design:type", Function),
|
44
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
45
|
+
tslib_1.__metadata("design:returntype", Promise)
|
46
|
+
], BankAccountQuery.prototype, "bankAccount", null);
|
47
|
+
tslib_1.__decorate([
|
48
|
+
(0, type_graphql_1.Query)(returns => bank_account_type_1.BankAccountList, { description: 'To fetch multiple BankAccounts' }),
|
49
|
+
tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
50
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
51
|
+
tslib_1.__metadata("design:type", Function),
|
52
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
53
|
+
tslib_1.__metadata("design:returntype", Promise)
|
54
|
+
], BankAccountQuery.prototype, "bankAccounts", null);
|
55
|
+
tslib_1.__decorate([
|
56
|
+
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
57
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
58
|
+
tslib_1.__metadata("design:type", Function),
|
59
|
+
tslib_1.__metadata("design:paramtypes", [bank_account_1.BankAccount]),
|
60
|
+
tslib_1.__metadata("design:returntype", Promise)
|
61
|
+
], BankAccountQuery.prototype, "domain", null);
|
62
|
+
tslib_1.__decorate([
|
63
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
64
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
65
|
+
tslib_1.__metadata("design:type", Function),
|
66
|
+
tslib_1.__metadata("design:paramtypes", [bank_account_1.BankAccount]),
|
67
|
+
tslib_1.__metadata("design:returntype", Promise)
|
68
|
+
], BankAccountQuery.prototype, "updater", null);
|
69
|
+
tslib_1.__decorate([
|
70
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
71
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
72
|
+
tslib_1.__metadata("design:type", Function),
|
73
|
+
tslib_1.__metadata("design:paramtypes", [bank_account_1.BankAccount]),
|
74
|
+
tslib_1.__metadata("design:returntype", Promise)
|
75
|
+
], BankAccountQuery.prototype, "creator", null);
|
76
|
+
exports.BankAccountQuery = BankAccountQuery = tslib_1.__decorate([
|
77
|
+
(0, type_graphql_1.Resolver)(bank_account_1.BankAccount)
|
78
|
+
], BankAccountQuery);
|
79
|
+
//# sourceMappingURL=bank-account-query.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bank-account-query.js","sourceRoot":"","sources":["../../../server/service/bank-account/bank-account-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAA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C5B","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 { BankAccount } from './bank-account'\nimport { BankAccountList } from './bank-account-type'\n\n@Resolver(BankAccount)\nexport class BankAccountQuery {\n @Query(returns => BankAccount!, { nullable: true, description: 'To fetch a BankAccount' })\n async bankAccount(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<BankAccount> {\n const { domain } = context.state\n\n return await getRepository(BankAccount).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Query(returns => BankAccountList, { description: 'To fetch multiple BankAccounts' })\n async bankAccounts(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<BankAccountList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(BankAccount),\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() bankAccount: BankAccount): Promise<Domain> {\n return bankAccount.domainId && (await getRepository(Domain).findOneBy({ id: bankAccount.domainId }))\n }\n\n @FieldResolver(type => User)\n async updater(@Root() bankAccount: BankAccount): Promise<User> {\n return bankAccount.updaterId && (await getRepository(User).findOneBy({ id: bankAccount.updaterId }))\n }\n\n @FieldResolver(type => User)\n async creator(@Root() bankAccount: BankAccount): Promise<User> {\n return bankAccount.creatorId && (await getRepository(User).findOneBy({ id: bankAccount.creatorId }))\n }\n}\n"]}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { AccountType, BankAccount, OwnerType } from './bank-account';
|
2
|
+
export declare class NewBankAccount {
|
3
|
+
name: string;
|
4
|
+
description?: string;
|
5
|
+
accountHolderName?: string;
|
6
|
+
accountNumber?: string;
|
7
|
+
bankName?: string;
|
8
|
+
accountType: AccountType;
|
9
|
+
currency?: string;
|
10
|
+
active?: boolean;
|
11
|
+
ownerType: OwnerType;
|
12
|
+
ownerId: string;
|
13
|
+
iban?: string;
|
14
|
+
bic?: string;
|
15
|
+
country?: string;
|
16
|
+
image?: string;
|
17
|
+
}
|
18
|
+
export declare class BankAccountPatch {
|
19
|
+
id?: string;
|
20
|
+
name?: string;
|
21
|
+
description?: string;
|
22
|
+
accountHolderName?: string;
|
23
|
+
accountNumber?: string;
|
24
|
+
bankName?: string;
|
25
|
+
accountType: AccountType;
|
26
|
+
currency?: string;
|
27
|
+
active?: boolean;
|
28
|
+
ownerType: OwnerType;
|
29
|
+
ownerId: string;
|
30
|
+
iban?: string;
|
31
|
+
bic?: string;
|
32
|
+
country?: string;
|
33
|
+
image?: string;
|
34
|
+
cuFlag?: string;
|
35
|
+
}
|
36
|
+
export declare class BankAccountList {
|
37
|
+
items: BankAccount[];
|
38
|
+
total: number;
|
39
|
+
}
|
@@ -0,0 +1,153 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.BankAccountList = exports.BankAccountPatch = exports.NewBankAccount = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
6
|
+
const bank_account_1 = require("./bank-account");
|
7
|
+
let NewBankAccount = class NewBankAccount {
|
8
|
+
};
|
9
|
+
exports.NewBankAccount = NewBankAccount;
|
10
|
+
tslib_1.__decorate([
|
11
|
+
(0, type_graphql_1.Field)(),
|
12
|
+
tslib_1.__metadata("design:type", String)
|
13
|
+
], NewBankAccount.prototype, "name", void 0);
|
14
|
+
tslib_1.__decorate([
|
15
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
16
|
+
tslib_1.__metadata("design:type", String)
|
17
|
+
], NewBankAccount.prototype, "description", void 0);
|
18
|
+
tslib_1.__decorate([
|
19
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Name of the account holder' }),
|
20
|
+
tslib_1.__metadata("design:type", String)
|
21
|
+
], NewBankAccount.prototype, "accountHolderName", void 0);
|
22
|
+
tslib_1.__decorate([
|
23
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Bank account number' }),
|
24
|
+
tslib_1.__metadata("design:type", String)
|
25
|
+
], NewBankAccount.prototype, "accountNumber", void 0);
|
26
|
+
tslib_1.__decorate([
|
27
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Bank name' }),
|
28
|
+
tslib_1.__metadata("design:type", String)
|
29
|
+
], NewBankAccount.prototype, "bankName", void 0);
|
30
|
+
tslib_1.__decorate([
|
31
|
+
(0, type_graphql_1.Field)(type => bank_account_1.AccountType, { description: 'Type of the account (Bank or Card)' }),
|
32
|
+
tslib_1.__metadata("design:type", String)
|
33
|
+
], NewBankAccount.prototype, "accountType", void 0);
|
34
|
+
tslib_1.__decorate([
|
35
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Currency of the account' }),
|
36
|
+
tslib_1.__metadata("design:type", String)
|
37
|
+
], NewBankAccount.prototype, "currency", void 0);
|
38
|
+
tslib_1.__decorate([
|
39
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
40
|
+
tslib_1.__metadata("design:type", Boolean)
|
41
|
+
], NewBankAccount.prototype, "active", void 0);
|
42
|
+
tslib_1.__decorate([
|
43
|
+
(0, type_graphql_1.Field)(type => bank_account_1.OwnerType, { description: 'Type of the owner of the bank account' }),
|
44
|
+
tslib_1.__metadata("design:type", String)
|
45
|
+
], NewBankAccount.prototype, "ownerType", void 0);
|
46
|
+
tslib_1.__decorate([
|
47
|
+
(0, type_graphql_1.Field)({ description: 'ID of the owner of the bank account' }),
|
48
|
+
tslib_1.__metadata("design:type", String)
|
49
|
+
], NewBankAccount.prototype, "ownerId", void 0);
|
50
|
+
tslib_1.__decorate([
|
51
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'IBAN of the bank account' }),
|
52
|
+
tslib_1.__metadata("design:type", String)
|
53
|
+
], NewBankAccount.prototype, "iban", void 0);
|
54
|
+
tslib_1.__decorate([
|
55
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'BIC of the bank account' }),
|
56
|
+
tslib_1.__metadata("design:type", String)
|
57
|
+
], NewBankAccount.prototype, "bic", void 0);
|
58
|
+
tslib_1.__decorate([
|
59
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Country of the bank account' }),
|
60
|
+
tslib_1.__metadata("design:type", String)
|
61
|
+
], NewBankAccount.prototype, "country", void 0);
|
62
|
+
tslib_1.__decorate([
|
63
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Cover image of the bank account' }),
|
64
|
+
tslib_1.__metadata("design:type", String)
|
65
|
+
], NewBankAccount.prototype, "image", void 0);
|
66
|
+
exports.NewBankAccount = NewBankAccount = tslib_1.__decorate([
|
67
|
+
(0, type_graphql_1.InputType)()
|
68
|
+
], NewBankAccount);
|
69
|
+
let BankAccountPatch = class BankAccountPatch {
|
70
|
+
};
|
71
|
+
exports.BankAccountPatch = BankAccountPatch;
|
72
|
+
tslib_1.__decorate([
|
73
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
74
|
+
tslib_1.__metadata("design:type", String)
|
75
|
+
], BankAccountPatch.prototype, "id", void 0);
|
76
|
+
tslib_1.__decorate([
|
77
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
78
|
+
tslib_1.__metadata("design:type", String)
|
79
|
+
], BankAccountPatch.prototype, "name", void 0);
|
80
|
+
tslib_1.__decorate([
|
81
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
82
|
+
tslib_1.__metadata("design:type", String)
|
83
|
+
], BankAccountPatch.prototype, "description", void 0);
|
84
|
+
tslib_1.__decorate([
|
85
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Name of the account holder' }),
|
86
|
+
tslib_1.__metadata("design:type", String)
|
87
|
+
], BankAccountPatch.prototype, "accountHolderName", void 0);
|
88
|
+
tslib_1.__decorate([
|
89
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Bank account number' }),
|
90
|
+
tslib_1.__metadata("design:type", String)
|
91
|
+
], BankAccountPatch.prototype, "accountNumber", void 0);
|
92
|
+
tslib_1.__decorate([
|
93
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Bank name' }),
|
94
|
+
tslib_1.__metadata("design:type", String)
|
95
|
+
], BankAccountPatch.prototype, "bankName", void 0);
|
96
|
+
tslib_1.__decorate([
|
97
|
+
(0, type_graphql_1.Field)(type => bank_account_1.AccountType, { description: 'Type of the account (Bank or Card)' }),
|
98
|
+
tslib_1.__metadata("design:type", String)
|
99
|
+
], BankAccountPatch.prototype, "accountType", void 0);
|
100
|
+
tslib_1.__decorate([
|
101
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Currency of the account' }),
|
102
|
+
tslib_1.__metadata("design:type", String)
|
103
|
+
], BankAccountPatch.prototype, "currency", void 0);
|
104
|
+
tslib_1.__decorate([
|
105
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
106
|
+
tslib_1.__metadata("design:type", Boolean)
|
107
|
+
], BankAccountPatch.prototype, "active", void 0);
|
108
|
+
tslib_1.__decorate([
|
109
|
+
(0, type_graphql_1.Field)(type => bank_account_1.OwnerType, { description: 'Type of the owner of the bank account' }),
|
110
|
+
tslib_1.__metadata("design:type", String)
|
111
|
+
], BankAccountPatch.prototype, "ownerType", void 0);
|
112
|
+
tslib_1.__decorate([
|
113
|
+
(0, type_graphql_1.Field)({ description: 'ID of the owner of the bank account' }),
|
114
|
+
tslib_1.__metadata("design:type", String)
|
115
|
+
], BankAccountPatch.prototype, "ownerId", void 0);
|
116
|
+
tslib_1.__decorate([
|
117
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'IBAN of the bank account' }),
|
118
|
+
tslib_1.__metadata("design:type", String)
|
119
|
+
], BankAccountPatch.prototype, "iban", void 0);
|
120
|
+
tslib_1.__decorate([
|
121
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'BIC of the bank account' }),
|
122
|
+
tslib_1.__metadata("design:type", String)
|
123
|
+
], BankAccountPatch.prototype, "bic", void 0);
|
124
|
+
tslib_1.__decorate([
|
125
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Country of the bank account' }),
|
126
|
+
tslib_1.__metadata("design:type", String)
|
127
|
+
], BankAccountPatch.prototype, "country", void 0);
|
128
|
+
tslib_1.__decorate([
|
129
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Cover image of the bank account' }),
|
130
|
+
tslib_1.__metadata("design:type", String)
|
131
|
+
], BankAccountPatch.prototype, "image", void 0);
|
132
|
+
tslib_1.__decorate([
|
133
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
134
|
+
tslib_1.__metadata("design:type", String)
|
135
|
+
], BankAccountPatch.prototype, "cuFlag", void 0);
|
136
|
+
exports.BankAccountPatch = BankAccountPatch = tslib_1.__decorate([
|
137
|
+
(0, type_graphql_1.InputType)()
|
138
|
+
], BankAccountPatch);
|
139
|
+
let BankAccountList = class BankAccountList {
|
140
|
+
};
|
141
|
+
exports.BankAccountList = BankAccountList;
|
142
|
+
tslib_1.__decorate([
|
143
|
+
(0, type_graphql_1.Field)(type => [bank_account_1.BankAccount]),
|
144
|
+
tslib_1.__metadata("design:type", Array)
|
145
|
+
], BankAccountList.prototype, "items", void 0);
|
146
|
+
tslib_1.__decorate([
|
147
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
148
|
+
tslib_1.__metadata("design:type", Number)
|
149
|
+
], BankAccountList.prototype, "total", void 0);
|
150
|
+
exports.BankAccountList = BankAccountList = tslib_1.__decorate([
|
151
|
+
(0, type_graphql_1.ObjectType)()
|
152
|
+
], BankAccountList);
|
153
|
+
//# sourceMappingURL=bank-account-type.js.map
|