@tomei/finance 0.1.13 → 0.2.0
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/account/entities/account.entity.d.ts +3 -1
- package/dist/account/entities/account.entity.js +6 -1
- package/dist/account/entities/account.entity.js.map +1 -1
- package/dist/account/interfaces/account.repository.interface.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/enum/index.d.ts +2 -1
- package/dist/enum/index.js +3 -1
- package/dist/enum/index.js.map +1 -1
- package/dist/enum/transaction-type.enum.d.ts +4 -0
- package/dist/enum/transaction-type.enum.js +9 -0
- package/dist/enum/transaction-type.enum.js.map +1 -0
- package/dist/finance-company/finance-company.d.ts +10 -0
- package/dist/finance-company/finance-company.js +63 -0
- package/dist/finance-company/finance-company.js.map +1 -0
- package/dist/finance-company/index.d.ts +2 -0
- package/dist/finance-company/index.js +6 -0
- package/dist/finance-company/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/account-system.interface.d.ts +1 -0
- package/dist/journal-entry/entities/journal-entry.entity.d.ts +12 -0
- package/dist/journal-entry/entities/journal-entry.entity.js +98 -0
- package/dist/journal-entry/entities/journal-entry.entity.js.map +1 -0
- package/dist/journal-entry/index.d.ts +6 -0
- package/dist/journal-entry/index.js +10 -0
- package/dist/journal-entry/index.js.map +1 -0
- package/dist/journal-entry/interfaces/journal-entry-attr.interface.d.ts +9 -0
- package/dist/journal-entry/interfaces/journal-entry-attr.interface.js +3 -0
- package/dist/journal-entry/interfaces/journal-entry-attr.interface.js.map +1 -0
- package/dist/journal-entry/interfaces/journal-entry.repository.interface.d.ts +10 -0
- package/dist/journal-entry/interfaces/journal-entry.repository.interface.js +3 -0
- package/dist/journal-entry/interfaces/journal-entry.repository.interface.js.map +1 -0
- package/dist/journal-entry/journal-entry.d.ts +32 -0
- package/dist/journal-entry/journal-entry.js +97 -0
- package/dist/journal-entry/journal-entry.js.map +1 -0
- package/dist/journal-entry/journal-entry.repository.d.ts +15 -0
- package/dist/journal-entry/journal-entry.repository.js +43 -0
- package/dist/journal-entry/journal-entry.repository.js.map +1 -0
- package/dist/ledger-transaction/entities/ledger-transaction.entity.d.ts +19 -0
- package/dist/ledger-transaction/entities/ledger-transaction.entity.js +157 -0
- package/dist/ledger-transaction/entities/ledger-transaction.entity.js.map +1 -0
- package/dist/ledger-transaction/index.d.ts +6 -0
- package/dist/ledger-transaction/index.js +10 -0
- package/dist/ledger-transaction/index.js.map +1 -0
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts +18 -0
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.js +3 -0
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.js.map +1 -0
- package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.d.ts +5 -0
- package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.js +3 -0
- package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.js.map +1 -0
- package/dist/ledger-transaction/ledger-transaction.d.ts +35 -0
- package/dist/ledger-transaction/ledger-transaction.js +71 -0
- package/dist/ledger-transaction/ledger-transaction.js.map +1 -0
- package/dist/ledger-transaction/ledger-transaction.repository.d.ts +10 -0
- package/dist/ledger-transaction/ledger-transaction.repository.js +37 -0
- package/dist/ledger-transaction/ledger-transaction.repository.js.map +1 -0
- package/dist/payment/interfaces/payment-item.repository.interface.d.ts +1 -1
- package/dist/payment/interfaces/payment.repository.interface.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/migrations/finance-journal-entry-migration.js +41 -0
- package/migrations/finance-ledger-transaction-migration.js +73 -0
- package/package.json +2 -2
- package/src/account/account.ts +189 -189
- package/src/account/entities/account.entity.ts +111 -107
- package/src/account/interfaces/account-attr.interface.ts +23 -23
- package/src/enum/index.ts +6 -5
- package/src/enum/transaction-type.enum.ts +4 -0
- package/src/finance-company/finance-company.ts +95 -0
- package/src/finance-company/index.ts +3 -0
- package/src/index.ts +9 -6
- package/src/interfaces/account-system.interface.ts +14 -13
- package/src/journal-entry/entities/journal-entry.entity.ts +74 -0
- package/src/journal-entry/index.ts +13 -0
- package/src/journal-entry/interfaces/journal-entry-attr.interface.ts +9 -0
- package/src/journal-entry/interfaces/journal-entry.repository.interface.ts +11 -0
- package/src/journal-entry/journal-entry.repository.ts +38 -0
- package/src/journal-entry/journal-entry.ts +136 -0
- package/src/ledger-transaction/entities/ledger-transaction.entity.ts +134 -0
- package/src/ledger-transaction/index.ts +13 -0
- package/src/ledger-transaction/interfaces/ledger-transaction-attr.interface.ts +20 -0
- package/src/ledger-transaction/interfaces/ledger-transaction.repository.interface.ts +7 -0
- package/src/ledger-transaction/ledger-transaction.repository.ts +28 -0
- package/src/ledger-transaction/ledger-transaction.ts +96 -0
- package/src/payment/payment.ts +209 -209
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { LedgerTransactionModel } from 'src/ledger-transaction/entities/ledger-transaction.entity';
|
|
2
3
|
import { PaymentModel } from '../../payment/entities/payment.entity';
|
|
3
4
|
export declare class AccountModel extends Model {
|
|
4
5
|
AccountNo: string;
|
|
@@ -12,5 +13,6 @@ export declare class AccountModel extends Model {
|
|
|
12
13
|
CreatedById: string;
|
|
13
14
|
UpdatedAt: Date;
|
|
14
15
|
UpdatedById: string;
|
|
15
|
-
|
|
16
|
+
Payments: PaymentModel[];
|
|
17
|
+
LedgerTransactions: LedgerTransactionModel[];
|
|
16
18
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.AccountModel = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
15
|
+
const ledger_transaction_entity_1 = require("src/ledger-transaction/entities/ledger-transaction.entity");
|
|
15
16
|
const payment_entity_1 = require("../../payment/entities/payment.entity");
|
|
16
17
|
let AccountModel = class AccountModel extends sequelize_typescript_1.Model {
|
|
17
18
|
};
|
|
@@ -119,7 +120,11 @@ __decorate([
|
|
|
119
120
|
__decorate([
|
|
120
121
|
(0, sequelize_typescript_1.HasMany)(() => payment_entity_1.PaymentModel),
|
|
121
122
|
__metadata("design:type", Array)
|
|
122
|
-
], AccountModel.prototype, "
|
|
123
|
+
], AccountModel.prototype, "Payments", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
(0, sequelize_typescript_1.HasMany)(() => ledger_transaction_entity_1.LedgerTransactionModel),
|
|
126
|
+
__metadata("design:type", Array)
|
|
127
|
+
], AccountModel.prototype, "LedgerTransactions", void 0);
|
|
123
128
|
AccountModel = __decorate([
|
|
124
129
|
(0, sequelize_typescript_1.Table)({ tableName: 'finance_Account', createdAt: false, updatedAt: false })
|
|
125
130
|
], AccountModel);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.entity.js","sourceRoot":"","sources":["../../../src/account/entities/account.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,+DAQ8B;AAC9B,0EAAqE;AAG9D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,4BAAK;
|
|
1
|
+
{"version":3,"file":"account.entity.js","sourceRoot":"","sources":["../../../src/account/entities/account.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,+DAQ8B;AAC9B,yGAAmG;AACnG,0EAAqE;AAG9D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,4BAAK;CAgGtC,CAAA;AA/FC;IAAC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;IACvD,IAAA,6BAAM,EAAC;QACN,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,+BAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;KAC1B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scopes.enum';
|
|
2
2
|
import { PaymentType } from './payment-type.enum';
|
|
3
3
|
import { PaymentMethod } from './payment-method.enum';
|
|
4
|
-
|
|
4
|
+
import { TransactionTypeOptions } from './transaction-type.enum';
|
|
5
|
+
export { ClientScopes, PaymentType, PaymentMethod, TransactionTypeOptions };
|
package/dist/enum/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PaymentMethod = exports.PaymentType = exports.ClientScopes = void 0;
|
|
3
|
+
exports.TransactionTypeOptions = exports.PaymentMethod = exports.PaymentType = exports.ClientScopes = void 0;
|
|
4
4
|
const quick_book_client_scopes_enum_1 = require("./quick-book-client-scopes.enum");
|
|
5
5
|
Object.defineProperty(exports, "ClientScopes", { enumerable: true, get: function () { return quick_book_client_scopes_enum_1.ClientScopes; } });
|
|
6
6
|
const payment_type_enum_1 = require("./payment-type.enum");
|
|
7
7
|
Object.defineProperty(exports, "PaymentType", { enumerable: true, get: function () { return payment_type_enum_1.PaymentType; } });
|
|
8
8
|
const payment_method_enum_1 = require("./payment-method.enum");
|
|
9
9
|
Object.defineProperty(exports, "PaymentMethod", { enumerable: true, get: function () { return payment_method_enum_1.PaymentMethod; } });
|
|
10
|
+
const transaction_type_enum_1 = require("./transaction-type.enum");
|
|
11
|
+
Object.defineProperty(exports, "TransactionTypeOptions", { enumerable: true, get: function () { return transaction_type_enum_1.TransactionTypeOptions; } });
|
|
10
12
|
//# sourceMappingURL=index.js.map
|
package/dist/enum/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enum/index.ts"],"names":[],"mappings":";;;AAAA,mFAA+D;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enum/index.ts"],"names":[],"mappings":";;;AAAA,mFAA+D;AAKtD,6FALA,4CAAY,OAKA;AAJrB,2DAAkD;AAI3B,4FAJd,+BAAW,OAIc;AAHlC,+DAAsD;AAGlB,8FAH3B,mCAAa,OAG2B;AAFjD,mEAAiE;AAEd,uGAF1C,8CAAsB,OAE0C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionTypeOptions = void 0;
|
|
4
|
+
var TransactionTypeOptions;
|
|
5
|
+
(function (TransactionTypeOptions) {
|
|
6
|
+
TransactionTypeOptions[TransactionTypeOptions["Debit"] = 1] = "Debit";
|
|
7
|
+
TransactionTypeOptions[TransactionTypeOptions["Credit"] = 2] = "Credit";
|
|
8
|
+
})(TransactionTypeOptions = exports.TransactionTypeOptions || (exports.TransactionTypeOptions = {}));
|
|
9
|
+
//# sourceMappingURL=transaction-type.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-type.enum.js","sourceRoot":"","sources":["../../src/enum/transaction-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,qEAAS,CAAA;IACT,uEAAU,CAAA;AACZ,CAAC,EAHW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAGjC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IAccountSystem } from 'src/interfaces';
|
|
2
|
+
import { JournalEntryRepository } from 'src/journal-entry';
|
|
3
|
+
import { LedgerTransactionRepository } from 'src/ledger-transaction';
|
|
4
|
+
export declare class FinanceCompany {
|
|
5
|
+
journalEntryRepository: JournalEntryRepository;
|
|
6
|
+
ledgerTransactionRepository: LedgerTransactionRepository;
|
|
7
|
+
accountingSystem: IAccountSystem;
|
|
8
|
+
constructor(journalEntryRepository: JournalEntryRepository, ledgerTransactionRepository: LedgerTransactionRepository, accountingSystem: IAccountSystem);
|
|
9
|
+
postJournal(journalEntryId: string, userId: string): Promise<any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FinanceCompany = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const journal_entry_1 = require("src/journal-entry");
|
|
6
|
+
const uniqid = require("uniqid");
|
|
7
|
+
const axios_1 = require("axios");
|
|
8
|
+
const journal_entry_2 = require("src/journal-entry");
|
|
9
|
+
class FinanceCompany {
|
|
10
|
+
constructor(journalEntryRepository, ledgerTransactionRepository, accountingSystem) {
|
|
11
|
+
this.ledgerTransactionRepository = ledgerTransactionRepository;
|
|
12
|
+
this.journalEntryRepository = journalEntryRepository;
|
|
13
|
+
this.accountingSystem = accountingSystem;
|
|
14
|
+
}
|
|
15
|
+
async postJournal(journalEntryId, userId) {
|
|
16
|
+
var _a, _b, _c, _d;
|
|
17
|
+
const journalEntry = new journal_entry_1.JournalEntry(this.journalEntryRepository, this.ledgerTransactionRepository);
|
|
18
|
+
if (((_a = journalEntry.CreditTransactions) === null || _a === void 0 ? void 0 : _a.length) < 1 ||
|
|
19
|
+
((_b = journalEntry.DebitTransactions) === null || _b === void 0 ? void 0 : _b.length) < 1) {
|
|
20
|
+
throw new common_1.BadRequestException('There should be at least 1 debit ledger transaction and 1 credit ledger transaction in the journal entry');
|
|
21
|
+
}
|
|
22
|
+
if (((_c = journalEntry.CreditTransactions) === null || _c === void 0 ? void 0 : _c.length) !==
|
|
23
|
+
((_d = journalEntry.DebitTransactions) === null || _d === void 0 ? void 0 : _d.length)) {
|
|
24
|
+
throw new common_1.BadRequestException('Credit ledger transaction and debit ledger transaction should the same amount');
|
|
25
|
+
}
|
|
26
|
+
const matchingJournalEntry = await this.journalEntryRepository.findOne({
|
|
27
|
+
where: {
|
|
28
|
+
JournalEntryId: journalEntryId,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
matchingJournalEntry.PostedById = userId;
|
|
32
|
+
await matchingJournalEntry.save();
|
|
33
|
+
const allLedgerTransactions = await this.ledgerTransactionRepository.findAll();
|
|
34
|
+
for (const ledgerTransaction of allLedgerTransactions) {
|
|
35
|
+
ledgerTransaction.JournalEntryId = journalEntryId;
|
|
36
|
+
ledgerTransaction.save();
|
|
37
|
+
}
|
|
38
|
+
journalEntry.init({
|
|
39
|
+
JournalEntryId: uniqid(),
|
|
40
|
+
Date: new Date(),
|
|
41
|
+
Name: '',
|
|
42
|
+
Description: '',
|
|
43
|
+
PostedById: userId,
|
|
44
|
+
PostedToAccSystemYN: 'N',
|
|
45
|
+
DatePosted: null,
|
|
46
|
+
});
|
|
47
|
+
await this.accountingSystem.postJournalEntry(matchingJournalEntry);
|
|
48
|
+
const payload = {
|
|
49
|
+
Action: 'Create',
|
|
50
|
+
Activity: 'Post Journal Entry',
|
|
51
|
+
Description: `Journal Entry (ID: ${matchingJournalEntry.JournalEntryId}) has been created`,
|
|
52
|
+
EntityType: typeof journal_entry_2.JournalEntryModel,
|
|
53
|
+
EntityValueBefore: JSON.stringify({}),
|
|
54
|
+
EntityValueAfter: JSON.stringify(matchingJournalEntry),
|
|
55
|
+
PerformedById: userId,
|
|
56
|
+
PerformedAt: new Date(),
|
|
57
|
+
EntityId: matchingJournalEntry.JournalEntryId,
|
|
58
|
+
};
|
|
59
|
+
await axios_1.default.post(`${process.env.COMMON_API_URL}/activity-histories`, payload);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.FinanceCompany = FinanceCompany;
|
|
63
|
+
//# sourceMappingURL=finance-company.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finance-company.js","sourceRoot":"","sources":["../../src/finance-company/finance-company.ts"],"names":[],"mappings":";;;AAAA,2CAAqD;AAErD,qDAAyE;AAEzE,iCAAiC;AACjC,iCAA0B;AAC1B,qDAAsD;AAEtD,MAAa,cAAc;IAMzB,YACE,sBAA8C,EAC9C,2BAAwD,EACxD,gBAAgC;QAEhC,IAAI,CAAC,2BAA2B,GAAG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f,UAAU,EAAE,MAAM;YAClB,mBAAmB,EAAE,GAAG;YACxB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;QAEnE,MAAM,OAAO,GAAG;YACd,MAAM,EAAE,QAAQ;YAChB,QAAQ,EAAE,oBAAoB;YAC9B,WAAW,EAAE,sBAAsB,oBAAoB,CAAC,cAAc,oBAAoB;YAC1F,UAAU,EAAE,OAAO,iCAAiB;YACpC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACrC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC;YACtD,aAAa,EAAE,MAAM;YACrB,WAAW,EAAE,IAAI,IAAI,EAAE;YACvB,QAAQ,EAAE,oBAAoB,CAAC,cAAc;SAC9C,CAAC;QAEF,MAAM,eAAK,CAAC,IAAI,CACd,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,qBAAqB,EAClD,OAAO,CACR,CAAC;IACJ,CAAC;CACF;AAtFD,wCAsFC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FinanceCompany = void 0;
|
|
4
|
+
const finance_company_1 = require("./finance-company");
|
|
5
|
+
Object.defineProperty(exports, "FinanceCompany", { enumerable: true, get: function () { return finance_company_1.FinanceCompany; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/finance-company/index.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AAE1C,+FAFA,gCAAc,OAEA"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -20,6 +20,9 @@ __exportStar(require("./customer"), exports);
|
|
|
20
20
|
__exportStar(require("./enum"), exports);
|
|
21
21
|
__exportStar(require("./interfaces"), exports);
|
|
22
22
|
__exportStar(require("./payment"), exports);
|
|
23
|
+
__exportStar(require("./ledger-transaction"), exports);
|
|
24
|
+
__exportStar(require("./journal-entry"), exports);
|
|
25
|
+
__exportStar(require("./finance-company"), exports);
|
|
23
26
|
var config_1 = require("./config");
|
|
24
27
|
Object.defineProperty(exports, "getConfig", { enumerable: true, get: function () { return config_1.getConfig; } });
|
|
25
28
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,yCAAuB;AACvB,+CAA6B;AAC7B,4CAA0B;AAC1B,mCAAqC;AAA5B,mGAAA,SAAS,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,yCAAuB;AACvB,+CAA6B;AAC7B,4CAA0B;AAC1B,uDAAqC;AACrC,kDAAgC;AAChC,oDAAkC;AAClC,mCAAqC;AAA5B,mGAAA,SAAS,OAAA"}
|
|
@@ -9,4 +9,5 @@ export interface IAccountSystem {
|
|
|
9
9
|
createCustomer(payload: any): Promise<any>;
|
|
10
10
|
makePayment(customer: Customer, paymentInfo: Payment): Promise<any>;
|
|
11
11
|
collectPayments(customer: Customer, paymentInfo: Payment): Promise<any>;
|
|
12
|
+
postJournalEntry(payload: any): Promise<any>;
|
|
12
13
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { LedgerTransactionModel } from 'src/ledger-transaction';
|
|
3
|
+
export declare class JournalEntryModel extends Model {
|
|
4
|
+
JournalEntryId: string;
|
|
5
|
+
Date: Date;
|
|
6
|
+
Name: string;
|
|
7
|
+
Description: string;
|
|
8
|
+
PostedById: string;
|
|
9
|
+
PostedToAccSystemYN: string;
|
|
10
|
+
DatePostedToAccSystem: Date;
|
|
11
|
+
LedgerTransactions: LedgerTransactionModel[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.JournalEntryModel = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
15
|
+
const ledger_transaction_1 = require("src/ledger-transaction");
|
|
16
|
+
let JournalEntryModel = class JournalEntryModel extends sequelize_typescript_1.Model {
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, swagger_1.ApiProperty)({ type: String, description: 'JournalEntryId' }),
|
|
20
|
+
(0, sequelize_typescript_1.Column)({
|
|
21
|
+
primaryKey: true,
|
|
22
|
+
allowNull: false,
|
|
23
|
+
type: sequelize_typescript_1.DataType.STRING(30),
|
|
24
|
+
}),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], JournalEntryModel.prototype, "JournalEntryId", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, swagger_1.ApiProperty)({ type: Date, description: 'Date' }),
|
|
29
|
+
(0, sequelize_typescript_1.Column)({
|
|
30
|
+
allowNull: true,
|
|
31
|
+
type: sequelize_typescript_1.DataType.DATE,
|
|
32
|
+
}),
|
|
33
|
+
__metadata("design:type", Date)
|
|
34
|
+
], JournalEntryModel.prototype, "Date", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, swagger_1.ApiProperty)({
|
|
37
|
+
type: String,
|
|
38
|
+
description: 'Name of the journal entry',
|
|
39
|
+
}),
|
|
40
|
+
(0, sequelize_typescript_1.Column)({
|
|
41
|
+
allowNull: false,
|
|
42
|
+
type: sequelize_typescript_1.DataType.STRING(200),
|
|
43
|
+
}),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], JournalEntryModel.prototype, "Name", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, swagger_1.ApiProperty)({
|
|
48
|
+
type: String,
|
|
49
|
+
description: 'Description of the journal entry',
|
|
50
|
+
}),
|
|
51
|
+
(0, sequelize_typescript_1.Column)({
|
|
52
|
+
allowNull: true,
|
|
53
|
+
type: sequelize_typescript_1.DataType.STRING(1000),
|
|
54
|
+
}),
|
|
55
|
+
__metadata("design:type", String)
|
|
56
|
+
], JournalEntryModel.prototype, "Description", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, swagger_1.ApiProperty)({
|
|
59
|
+
example: '138140891dd211b288d34bc7b4312a49',
|
|
60
|
+
description: 'PostedById',
|
|
61
|
+
}),
|
|
62
|
+
(0, sequelize_typescript_1.Column)({ allowNull: false, type: sequelize_typescript_1.DataType.STRING(30) }),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], JournalEntryModel.prototype, "PostedById", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, swagger_1.ApiProperty)({
|
|
67
|
+
type: String,
|
|
68
|
+
description: 'PostedToAccSystemYN',
|
|
69
|
+
}),
|
|
70
|
+
(0, sequelize_typescript_1.Column)({
|
|
71
|
+
allowNull: false,
|
|
72
|
+
type: sequelize_typescript_1.DataType.CHAR(1),
|
|
73
|
+
}),
|
|
74
|
+
__metadata("design:type", String)
|
|
75
|
+
], JournalEntryModel.prototype, "PostedToAccSystemYN", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, swagger_1.ApiProperty)({
|
|
78
|
+
example: new Date(),
|
|
79
|
+
description: 'PostedToAccSystem Date',
|
|
80
|
+
}),
|
|
81
|
+
(0, sequelize_typescript_1.Column)({
|
|
82
|
+
allowNull: true,
|
|
83
|
+
type: sequelize_typescript_1.DataType.DATE,
|
|
84
|
+
}),
|
|
85
|
+
__metadata("design:type", Date)
|
|
86
|
+
], JournalEntryModel.prototype, "DatePostedToAccSystem", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, sequelize_typescript_1.HasMany)(() => ledger_transaction_1.LedgerTransactionModel),
|
|
89
|
+
__metadata("design:type", Array)
|
|
90
|
+
], JournalEntryModel.prototype, "LedgerTransactions", void 0);
|
|
91
|
+
JournalEntryModel = __decorate([
|
|
92
|
+
(0, sequelize_typescript_1.Table)({
|
|
93
|
+
tableName: 'finance_JournalEntry',
|
|
94
|
+
timestamps: false,
|
|
95
|
+
})
|
|
96
|
+
], JournalEntryModel);
|
|
97
|
+
exports.JournalEntryModel = JournalEntryModel;
|
|
98
|
+
//# sourceMappingURL=journal-entry.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journal-entry.entity.js","sourceRoot":"","sources":["../../../src/journal-entry/entities/journal-entry.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,+DAA+E;AAC/E,+DAAgE;AAMzD,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,4BAAK;CAiE3C,CAAA;AAhEC;IAAC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,gB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ACvB,CAAC;;8DAC0B;AAE5B;IAAC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,IAAI,IAAI,EAAE;QACnB,WAAW,EAAE,wBAAwB;KACtC,CAAC;IACD,IAAA,6BAAM,EAAC;QACN,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,+BAAQ,CAAC,IAAI;KACpB,CAAC;8BACqB,IAAI;gEAAC;AAE5B;IAAC,IAAA,8BAAO,EAAC,GAAG,EAAE,CAAC,2CAAsB,CAAC;;6DACO;AAhElC,iBAAiB;IAJ7B,IAAA,4BAAK,EAAC;QACL,SAAS,EAAE,sBAAsB;QACjC,UAAU,EAAE,KAAK;KAClB,CAAC;GACW,iBAAiB,CAiE7B;AAjEY,8CAAiB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JournalEntry } from './journal-entry';
|
|
2
|
+
import { IJournalEntryRepository } from './interfaces/journal-entry.repository.interface';
|
|
3
|
+
import { JournalEntryRepository } from './journal-entry.repository';
|
|
4
|
+
import { JournalEntryModel } from './entities/journal-entry.entity';
|
|
5
|
+
import { IJournalEntryAttr } from './interfaces/journal-entry-attr.interface';
|
|
6
|
+
export { JournalEntry, IJournalEntryRepository, JournalEntryRepository, JournalEntryModel, IJournalEntryAttr, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JournalEntryModel = exports.JournalEntryRepository = exports.JournalEntry = void 0;
|
|
4
|
+
const journal_entry_1 = require("./journal-entry");
|
|
5
|
+
Object.defineProperty(exports, "JournalEntry", { enumerable: true, get: function () { return journal_entry_1.JournalEntry; } });
|
|
6
|
+
const journal_entry_repository_1 = require("./journal-entry.repository");
|
|
7
|
+
Object.defineProperty(exports, "JournalEntryRepository", { enumerable: true, get: function () { return journal_entry_repository_1.JournalEntryRepository; } });
|
|
8
|
+
const journal_entry_entity_1 = require("./entities/journal-entry.entity");
|
|
9
|
+
Object.defineProperty(exports, "JournalEntryModel", { enumerable: true, get: function () { return journal_entry_entity_1.JournalEntryModel; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/journal-entry/index.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAO7C,6FAPO,4BAAY,OAOP;AALd,yEAAoE;AAOlE,uGAPO,iDAAsB,OAOP;AANxB,0EAAoE;AAOlE,kGAPO,wCAAiB,OAOP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journal-entry-attr.interface.js","sourceRoot":"","sources":["../../../src/journal-entry/interfaces/journal-entry-attr.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface IJournalEntryRepository<T> {
|
|
2
|
+
create?(data: T | any, options?: any): Promise<T> | any;
|
|
3
|
+
findAll?(options?: any): Promise<T[]>;
|
|
4
|
+
findAllWithPagination(options: any): Promise<{
|
|
5
|
+
count: number;
|
|
6
|
+
rows: T[];
|
|
7
|
+
}>;
|
|
8
|
+
findOne?(options: any): Promise<T>;
|
|
9
|
+
update?(data: any, options?: any): Promise<any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journal-entry.repository.interface.js","sourceRoot":"","sources":["../../../src/journal-entry/interfaces/journal-entry.repository.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { LedgerTransactionRepository } from 'src/ledger-transaction/ledger-transaction.repository';
|
|
2
|
+
import { ILedgerTransactionTypeOptionsAttr } from 'src/ledger-transaction/interfaces/ledger-transaction-attr.interface';
|
|
3
|
+
import { JournalEntryRepository } from './journal-entry.repository';
|
|
4
|
+
import { IJournalEntryAttr } from './interfaces/journal-entry-attr.interface';
|
|
5
|
+
export declare class JournalEntry {
|
|
6
|
+
JournalEntryId: string;
|
|
7
|
+
Date: Date;
|
|
8
|
+
Name: string;
|
|
9
|
+
Description: string;
|
|
10
|
+
PostedById: string;
|
|
11
|
+
PostedToAccSystemYN: string;
|
|
12
|
+
DatePosted?: string;
|
|
13
|
+
journalEntryRepository: JournalEntryRepository;
|
|
14
|
+
ledgerTransactionRepository: LedgerTransactionRepository;
|
|
15
|
+
private _DebitTransactions;
|
|
16
|
+
private _CreditTransactions;
|
|
17
|
+
constructor(journalEntryRepository: JournalEntryRepository, ledgerTransactionRepository: LedgerTransactionRepository);
|
|
18
|
+
get DebitTransactions(): any;
|
|
19
|
+
get CreditTransactions(): any;
|
|
20
|
+
init(params: IJournalEntryAttr): void;
|
|
21
|
+
getData(): {
|
|
22
|
+
JournalEntryId: string;
|
|
23
|
+
Date: Date;
|
|
24
|
+
Name: string;
|
|
25
|
+
Description: string;
|
|
26
|
+
PostedById: string;
|
|
27
|
+
PostedToAccSystemYN: string;
|
|
28
|
+
DatePosted: string;
|
|
29
|
+
};
|
|
30
|
+
create(): Promise<any>;
|
|
31
|
+
newLedgerTransaction({ transactionType, }: ILedgerTransactionTypeOptionsAttr): Promise<any>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JournalEntry = void 0;
|
|
4
|
+
const ledger_transaction_1 = require("src/ledger-transaction");
|
|
5
|
+
const enum_1 = require("src/enum");
|
|
6
|
+
const sequelize_1 = require("sequelize");
|
|
7
|
+
class JournalEntry {
|
|
8
|
+
constructor(journalEntryRepository, ledgerTransactionRepository) {
|
|
9
|
+
this._DebitTransactions = null;
|
|
10
|
+
this._CreditTransactions = null;
|
|
11
|
+
this.ledgerTransactionRepository = ledgerTransactionRepository;
|
|
12
|
+
this.journalEntryRepository = journalEntryRepository;
|
|
13
|
+
}
|
|
14
|
+
get DebitTransactions() {
|
|
15
|
+
if (this._DebitTransactions === null) {
|
|
16
|
+
if (this.JournalEntryId !== 'New') {
|
|
17
|
+
this.ledgerTransactionRepository
|
|
18
|
+
.findAll({
|
|
19
|
+
where: {
|
|
20
|
+
JournalEntryId: {
|
|
21
|
+
[sequelize_1.Op.ne]: 'New',
|
|
22
|
+
},
|
|
23
|
+
TransactionType: enum_1.TransactionTypeOptions.Debit,
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
.then((allDebitTransactions) => {
|
|
27
|
+
return allDebitTransactions;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return this._DebitTransactions;
|
|
32
|
+
}
|
|
33
|
+
get CreditTransactions() {
|
|
34
|
+
if (this._CreditTransactions === null) {
|
|
35
|
+
if (this.JournalEntryId !== 'New') {
|
|
36
|
+
this.ledgerTransactionRepository
|
|
37
|
+
.findAll({
|
|
38
|
+
where: {
|
|
39
|
+
JournalEntryId: {
|
|
40
|
+
[sequelize_1.Op.ne]: 'New',
|
|
41
|
+
},
|
|
42
|
+
TransactionType: enum_1.TransactionTypeOptions.Credit,
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
.then((allCreditTransactions) => {
|
|
46
|
+
return allCreditTransactions;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return this._CreditTransactions;
|
|
51
|
+
}
|
|
52
|
+
init(params) {
|
|
53
|
+
this.JournalEntryId = params.JournalEntryId;
|
|
54
|
+
this.Date = params.Date;
|
|
55
|
+
this.Name = params.Name;
|
|
56
|
+
this.Description = params.Description;
|
|
57
|
+
this.PostedById = params.PostedById;
|
|
58
|
+
this.PostedToAccSystemYN = params.PostedToAccSystemYN;
|
|
59
|
+
this.DatePosted = params.DatePosted;
|
|
60
|
+
}
|
|
61
|
+
getData() {
|
|
62
|
+
return {
|
|
63
|
+
JournalEntryId: this.JournalEntryId,
|
|
64
|
+
Date: this.Date,
|
|
65
|
+
Name: this.Name,
|
|
66
|
+
Description: this.Description,
|
|
67
|
+
PostedById: this.PostedById,
|
|
68
|
+
PostedToAccSystemYN: this.PostedToAccSystemYN,
|
|
69
|
+
DatePosted: this.DatePosted,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
async create() {
|
|
73
|
+
return await this.journalEntryRepository.create(this.getData);
|
|
74
|
+
}
|
|
75
|
+
async newLedgerTransaction({ transactionType, }) {
|
|
76
|
+
this.init({
|
|
77
|
+
JournalEntryId: 'New',
|
|
78
|
+
Date: new Date(),
|
|
79
|
+
Name: '',
|
|
80
|
+
Description: '',
|
|
81
|
+
PostedById: '',
|
|
82
|
+
PostedToAccSystemYN: 'N',
|
|
83
|
+
DatePosted: null,
|
|
84
|
+
});
|
|
85
|
+
const ledgerTransaction = new ledger_transaction_1.LedgerTransaction(this.ledgerTransactionRepository);
|
|
86
|
+
const newLedgerTransaction = await ledgerTransaction.newLedgerTransaction({ transactionType }, this.JournalEntryId);
|
|
87
|
+
if (transactionType === enum_1.TransactionTypeOptions.Debit) {
|
|
88
|
+
this.DebitTransactions;
|
|
89
|
+
}
|
|
90
|
+
else if (transactionType === enum_1.TransactionTypeOptions.Credit) {
|
|
91
|
+
this.CreditTransactions;
|
|
92
|
+
}
|
|
93
|
+
return newLedgerTransaction;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.JournalEntry = JournalEntry;
|
|
97
|
+
//# sourceMappingURL=journal-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journal-entry.js","sourceRoot":"","sources":["../../src/journal-entry/journal-entry.ts"],"names":[],"mappings":";;;AACA,+DAA2D;AAI3D,mCAAkD;AAClD,yCAA+B;AAE/B,MAAa,YAAY;IAevB,YACE,sBAA8C,EAC9C,2BAAwD;QALlD,uBAAkB,GAAQ,IAAI,CAAC;QAC/B,wBAAmB,GAAQ,IAAI,CAAC;QAMtC,IAAI,CAAC,2BAA2B,GAAG,2BAA2B,CAAC;QAC/D,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;IACvD,CAAC;IA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oB,CAAC;IAC9B,CAAC;CACF;AA/HD,oCA+HC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JournalEntryModel } from './entities/journal-entry.entity';
|
|
2
|
+
import { IJournalEntryRepository } from './interfaces/journal-entry.repository.interface';
|
|
3
|
+
import { IJournalEntryAttr } from './interfaces/journal-entry-attr.interface';
|
|
4
|
+
export declare class JournalEntryRepository implements IJournalEntryRepository<JournalEntryModel> {
|
|
5
|
+
private readonly journalEntryModel;
|
|
6
|
+
constructor(journalEntryModel: typeof JournalEntryModel);
|
|
7
|
+
create(data: IJournalEntryAttr | any, options?: any): Promise<JournalEntryModel> | any;
|
|
8
|
+
findAll(options?: any): Promise<JournalEntryModel[]>;
|
|
9
|
+
findAllWithPagination(options: any): Promise<{
|
|
10
|
+
count: number;
|
|
11
|
+
rows: JournalEntryModel[];
|
|
12
|
+
}>;
|
|
13
|
+
findOne(options: any): Promise<JournalEntryModel>;
|
|
14
|
+
update(data: IJournalEntryAttr, options?: any): any;
|
|
15
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.JournalEntryRepository = void 0;
|
|
16
|
+
const sequelize_1 = require("@nestjs/sequelize");
|
|
17
|
+
const journal_entry_entity_1 = require("./entities/journal-entry.entity");
|
|
18
|
+
let JournalEntryRepository = class JournalEntryRepository {
|
|
19
|
+
constructor(journalEntryModel) {
|
|
20
|
+
this.journalEntryModel = journalEntryModel;
|
|
21
|
+
}
|
|
22
|
+
create(data, options) {
|
|
23
|
+
return this.journalEntryModel.create(data, options);
|
|
24
|
+
}
|
|
25
|
+
findAll(options) {
|
|
26
|
+
return this.journalEntryModel.findAll(options);
|
|
27
|
+
}
|
|
28
|
+
findAllWithPagination(options) {
|
|
29
|
+
return this.journalEntryModel.findAndCountAll(options);
|
|
30
|
+
}
|
|
31
|
+
findOne(options) {
|
|
32
|
+
return this.journalEntryModel.findOne(options);
|
|
33
|
+
}
|
|
34
|
+
update(data, options) {
|
|
35
|
+
return this.journalEntryModel.update(Object.assign({}, data), options);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
JournalEntryRepository = __decorate([
|
|
39
|
+
__param(0, (0, sequelize_1.InjectModel)(journal_entry_entity_1.JournalEntryModel)),
|
|
40
|
+
__metadata("design:paramtypes", [Object])
|
|
41
|
+
], JournalEntryRepository);
|
|
42
|
+
exports.JournalEntryRepository = JournalEntryRepository;
|
|
43
|
+
//# sourceMappingURL=journal-entry.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journal-entry.repository.js","sourceRoot":"","sources":["../../src/journal-entry/journal-entry.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iDAAgD;AAChD,0EAAoE;AAI7D,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAGjC,YAEmB,iBAA2C;QAA3C,sBAAiB,GAAjB,iBAAiB,CAA0B;IAC3D,CAAC;IAEJ,MAAM,CACJ,IAA6B,EAC7B,OAAa;QAEb,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,CAAC,OAAa;QACnB,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,qBAAqB,CACnB,OAAY;QAEZ,OAAO,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,CAAC,OAAY;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,CAAC,IAAuB,EAAE,OAAa;QAC3C,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,mBAAM,IAAI,GAAI,OAAO,CAAC,CAAC;IAC7D,CAAC;CACF,CAAA;AAhCY,sBAAsB;IAI9B,WAAA,IAAA,uBAAW,EAAC,wCAAiB,CAAC,CAAA;;GAJtB,sBAAsB,CAgClC;AAhCY,wDAAsB"}
|