@tomei/finance 0.2.1 → 0.2.3
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/account.d.ts +21 -14
- package/dist/account/account.js +81 -95
- package/dist/account/account.js.map +1 -1
- package/dist/account/entities/account.entity.d.ts +8 -0
- package/dist/account/entities/account.entity.js +72 -5
- package/dist/account/entities/account.entity.js.map +1 -1
- package/dist/document/document-item.repository.d.ts +17 -0
- package/dist/document/document-item.repository.js +51 -0
- package/dist/document/document-item.repository.js.map +1 -0
- package/dist/document/document.repository.d.ts +16 -0
- package/dist/document/document.repository.js +47 -0
- package/dist/document/document.repository.js.map +1 -0
- package/dist/document/entities/document-item.entity.d.ts +24 -0
- package/dist/document/entities/document-item.entity.js +153 -0
- package/dist/document/entities/document-item.entity.js.map +1 -0
- package/dist/document/entities/document.entity.d.ts +22 -0
- package/dist/document/entities/document.entity.js +139 -0
- package/dist/document/entities/document.entity.js.map +1 -0
- package/dist/document/index.d.ts +9 -0
- package/dist/document/index.js +16 -0
- package/dist/document/index.js.map +1 -0
- package/dist/document/interfaces/document-attr.interface.d.ts +19 -0
- package/dist/document/interfaces/document-attr.interface.js +7 -0
- package/dist/document/interfaces/document-attr.interface.js.map +1 -0
- package/dist/document/interfaces/document-item-attr.interface.d.ts +19 -0
- package/dist/document/interfaces/document-item-attr.interface.js +7 -0
- package/dist/document/interfaces/document-item-attr.interface.js.map +1 -0
- package/dist/document/interfaces/document-item.repository.interface.d.ts +3 -0
- package/dist/document/interfaces/document-item.repository.interface.js +3 -0
- package/dist/document/interfaces/document-item.repository.interface.js.map +1 -0
- package/dist/document/interfaces/document.repository.interface.d.ts +3 -0
- package/dist/document/interfaces/document.repository.interface.js +3 -0
- package/dist/document/interfaces/document.repository.interface.js.map +1 -0
- package/dist/enum/document-status.enum.d.ts +4 -0
- package/dist/enum/document-status.enum.js +9 -0
- package/dist/enum/document-status.enum.js.map +1 -0
- package/dist/enum/document-type.enum.d.ts +7 -0
- package/dist/enum/document-type.enum.js +12 -0
- package/dist/enum/document-type.enum.js.map +1 -0
- package/dist/enum/index.d.ts +3 -1
- package/dist/enum/index.js +5 -1
- package/dist/enum/index.js.map +1 -1
- package/dist/finance-company/finance-company.d.ts +2 -0
- package/dist/finance-company/finance-company.js +32 -0
- package/dist/finance-company/finance-company.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/migrations/finance-account-migration.js +83 -59
- package/migrations/finance-document-item-migration.js +99 -0
- package/migrations/finance-document-migration.js +77 -0
- package/package.json +2 -2
- package/src/account/account.ts +105 -145
- package/src/account/entities/account.entity.ts +66 -6
- package/src/document/document-item.repository.ts +49 -0
- package/src/document/document.repository.ts +41 -0
- package/src/document/entities/document-item.entity.ts +125 -0
- package/src/document/entities/document.entity.ts +106 -0
- package/src/document/index.ts +19 -0
- package/src/document/interfaces/document-attr.interface.ts +20 -0
- package/src/document/interfaces/document-item-attr.interface.ts +19 -0
- package/src/document/interfaces/document-item.repository.interface.ts +4 -0
- package/src/document/interfaces/document.repository.interface.ts +4 -0
- package/src/enum/document-status.enum.ts +4 -0
- package/src/enum/document-type.enum.ts +7 -0
- package/src/enum/index.ts +10 -1
- package/src/finance-company/finance-company.ts +54 -0
|
@@ -1,24 +1,31 @@
|
|
|
1
|
-
import { ICreateAccountAttr } from './interfaces/account-attr.interface';
|
|
2
1
|
import { IAccountRepository } from './interfaces/account.repository.interface';
|
|
3
|
-
import {
|
|
2
|
+
import { AccountModel } from './entities/account.entity';
|
|
4
3
|
import { ObjectBase, PersonBase } from '@tomei/general';
|
|
5
4
|
export declare class Account {
|
|
6
5
|
accountRepository: IAccountRepository;
|
|
7
|
-
|
|
6
|
+
AccountNo: string;
|
|
7
|
+
Owner: PersonBase;
|
|
8
|
+
RelatedObject: ObjectBase;
|
|
9
|
+
private isNewRecord;
|
|
8
10
|
private OwnerId;
|
|
9
11
|
private OwnerType;
|
|
10
12
|
private RelatedObjectId;
|
|
11
13
|
private RelatedObjectType;
|
|
12
|
-
private
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
constructor(
|
|
21
|
-
|
|
14
|
+
private ParentAccountNo;
|
|
15
|
+
private SystemCode;
|
|
16
|
+
private AccSystemAccountId;
|
|
17
|
+
private AccSystemCode;
|
|
18
|
+
private Name;
|
|
19
|
+
private Description;
|
|
20
|
+
private AccountType;
|
|
21
|
+
private AccountSubtype;
|
|
22
|
+
constructor();
|
|
23
|
+
get name(): string;
|
|
24
|
+
get accountType(): string;
|
|
25
|
+
get accountSubType(): string;
|
|
26
|
+
get parentAccountNo(): string;
|
|
27
|
+
validateAccountValue(): void;
|
|
28
|
+
isParentAccountExsits(): boolean;
|
|
29
|
+
save(accSystemAccountId: string, userId: string, dbTransaction?: any): Promise<AccountModel>;
|
|
22
30
|
getAccountNo(): Promise<string>;
|
|
23
|
-
create(): Promise<any>;
|
|
24
31
|
}
|
package/dist/account/account.js
CHANGED
|
@@ -1,40 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Account = void 0;
|
|
4
|
-
const
|
|
5
|
-
const account_entity_1 = require("./entities/account.entity");
|
|
6
|
-
const axios_1 = require("axios");
|
|
7
|
-
const config_1 = require("../config");
|
|
4
|
+
const general_1 = require("@tomei/general");
|
|
8
5
|
class Account {
|
|
9
|
-
constructor(accountRepository,
|
|
10
|
-
this.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.
|
|
6
|
+
constructor(accountRepository, accountNo) {
|
|
7
|
+
this.isNewRecord = true;
|
|
8
|
+
if (accountRepository && accountNo) {
|
|
9
|
+
this.accountRepository = accountRepository;
|
|
10
|
+
this.AccountNo = accountNo;
|
|
11
|
+
const accountData = this.accountRepository.findOne({
|
|
12
|
+
where: { AccountNo: accountNo },
|
|
13
|
+
});
|
|
14
|
+
if (accountData) {
|
|
15
|
+
this.isNewRecord = false;
|
|
16
|
+
this.ParentAccountNo = accountData.ParentAccountNo;
|
|
17
|
+
this.SystemCode = accountData.SystemCode;
|
|
18
|
+
this.AccSystemCode = accountData.AccSystemCode;
|
|
19
|
+
this.AccSystemAccountId = accountData.AccSystemAccountId;
|
|
20
|
+
this.Name = accountData.Name;
|
|
21
|
+
this.Description = accountData.Description;
|
|
22
|
+
this.AccountType = accountData.AccountType;
|
|
23
|
+
this.AccountSubtype = accountData.AccountSubtype;
|
|
24
|
+
this.OwnerId = accountData.OwnerId;
|
|
25
|
+
this.OwnerType = accountData.OwnerType;
|
|
26
|
+
this.RelatedObjectId = accountData.RelatedObjectId;
|
|
27
|
+
this.RelatedObjectType = accountData.RelatedObjectType;
|
|
28
|
+
this.AccSystemCode = accountData.AccSystemCode;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
const notFoundError = new general_1.RecordNotFoundError('No Record Found.');
|
|
32
|
+
throw notFoundError;
|
|
33
|
+
}
|
|
15
34
|
}
|
|
35
|
+
else if (accountRepository || accountNo) {
|
|
36
|
+
throw new Error('AccountNo and AccountRepository both are required.');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
get name() {
|
|
40
|
+
return this.Name;
|
|
41
|
+
}
|
|
42
|
+
get accountType() {
|
|
43
|
+
return this.AccountType;
|
|
16
44
|
}
|
|
17
|
-
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
45
|
+
get accountSubType() {
|
|
46
|
+
return this.AccountSubtype;
|
|
47
|
+
}
|
|
48
|
+
get parentAccountNo() {
|
|
49
|
+
return this.ParentAccountNo;
|
|
50
|
+
}
|
|
51
|
+
validateAccountValue() {
|
|
52
|
+
if (!this.SystemCode) {
|
|
53
|
+
throw new Error('SystemCode is required.');
|
|
54
|
+
}
|
|
55
|
+
if (!this.AccSystemCode) {
|
|
56
|
+
throw new Error('AccSystemCode is required.');
|
|
25
57
|
}
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
if (params.AccountSubType)
|
|
29
|
-
this.AccountSubType = params.AccountSubType;
|
|
30
|
-
if (params.ParentAccountNo)
|
|
31
|
-
this.ParentAccountNo = params.ParentAccountNo;
|
|
32
|
-
if (this.Owner &&
|
|
33
|
-
this.RelatedObject &&
|
|
34
|
-
this.AccountType &&
|
|
35
|
-
this.AccountSubType) {
|
|
36
|
-
this.isParamsInitialized = true;
|
|
58
|
+
if (!this.AccSystemAccountId) {
|
|
59
|
+
throw new Error('AccSystemAccountId is required.');
|
|
37
60
|
}
|
|
61
|
+
if (!this.AccountType) {
|
|
62
|
+
throw new Error('AccountType is required.');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
isParentAccountExsits() {
|
|
66
|
+
if (this.ParentAccountNo)
|
|
67
|
+
return true;
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
async save(accSystemAccountId, userId, dbTransaction) {
|
|
71
|
+
this.AccSystemAccountId = accSystemAccountId;
|
|
72
|
+
const data = await this.accountRepository.create({
|
|
73
|
+
AccountNo: this.AccountNo,
|
|
74
|
+
SystemCode: this.SystemCode,
|
|
75
|
+
AccSystemCode: this.AccSystemCode,
|
|
76
|
+
AccSystemAccountId: this.AccSystemAccountId,
|
|
77
|
+
Name: this.Name,
|
|
78
|
+
Description: this.Description,
|
|
79
|
+
AccountType: this.AccountType,
|
|
80
|
+
AccountSubtype: this.AccountSubtype,
|
|
81
|
+
OwnerId: this.OwnerId,
|
|
82
|
+
OwnerType: this.OwnerType,
|
|
83
|
+
RelatedObjectId: this.RelatedObjectId,
|
|
84
|
+
RelatedObjectType: this.RelatedObjectType,
|
|
85
|
+
CreatedAt: new Date(),
|
|
86
|
+
CreatedById: userId,
|
|
87
|
+
}, dbTransaction);
|
|
88
|
+
return data;
|
|
38
89
|
}
|
|
39
90
|
async getAccountNo() {
|
|
40
91
|
if (this.AccountNo) {
|
|
@@ -44,7 +95,7 @@ class Account {
|
|
|
44
95
|
try {
|
|
45
96
|
const account = await this.accountRepository.findOne({
|
|
46
97
|
OwnerId: this.OwnerId,
|
|
47
|
-
|
|
98
|
+
AccSystemAccountId: this.AccSystemAccountId,
|
|
48
99
|
});
|
|
49
100
|
if (account) {
|
|
50
101
|
this.AccountNo = account.AccountNo;
|
|
@@ -59,71 +110,6 @@ class Account {
|
|
|
59
110
|
}
|
|
60
111
|
}
|
|
61
112
|
}
|
|
62
|
-
async create() {
|
|
63
|
-
try {
|
|
64
|
-
if (!this.Owner || !this.RelatedObject) {
|
|
65
|
-
throw new Error('Owner must be set before creating an account." or "RelatedObject must be set before creating an account.');
|
|
66
|
-
}
|
|
67
|
-
if (!this.isParamsInitialized) {
|
|
68
|
-
throw new Error('Account parameters must be initialized before creating an account.');
|
|
69
|
-
}
|
|
70
|
-
const ownerData = this.Owner.getDetails();
|
|
71
|
-
if (!ownerData) {
|
|
72
|
-
throw new Error('Please save owner information in the database before creating an account');
|
|
73
|
-
}
|
|
74
|
-
let isFull = true;
|
|
75
|
-
for (const key in ownerData) {
|
|
76
|
-
if (ownerData.hasOwnProperty(key)) {
|
|
77
|
-
if (!ownerData[key]) {
|
|
78
|
-
isFull = false;
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (!isFull) {
|
|
84
|
-
throw new Error('Please save owner information in the database before creating an account');
|
|
85
|
-
}
|
|
86
|
-
let createAccountPayload = {
|
|
87
|
-
Name: this.Owner.FullName,
|
|
88
|
-
AcctNum: uniqid(),
|
|
89
|
-
AccountType: this.AccountType,
|
|
90
|
-
AccountSubType: this.AccountSubType,
|
|
91
|
-
};
|
|
92
|
-
if (this.ParentAccountNo) {
|
|
93
|
-
createAccountPayload = Object.assign(Object.assign({}, createAccountPayload), { CurrencyRef: 'MYR', ParentRef: this.ParentAccountNo, SubAccount: true });
|
|
94
|
-
}
|
|
95
|
-
const accountId = await this.AccountingSystem.createAccount(createAccountPayload);
|
|
96
|
-
const account = await this.accountRepository.create({
|
|
97
|
-
AccountNo: accountId,
|
|
98
|
-
SystemCode: this.AccSystemId,
|
|
99
|
-
Name: this.Owner.FullName,
|
|
100
|
-
OwnerId: this.OwnerId,
|
|
101
|
-
OwnerType: this.OwnerType,
|
|
102
|
-
RelatedObjectId: this.RelatedObjectId,
|
|
103
|
-
RelatedObjectType: this.RelatedObjectType,
|
|
104
|
-
CreatedAt: new Date(),
|
|
105
|
-
CreatedById: 'System',
|
|
106
|
-
UpdatedAt: new Date(),
|
|
107
|
-
UpdatedById: 'System',
|
|
108
|
-
});
|
|
109
|
-
const payload = {
|
|
110
|
-
Action: 'Create',
|
|
111
|
-
Activity: 'Account Created',
|
|
112
|
-
Description: `Account (ID: ${account.AccountNo}) has been created`,
|
|
113
|
-
EntityType: typeof account_entity_1.AccountModel,
|
|
114
|
-
EntityValueBefore: JSON.stringify({}),
|
|
115
|
-
EntityValueAfter: JSON.stringify(account),
|
|
116
|
-
PerformedById: account.CreatedById,
|
|
117
|
-
PerformedAt: new Date(),
|
|
118
|
-
EntityId: account.AccountNo,
|
|
119
|
-
};
|
|
120
|
-
await axios_1.default.post(`${process.env.COMMON_API_URL}/activity-histories`, payload);
|
|
121
|
-
return account;
|
|
122
|
-
}
|
|
123
|
-
catch (error) {
|
|
124
|
-
throw error;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
113
|
}
|
|
128
114
|
exports.Account = Account;
|
|
129
115
|
//# sourceMappingURL=account.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/account/account.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/account/account.ts"],"names":[],"mappings":";;;AAEA,4CAA6E;AAE7E,MAAa,OAAO;IAqBlB,YACE,iBAAiD,EACjD,SAAkB;QAjBZ,gBAAW,GAAG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,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,WAAW,EAAE,MAAM;SACpB,EACD,aAAa,CACd,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IAMD,KAAK,CAAC,YAAY;QAChB,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,OAAO,IAAI,CAAC,SAAS,CAAC;SACvB;aAAM;YACL,IAAI;gBACF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC;oBACnD,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;iBAC5C,CAAC,CAAC;gBAEH,IAAI,OAAO,EAAE;oBACX,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;oBACnC,OAAO,IAAI,CAAC,SAAS,CAAC;iBACvB;qBAAM;oBACL,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;iBACtD;aACF;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,KAAK,CAAC;aACb;SACF;IACH,CAAC;CACF;AAhJD,0BAgJC"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { Model } from 'sequelize-typescript';
|
|
2
2
|
import { LedgerTransactionModel } from 'src/ledger-transaction/entities/ledger-transaction.entity';
|
|
3
3
|
import { PaymentModel } from '../../payment/entities/payment.entity';
|
|
4
|
+
import { DocumentItemModel } from '../../document/entities/document-item.entity';
|
|
4
5
|
export declare class AccountModel extends Model {
|
|
5
6
|
AccountNo: string;
|
|
7
|
+
ParentAccountNo: string;
|
|
6
8
|
SystemCode: string;
|
|
9
|
+
AccSystemCode: string;
|
|
10
|
+
AccSystemAccountId: string;
|
|
7
11
|
Name: string;
|
|
12
|
+
Description: string;
|
|
13
|
+
AccountType: string;
|
|
14
|
+
AccountSubType: string;
|
|
8
15
|
OwnerId: string;
|
|
9
16
|
OwnerType: string;
|
|
10
17
|
RelatedObjectId: string;
|
|
@@ -14,5 +21,6 @@ export declare class AccountModel extends Model {
|
|
|
14
21
|
UpdatedAt: Date;
|
|
15
22
|
UpdatedById: string;
|
|
16
23
|
Payments: PaymentModel[];
|
|
24
|
+
DocumentItems: DocumentItemModel[];
|
|
17
25
|
LedgerTransactions: LedgerTransactionModel[];
|
|
18
26
|
}
|
|
@@ -14,6 +14,7 @@ const swagger_1 = require("@nestjs/swagger");
|
|
|
14
14
|
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
15
15
|
const ledger_transaction_entity_1 = require("src/ledger-transaction/entities/ledger-transaction.entity");
|
|
16
16
|
const payment_entity_1 = require("../../payment/entities/payment.entity");
|
|
17
|
+
const document_item_entity_1 = require("../../document/entities/document-item.entity");
|
|
17
18
|
let AccountModel = class AccountModel extends sequelize_typescript_1.Model {
|
|
18
19
|
};
|
|
19
20
|
__decorate([
|
|
@@ -25,6 +26,13 @@ __decorate([
|
|
|
25
26
|
}),
|
|
26
27
|
__metadata("design:type", String)
|
|
27
28
|
], AccountModel.prototype, "AccountNo", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, swagger_1.ApiProperty)({ type: String, description: 'Parent account of this object' }),
|
|
31
|
+
(0, sequelize_typescript_1.Column)({
|
|
32
|
+
type: sequelize_typescript_1.DataType.STRING(30),
|
|
33
|
+
}),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], AccountModel.prototype, "ParentAccountNo", void 0);
|
|
28
36
|
__decorate([
|
|
29
37
|
(0, swagger_1.ApiProperty)({
|
|
30
38
|
type: String,
|
|
@@ -36,6 +44,28 @@ __decorate([
|
|
|
36
44
|
}),
|
|
37
45
|
__metadata("design:type", String)
|
|
38
46
|
], AccountModel.prototype, "SystemCode", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, swagger_1.ApiProperty)({
|
|
49
|
+
type: String,
|
|
50
|
+
description: 'Finance account system code eg. "quickbook"',
|
|
51
|
+
}),
|
|
52
|
+
(0, sequelize_typescript_1.Column)({
|
|
53
|
+
allowNull: false,
|
|
54
|
+
type: sequelize_typescript_1.DataType.STRING(10),
|
|
55
|
+
}),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], AccountModel.prototype, "AccSystemCode", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, swagger_1.ApiProperty)({
|
|
60
|
+
type: String,
|
|
61
|
+
description: 'Account id in finance system',
|
|
62
|
+
}),
|
|
63
|
+
(0, sequelize_typescript_1.Column)({
|
|
64
|
+
allowNull: false,
|
|
65
|
+
type: sequelize_typescript_1.DataType.STRING(10),
|
|
66
|
+
}),
|
|
67
|
+
__metadata("design:type", String)
|
|
68
|
+
], AccountModel.prototype, "AccSystemAccountId", void 0);
|
|
39
69
|
__decorate([
|
|
40
70
|
(0, swagger_1.ApiProperty)({
|
|
41
71
|
type: String,
|
|
@@ -47,13 +77,46 @@ __decorate([
|
|
|
47
77
|
}),
|
|
48
78
|
__metadata("design:type", String)
|
|
49
79
|
], AccountModel.prototype, "Name", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, swagger_1.ApiProperty)({
|
|
82
|
+
type: String,
|
|
83
|
+
description: 'Account description',
|
|
84
|
+
}),
|
|
85
|
+
(0, sequelize_typescript_1.Column)({
|
|
86
|
+
allowNull: true,
|
|
87
|
+
type: sequelize_typescript_1.DataType.TEXT,
|
|
88
|
+
}),
|
|
89
|
+
__metadata("design:type", String)
|
|
90
|
+
], AccountModel.prototype, "Description", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, swagger_1.ApiProperty)({
|
|
93
|
+
type: String,
|
|
94
|
+
description: 'Account Type',
|
|
95
|
+
}),
|
|
96
|
+
(0, sequelize_typescript_1.Column)({
|
|
97
|
+
allowNull: true,
|
|
98
|
+
type: sequelize_typescript_1.DataType.STRING(100),
|
|
99
|
+
}),
|
|
100
|
+
__metadata("design:type", String)
|
|
101
|
+
], AccountModel.prototype, "AccountType", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, swagger_1.ApiProperty)({
|
|
104
|
+
type: String,
|
|
105
|
+
description: 'Account Sub Type',
|
|
106
|
+
}),
|
|
107
|
+
(0, sequelize_typescript_1.Column)({
|
|
108
|
+
allowNull: true,
|
|
109
|
+
type: sequelize_typescript_1.DataType.STRING(100),
|
|
110
|
+
}),
|
|
111
|
+
__metadata("design:type", String)
|
|
112
|
+
], AccountModel.prototype, "AccountSubType", void 0);
|
|
50
113
|
__decorate([
|
|
51
114
|
(0, swagger_1.ApiProperty)({
|
|
52
115
|
type: String,
|
|
53
116
|
description: 'Owner id of the account',
|
|
54
117
|
}),
|
|
55
118
|
(0, sequelize_typescript_1.Column)({
|
|
56
|
-
allowNull:
|
|
119
|
+
allowNull: true,
|
|
57
120
|
type: sequelize_typescript_1.DataType.STRING(30),
|
|
58
121
|
}),
|
|
59
122
|
__metadata("design:type", String)
|
|
@@ -64,15 +127,15 @@ __decorate([
|
|
|
64
127
|
description: 'Owner type',
|
|
65
128
|
}),
|
|
66
129
|
(0, sequelize_typescript_1.Column)({
|
|
67
|
-
allowNull:
|
|
68
|
-
type: sequelize_typescript_1.DataType.STRING(
|
|
130
|
+
allowNull: true,
|
|
131
|
+
type: sequelize_typescript_1.DataType.STRING(200),
|
|
69
132
|
}),
|
|
70
133
|
__metadata("design:type", String)
|
|
71
134
|
], AccountModel.prototype, "OwnerType", void 0);
|
|
72
135
|
__decorate([
|
|
73
136
|
(0, swagger_1.ApiProperty)({ type: String, description: 'Associated Object id' }),
|
|
74
137
|
(0, sequelize_typescript_1.Column)({
|
|
75
|
-
allowNull:
|
|
138
|
+
allowNull: true,
|
|
76
139
|
type: sequelize_typescript_1.DataType.STRING(30),
|
|
77
140
|
}),
|
|
78
141
|
__metadata("design:type", String)
|
|
@@ -80,7 +143,7 @@ __decorate([
|
|
|
80
143
|
__decorate([
|
|
81
144
|
(0, swagger_1.ApiProperty)({ type: String, description: 'Associated Object type' }),
|
|
82
145
|
(0, sequelize_typescript_1.Column)({
|
|
83
|
-
allowNull:
|
|
146
|
+
allowNull: true,
|
|
84
147
|
type: sequelize_typescript_1.DataType.STRING(200),
|
|
85
148
|
}),
|
|
86
149
|
__metadata("design:type", String)
|
|
@@ -121,6 +184,10 @@ __decorate([
|
|
|
121
184
|
(0, sequelize_typescript_1.HasMany)(() => payment_entity_1.PaymentModel),
|
|
122
185
|
__metadata("design:type", Array)
|
|
123
186
|
], AccountModel.prototype, "Payments", void 0);
|
|
187
|
+
__decorate([
|
|
188
|
+
(0, sequelize_typescript_1.HasMany)(() => document_item_entity_1.DocumentItemModel),
|
|
189
|
+
__metadata("design:type", Array)
|
|
190
|
+
], AccountModel.prototype, "DocumentItems", void 0);
|
|
124
191
|
__decorate([
|
|
125
192
|
(0, sequelize_typescript_1.HasMany)(() => ledger_transaction_entity_1.LedgerTransactionModel),
|
|
126
193
|
__metadata("design:type", Array)
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AACrE,uFAAiF;AAE1E,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,4BAAK;CA4JtC,CAAA;AA3JC;IAAC,IAAA,qBAAW,EAAC,EAAE,IAA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DAAsB,CAAC;;wDACO;AA3JlC,YAAY;IADxB,IAAA,4BAAK,EAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;GAC/D,YAAY,CA4JxB;AA5JY,oCAAY"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseRepository } from '@tomei/general';
|
|
2
|
+
import { DocumentItemModel } from './entities/document-item.entity';
|
|
3
|
+
import { IDocumentItemAttr } from './interfaces/document-item-attr.interface';
|
|
4
|
+
import { IDocumentItemRepository } from './interfaces/document-item.repository.interface';
|
|
5
|
+
export declare class DocumentItemRepository extends BaseRepository<DocumentItemModel> implements IDocumentItemRepository {
|
|
6
|
+
private readonly documentItemModel;
|
|
7
|
+
constructor(documentItemModel: typeof DocumentItemModel);
|
|
8
|
+
create(data: IDocumentItemAttr, options?: any): Promise<DocumentItemModel> | any;
|
|
9
|
+
bulkCreate(data: IDocumentItemAttr[], options?: any): any;
|
|
10
|
+
findAll(options: any): Promise<DocumentItemModel[]>;
|
|
11
|
+
findAllWithPagination(options: any): Promise<{
|
|
12
|
+
count: number;
|
|
13
|
+
rows: DocumentItemModel[];
|
|
14
|
+
}>;
|
|
15
|
+
findOne(options: any): Promise<DocumentItemModel>;
|
|
16
|
+
update(data: IDocumentItemAttr, options?: any): any;
|
|
17
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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.DocumentItemRepository = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const sequelize_1 = require("@nestjs/sequelize");
|
|
18
|
+
const general_1 = require("@tomei/general");
|
|
19
|
+
const document_item_entity_1 = require("./entities/document-item.entity");
|
|
20
|
+
let DocumentItemRepository = class DocumentItemRepository extends general_1.BaseRepository {
|
|
21
|
+
constructor(documentItemModel) {
|
|
22
|
+
super(documentItemModel);
|
|
23
|
+
this.documentItemModel = documentItemModel;
|
|
24
|
+
}
|
|
25
|
+
create(data, options) {
|
|
26
|
+
return this.documentItemModel.create(Object.assign({}, data), options);
|
|
27
|
+
}
|
|
28
|
+
bulkCreate(data, options) {
|
|
29
|
+
const payload = [...data];
|
|
30
|
+
return this.documentItemModel.bulkCreate(payload, options);
|
|
31
|
+
}
|
|
32
|
+
findAll(options) {
|
|
33
|
+
return this.documentItemModel.findAll(options);
|
|
34
|
+
}
|
|
35
|
+
findAllWithPagination(options) {
|
|
36
|
+
return this.documentItemModel.findAndCountAll(options);
|
|
37
|
+
}
|
|
38
|
+
findOne(options) {
|
|
39
|
+
return this.documentItemModel.findOne(options);
|
|
40
|
+
}
|
|
41
|
+
update(data, options) {
|
|
42
|
+
return this.documentItemModel.update(Object.assign({}, data), options);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
DocumentItemRepository = __decorate([
|
|
46
|
+
(0, common_1.Injectable)(),
|
|
47
|
+
__param(0, (0, sequelize_1.InjectModel)(document_item_entity_1.DocumentItemModel)),
|
|
48
|
+
__metadata("design:paramtypes", [Object])
|
|
49
|
+
], DocumentItemRepository);
|
|
50
|
+
exports.DocumentItemRepository = DocumentItemRepository;
|
|
51
|
+
//# sourceMappingURL=document-item.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-item.repository.js","sourceRoot":"","sources":["../../src/document/document-item.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iDAAgD;AAChD,4CAAgD;AAChD,0EAAoE;AAK7D,IAAM,sBAAsB,GAA5B,MAAM,sBACX,SAAQ,wBAAiC;IAGzC,YAEmB,iBAA2C;QAE5D,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAFR,sBAAiB,GAAjB,iBAAiB,CAA0B;IAG9D,CAAC;IAED,MAAM,CACJ,IAAuB,EACvB,OAAa;QAEb,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,mBAAM,IAAI,GAAI,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,UAAU,CAAC,IAAyB,EAAE,OAAa;QACjD,MAAM,OAAO,GAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,CAAC,OAAY;QAClB,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;AAxCY,sBAAsB;IADlC,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,uBAAW,EAAC,wCAAiB,CAAC,CAAA;;GALtB,sBAAsB,CAwClC;AAxCY,wDAAsB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseRepository } from '@tomei/general';
|
|
2
|
+
import { DocumentModel } from './entities/document.entity';
|
|
3
|
+
import { IDocumentAttr } from './interfaces/document-attr.interface';
|
|
4
|
+
import { IDocumentRepository } from './interfaces/document.repository.interface';
|
|
5
|
+
export declare class DocumentRepository extends BaseRepository<DocumentModel> implements IDocumentRepository {
|
|
6
|
+
private readonly documentModel;
|
|
7
|
+
constructor(documentModel: typeof DocumentModel);
|
|
8
|
+
create(data: IDocumentAttr, options?: any): Promise<DocumentModel> | any;
|
|
9
|
+
findAll(options: any): Promise<DocumentModel[]>;
|
|
10
|
+
findAllWithPagination(options: any): Promise<{
|
|
11
|
+
count: number;
|
|
12
|
+
rows: DocumentModel[];
|
|
13
|
+
}>;
|
|
14
|
+
findOne(options: any): Promise<DocumentModel>;
|
|
15
|
+
update(data: IDocumentAttr, options?: any): any;
|
|
16
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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.DocumentRepository = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const sequelize_1 = require("@nestjs/sequelize");
|
|
18
|
+
const general_1 = require("@tomei/general");
|
|
19
|
+
const document_entity_1 = require("./entities/document.entity");
|
|
20
|
+
let DocumentRepository = class DocumentRepository extends general_1.BaseRepository {
|
|
21
|
+
constructor(documentModel) {
|
|
22
|
+
super(documentModel);
|
|
23
|
+
this.documentModel = documentModel;
|
|
24
|
+
}
|
|
25
|
+
create(data, options) {
|
|
26
|
+
return this.documentModel.create(Object.assign({}, data), options);
|
|
27
|
+
}
|
|
28
|
+
findAll(options) {
|
|
29
|
+
return this.documentModel.findAll(options);
|
|
30
|
+
}
|
|
31
|
+
findAllWithPagination(options) {
|
|
32
|
+
return this.documentModel.findAndCountAll(options);
|
|
33
|
+
}
|
|
34
|
+
findOne(options) {
|
|
35
|
+
return this.documentModel.findOne(options);
|
|
36
|
+
}
|
|
37
|
+
update(data, options) {
|
|
38
|
+
return this.documentModel.update(Object.assign({}, data), options);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
DocumentRepository = __decorate([
|
|
42
|
+
(0, common_1.Injectable)(),
|
|
43
|
+
__param(0, (0, sequelize_1.InjectModel)(document_entity_1.DocumentModel)),
|
|
44
|
+
__metadata("design:paramtypes", [Object])
|
|
45
|
+
], DocumentRepository);
|
|
46
|
+
exports.DocumentRepository = DocumentRepository;
|
|
47
|
+
//# sourceMappingURL=document.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.repository.js","sourceRoot":"","sources":["../../src/document/document.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iDAAgD;AAChD,4CAAgD;AAChD,gEAA2D;AAKpD,IAAM,kBAAkB,GAAxB,MAAM,kBACX,SAAQ,wBAA6B;IAGrC,YAEmB,aAAmC;QAEpD,KAAK,CAAC,aAAa,CAAC,CAAC;QAFJ,kBAAa,GAAb,aAAa,CAAsB;IAGtD,CAAC;IAED,MAAM,CAAC,IAAmB,EAAE,OAAa;QACvC,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,mBAAM,IAAI,GAAI,OAAO,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,CAAC,OAAY;QAClB,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,qBAAqB,CACnB,OAAY;QAEZ,OAAO,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,CAAC,OAAY;QAClB,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,IAAmB,EAAE,OAAa;QACvC,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,mBAAM,IAAI,GAAI,OAAO,CAAC,CAAC;IACzD,CAAC;CACF,CAAA;AAhCY,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,uBAAW,EAAC,+BAAa,CAAC,CAAA;;GALlB,kBAAkB,CAgC9B;AAhCY,gDAAkB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { DocumentModel } from './document.entity';
|
|
3
|
+
import { AccountModel } from '../../account/entities/account.entity';
|
|
4
|
+
export declare class DocumentItemModel extends Model {
|
|
5
|
+
DocumentItemId: string;
|
|
6
|
+
DocNo: string;
|
|
7
|
+
Name: string;
|
|
8
|
+
NameBM: string;
|
|
9
|
+
Description: string;
|
|
10
|
+
ItemId: string;
|
|
11
|
+
ItemType: string;
|
|
12
|
+
ItemSKU: string;
|
|
13
|
+
ItemSerialNo: string;
|
|
14
|
+
Currency: string;
|
|
15
|
+
UnitPrice: number;
|
|
16
|
+
Quantity: number;
|
|
17
|
+
QuantityUOM: string;
|
|
18
|
+
Amount: number;
|
|
19
|
+
TaxCode: string;
|
|
20
|
+
DtAccountNo: string;
|
|
21
|
+
CtAccountNo: string;
|
|
22
|
+
Document: DocumentModel;
|
|
23
|
+
Account: AccountModel;
|
|
24
|
+
}
|