@tomei/finance 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/account/account.d.ts +24 -27
  2. package/dist/account/account.js +47 -67
  3. package/dist/account/account.js.map +1 -1
  4. package/dist/account/account.repository.d.ts +3 -14
  5. package/dist/account/account.repository.js +4 -39
  6. package/dist/account/account.repository.js.map +1 -1
  7. package/dist/account/interfaces/account-attr.interface.d.ts +15 -7
  8. package/dist/account-system-entity/account-system-entity.d.ts +2 -2
  9. package/dist/account-system-entity/account-system-entity.js +1 -1
  10. package/dist/account-system-entity/post-history.repository.d.ts +2 -2
  11. package/dist/account-system-entity/post-history.repository.js +1 -1
  12. package/dist/customer/customer.d.ts +3 -3
  13. package/dist/customer/customer.js +1 -2
  14. package/dist/customer/customer.js.map +1 -1
  15. package/dist/customer/finance-customer.repository.d.ts +2 -2
  16. package/dist/customer/finance-customer.repository.js +1 -1
  17. package/dist/customer/interfaces/finance-customer.repository.interface.d.ts +2 -2
  18. package/dist/document/document-item.d.ts +1 -1
  19. package/dist/document/document-item.js +1 -2
  20. package/dist/document/document-item.js.map +1 -1
  21. package/dist/document/document-item.repository.d.ts +2 -2
  22. package/dist/document/document-item.repository.js +1 -1
  23. package/dist/document/document.d.ts +14 -16
  24. package/dist/document/document.js +50 -38
  25. package/dist/document/document.js.map +1 -1
  26. package/dist/document/document.repository.d.ts +3 -14
  27. package/dist/document/document.repository.js +4 -39
  28. package/dist/document/document.repository.js.map +1 -1
  29. package/dist/document/interfaces/document-item.repository.interface.d.ts +2 -2
  30. package/dist/enum/index.d.ts +2 -1
  31. package/dist/enum/index.js +3 -1
  32. package/dist/enum/index.js.map +1 -1
  33. package/dist/enum/payment-status.enum.d.ts +4 -0
  34. package/dist/enum/payment-status.enum.js +9 -0
  35. package/dist/enum/payment-status.enum.js.map +1 -0
  36. package/dist/finance-company/finance-company.d.ts +5 -8
  37. package/dist/finance-company/finance-company.js +10 -15
  38. package/dist/finance-company/finance-company.js.map +1 -1
  39. package/dist/finance-company/finance-company.repository.d.ts +2 -2
  40. package/dist/finance-company/finance-company.repository.js +1 -1
  41. package/dist/index.d.ts +11 -8
  42. package/dist/index.js +14 -8
  43. package/dist/index.js.map +1 -1
  44. package/dist/interfaces/account-system.interface.d.ts +2 -2
  45. package/dist/journal-entry/journal-entry.d.ts +5 -7
  46. package/dist/journal-entry/journal-entry.js +8 -9
  47. package/dist/journal-entry/journal-entry.js.map +1 -1
  48. package/dist/journal-entry/journal-entry.repository.d.ts +3 -13
  49. package/dist/journal-entry/journal-entry.repository.js +5 -38
  50. package/dist/journal-entry/journal-entry.repository.js.map +1 -1
  51. package/dist/ledger-transaction/ledger-transaction.d.ts +1 -1
  52. package/dist/ledger-transaction/ledger-transaction.js +1 -2
  53. package/dist/ledger-transaction/ledger-transaction.js.map +1 -1
  54. package/dist/models/account.entity.d.ts +7 -3
  55. package/dist/models/account.entity.js +69 -34
  56. package/dist/models/account.entity.js.map +1 -1
  57. package/dist/models/finance-company.entity.d.ts +0 -4
  58. package/dist/models/finance-company.entity.js +0 -20
  59. package/dist/models/finance-company.entity.js.map +1 -1
  60. package/dist/models/payment-item.entity.d.ts +1 -0
  61. package/dist/models/payment-item.entity.js +7 -0
  62. package/dist/models/payment-item.entity.js.map +1 -1
  63. package/dist/models/payment-method-type.entity.d.ts +13 -0
  64. package/dist/models/payment-method-type.entity.js +86 -0
  65. package/dist/models/payment-method-type.entity.js.map +1 -0
  66. package/dist/models/payment-method.entity.d.ts +7 -0
  67. package/dist/models/payment-method.entity.js +46 -0
  68. package/dist/models/payment-method.entity.js.map +1 -0
  69. package/dist/models/payment.entity.d.ts +15 -10
  70. package/dist/models/payment.entity.js +92 -34
  71. package/dist/models/payment.entity.js.map +1 -1
  72. package/dist/payment/interfaces/payment-attr.interface.d.ts +11 -8
  73. package/dist/payment/interfaces/payment-attr.interface.js.map +1 -1
  74. package/dist/payment/interfaces/payment-item-attr.interface.d.ts +1 -0
  75. package/dist/payment/interfaces/payment-item-attr.interface.js.map +1 -1
  76. package/dist/payment/payment-item.repository.d.ts +3 -15
  77. package/dist/payment/payment-item.repository.js +4 -43
  78. package/dist/payment/payment-item.repository.js.map +1 -1
  79. package/dist/payment/payment.d.ts +46 -48
  80. package/dist/payment/payment.js +105 -126
  81. package/dist/payment/payment.js.map +1 -1
  82. package/dist/payment/payment.repository.d.ts +3 -14
  83. package/dist/payment/payment.repository.js +4 -39
  84. package/dist/payment/payment.repository.js.map +1 -1
  85. package/dist/payment-item/interfaces/payment-item-attr.interface.d.ts +8 -0
  86. package/dist/payment-item/interfaces/payment-item-attr.interface.js +7 -0
  87. package/dist/payment-item/interfaces/payment-item-attr.interface.js.map +1 -0
  88. package/{src/payment/interfaces/payment-item.repository.interface.ts → dist/payment-item/interfaces/payment-item.repository.interface.d.ts} +0 -1
  89. package/dist/payment-item/interfaces/payment-item.repository.interface.js +3 -0
  90. package/dist/payment-item/interfaces/payment-item.repository.interface.js.map +1 -0
  91. package/dist/payment-item/payment-item.d.ts +22 -0
  92. package/dist/payment-item/payment-item.js +42 -0
  93. package/dist/payment-item/payment-item.js.map +1 -0
  94. package/dist/payment-item/payment-item.repository.d.ts +5 -0
  95. package/dist/payment-item/payment-item.repository.js +12 -0
  96. package/dist/payment-item/payment-item.repository.js.map +1 -0
  97. package/dist/payment-method/interfaces/payment-method-attr.interface.d.ts +4 -0
  98. package/dist/payment-method/interfaces/payment-method-attr.interface.js +3 -0
  99. package/dist/payment-method/interfaces/payment-method-attr.interface.js.map +1 -0
  100. package/dist/payment-method/payment-method.d.ts +10 -0
  101. package/dist/payment-method/payment-method.js +15 -0
  102. package/dist/payment-method/payment-method.js.map +1 -0
  103. package/dist/payment-method/payment-method.repository.d.ts +5 -0
  104. package/dist/payment-method/payment-method.repository.js +12 -0
  105. package/dist/payment-method/payment-method.repository.js.map +1 -0
  106. package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.d.ts +8 -0
  107. package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.js +3 -0
  108. package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.js.map +1 -0
  109. package/dist/payment-method-type/payment-method-type.d.ts +14 -0
  110. package/dist/payment-method-type/payment-method-type.js +15 -0
  111. package/dist/payment-method-type/payment-method-type.js.map +1 -0
  112. package/dist/payment-method-type/payment-method-type.repository.d.ts +5 -0
  113. package/dist/payment-method-type/payment-method-type.repository.js +12 -0
  114. package/dist/payment-method-type/payment-method-type.repository.js.map +1 -0
  115. package/dist/tsconfig.tsbuildinfo +1 -1
  116. package/migrations/finance-account-migration.js +30 -16
  117. package/migrations/finance-company-migration.js +0 -14
  118. package/migrations/finance-payment-item-migration.js +4 -0
  119. package/migrations/finance-payment-method-migration.js +21 -0
  120. package/migrations/finance-payment-method-type-migration.js +55 -0
  121. package/migrations/finance-payment-migration.js +42 -25
  122. package/package.json +4 -4
  123. package/src/account/account.repository.ts +5 -38
  124. package/src/account/account.ts +79 -100
  125. package/src/account/interfaces/account-attr.interface.ts +15 -7
  126. package/src/account-system-entity/account-system-entity.ts +4 -4
  127. package/src/account-system-entity/post-history.repository.ts +3 -3
  128. package/src/customer/customer.ts +3 -3
  129. package/src/customer/finance-customer.repository.ts +2 -2
  130. package/src/customer/interfaces/finance-customer.repository.interface.ts +2 -2
  131. package/src/document/document-item.repository.ts +2 -2
  132. package/src/document/document-item.ts +1 -1
  133. package/src/document/document.repository.ts +5 -35
  134. package/src/document/document.ts +66 -55
  135. package/src/document/interfaces/document-item.repository.interface.ts +2 -2
  136. package/src/enum/index.ts +2 -0
  137. package/src/enum/payment-status.enum.ts +4 -0
  138. package/src/finance-company/finance-company.repository.ts +3 -3
  139. package/src/finance-company/finance-company.ts +14 -26
  140. package/src/index.ts +13 -7
  141. package/src/interfaces/account-system.interface.ts +2 -2
  142. package/src/journal-entry/journal-entry.repository.ts +5 -34
  143. package/src/journal-entry/journal-entry.ts +13 -16
  144. package/src/ledger-transaction/ledger-transaction.ts +1 -1
  145. package/src/models/account.entity.ts +67 -32
  146. package/src/models/finance-company.entity.ts +0 -16
  147. package/src/models/payment-item.entity.ts +6 -0
  148. package/src/models/payment-method-type.entity.ts +70 -0
  149. package/src/models/payment-method.entity.ts +28 -0
  150. package/src/models/payment.entity.ts +86 -31
  151. package/src/payment/interfaces/payment-attr.interface.ts +11 -8
  152. package/src/payment/payment.repository.ts +5 -35
  153. package/src/payment/payment.ts +150 -179
  154. package/src/{payment → payment-item}/interfaces/payment-item-attr.interface.ts +1 -0
  155. package/src/payment-item/payment-item.repository.ts +11 -0
  156. package/src/payment-item/payment-item.ts +58 -0
  157. package/src/payment-method/interfaces/payment-method-attr.interface.ts +4 -0
  158. package/src/payment-method/payment-method.repository.ts +11 -0
  159. package/src/payment-method/payment-method.ts +20 -0
  160. package/src/payment-method-type/interfaces/payment-method-type-attr.interface.ts +8 -0
  161. package/src/payment-method-type/payment-method-type.repository.ts +11 -0
  162. package/src/payment-method-type/payment-method-type.ts +24 -0
  163. package/src/account/interfaces/account.repository.interface.ts +0 -4
  164. package/src/document/interfaces/document.repository.interface.ts +0 -4
  165. package/src/journal-entry/interfaces/journal-entry.repository.interface.ts +0 -11
  166. package/src/payment/interfaces/payment.repository.interface.ts +0 -4
  167. package/src/payment/payment-item.repository.ts +0 -49
@@ -1,5 +1,7 @@
1
1
  import { ApiProperty } from '@nestjs/swagger';
2
2
  import {
3
+ ForeignKey,
4
+ BelongsTo,
3
5
  Column,
4
6
  CreatedAt,
5
7
  Model,
@@ -11,6 +13,7 @@ import {
11
13
  import LedgerTransactionModel from './ledger-transaction.entity';
12
14
  import PaymentModel from './payment.entity';
13
15
  import DocumentItemModel from './document-item.entity';
16
+ import FinanceCompanyModel from './finance-company.entity';
14
17
 
15
18
  @Table({ tableName: 'finance_Account', createdAt: false, updatedAt: false })
16
19
  export default class AccountModel extends Model {
@@ -22,48 +25,31 @@ export default class AccountModel extends Model {
22
25
  })
23
26
  AccountNo: string;
24
27
 
25
- @ApiProperty({ type: String, description: 'Parent account of this object' })
26
- @Column({
27
- type: DataType.STRING(30),
28
- })
29
- ParentAccountNo: string;
30
-
31
- @ApiProperty({
32
- type: String,
33
- description: 'System Code eg. "EZC", "CRM"',
34
- })
35
- @Column({
36
- allowNull: false,
37
- type: DataType.STRING(10),
38
- })
39
- SystemCode: string;
40
-
41
28
  @ApiProperty({
42
- type: String,
43
- description: 'Finance account system code eg. "quickbook"',
29
+ example: 'cl6nzvo780000qcw38ihpd8w6',
30
+ description: 'CompanyId',
44
31
  })
32
+ @ForeignKey(() => FinanceCompanyModel)
45
33
  @Column({
46
34
  allowNull: false,
47
- type: DataType.STRING(10),
35
+ type: DataType.STRING(30),
48
36
  })
49
- AccSystemCode: string;
37
+ CompanyId: string;
50
38
 
51
- @ApiProperty({
52
- type: String,
53
- description: 'Account id in finance system',
54
- })
39
+ //copy from finance account migration table
40
+ @ApiProperty({ type: String, description: 'Parent account of this object' })
55
41
  @Column({
56
- allowNull: false,
57
- type: DataType.STRING(10),
42
+ type: DataType.STRING(30),
43
+ allowNull: true,
58
44
  })
59
- AccSystemRefId: string;
45
+ ParentAccountNo: string;
60
46
 
61
47
  @ApiProperty({
62
48
  type: String,
63
49
  description: 'Name of the account',
64
50
  })
65
51
  @Column({
66
- allowNull: true,
52
+ allowNull: false,
67
53
  type: DataType.STRING(200),
68
54
  })
69
55
  Name: string;
@@ -74,7 +60,7 @@ export default class AccountModel extends Model {
74
60
  })
75
61
  @Column({
76
62
  allowNull: true,
77
- type: DataType.TEXT,
63
+ type: DataType.STRING(2000),
78
64
  })
79
65
  Description: string;
80
66
 
@@ -83,7 +69,7 @@ export default class AccountModel extends Model {
83
69
  description: 'Account Type',
84
70
  })
85
71
  @Column({
86
- allowNull: true,
72
+ allowNull: false,
87
73
  type: DataType.STRING(100),
88
74
  })
89
75
  AccountType: string;
@@ -143,7 +129,10 @@ export default class AccountModel extends Model {
143
129
  example: '138140891dd211b288d34bc7b4312a49',
144
130
  description: 'The CreatedById for Media.',
145
131
  })
146
- @Column({ allowNull: false, type: DataType.STRING(30) })
132
+ @Column({
133
+ allowNull: false,
134
+ type: DataType.STRING(30),
135
+ })
147
136
  CreatedById: string;
148
137
 
149
138
  @ApiProperty({
@@ -157,9 +146,52 @@ export default class AccountModel extends Model {
157
146
  example: '138140891dd211b288d34bc7b4312a49',
158
147
  description: 'The UpdatedById for Media.',
159
148
  })
160
- @Column({ allowNull: false, type: DataType.STRING(30) })
149
+ @Column({
150
+ allowNull: true,
151
+ type: DataType.STRING(30),
152
+ })
161
153
  UpdatedById: string;
162
154
 
155
+ @ApiProperty({
156
+ type: String,
157
+ description: 'Account id in finance system',
158
+ })
159
+ @Column({
160
+ allowNull: false,
161
+ type: DataType.STRING(10),
162
+ })
163
+ AccSystemRefId: string;
164
+
165
+ @ApiProperty({
166
+ example: 'N',
167
+ description: 'PostedToAccSystemYN',
168
+ })
169
+ @Column({
170
+ allowNull: false,
171
+ type: DataType.ENUM('Y', 'N'),
172
+ })
173
+ PostedToAccSystemYN: string;
174
+
175
+ @ApiProperty({
176
+ example: '138140891dd211b288',
177
+ description: 'PostedById',
178
+ })
179
+ @Column({
180
+ allowNull: true,
181
+ type: DataType.STRING(30),
182
+ })
183
+ PostedById: string;
184
+
185
+ @ApiProperty({
186
+ example: new Date(),
187
+ description: 'PostedToAccSystem Date',
188
+ })
189
+ @Column({
190
+ allowNull: true,
191
+ type: DataType.DATE,
192
+ })
193
+ PostedDateTime: Date;
194
+
163
195
  @HasMany(() => PaymentModel)
164
196
  Payments: PaymentModel[];
165
197
 
@@ -168,4 +200,7 @@ export default class AccountModel extends Model {
168
200
 
169
201
  @HasMany(() => LedgerTransactionModel)
170
202
  LedgerTransactions: LedgerTransactionModel[];
203
+
204
+ @BelongsTo(() => FinanceCompanyModel)
205
+ FinanceCompany: FinanceCompanyModel;
171
206
  }
@@ -20,22 +20,6 @@ export default class FinanceCompanyModel extends Model {
20
20
  @Column({ allowNull: false, type: DataType.STRING(10) })
21
21
  AccSystemCode: string;
22
22
 
23
- @ApiProperty({ example: 'cl6nzvo780000qcw38ihpd8w6' })
24
- @Column({ allowNull: false, type: DataType.STRING(30) })
25
- AccSystemRefId: string;
26
-
27
- @ApiProperty({ example: 'N' })
28
- @Column({ defaultValue: 'N', type: DataType.ENUM('Y', 'N') })
29
- PostedToAccSystemYN: string;
30
-
31
- @ApiProperty({ example: 'cl6nzvo780000qcw38ihpd8w6' })
32
- @Column({ type: DataType.STRING(30) })
33
- PostedById: string;
34
-
35
- @ApiProperty({ example: new Date() })
36
- @Column({ type: DataType.DATE })
37
- PostedDateTime: Date;
38
-
39
23
  @HasMany(() => FinanceCustomerModel)
40
24
  FinanceCustomers: FinanceCustomerModel[];
41
25
  }
@@ -42,6 +42,12 @@ export default class PaymentItemModel extends Model {
42
42
  })
43
43
  Amount: number;
44
44
 
45
+ @Column({
46
+ type: DataType.STRING(30),
47
+ allowNull: true,
48
+ })
49
+ TaxCode: string;
50
+
45
51
  @BelongsTo(() => PaymentModel)
46
52
  Payment: PaymentModel;
47
53
  }
@@ -0,0 +1,70 @@
1
+ import { ApiProperty } from '@nestjs/swagger';
2
+ import {
3
+ BelongsTo,
4
+ Column,
5
+ DataType,
6
+ Model,
7
+ Table,
8
+ ForeignKey,
9
+ } from 'sequelize-typescript';
10
+ import AccountModel from './account.entity';
11
+ import PaymentMethodModel from './payment-method.entity';
12
+
13
+ @Table({
14
+ tableName: 'finance_PaymentMethodType',
15
+ createdAt: false,
16
+ updatedAt: false,
17
+ })
18
+ export default class PaymentMethodTypeModel extends Model {
19
+ @ForeignKey(() => PaymentMethodModel)
20
+ @ApiProperty({ example: 'cl6nzvo780000qcw38ihpd8w6' })
21
+ @Column({
22
+ allowNull: false,
23
+ type: DataType.STRING(30),
24
+ })
25
+ MethodId: string;
26
+
27
+ @ApiProperty({ example: 'cl6nzvo780000qcw38ihpd8w6' })
28
+ @Column({
29
+ primaryKey: true,
30
+ allowNull: false,
31
+ type: DataType.STRING(30),
32
+ })
33
+ MethodTypeId: string;
34
+
35
+ @ApiProperty({ example: 'Cash' })
36
+ @Column({
37
+ allowNull: false,
38
+ type: DataType.STRING(100),
39
+ })
40
+ Name: string;
41
+
42
+ @ForeignKey(() => AccountModel)
43
+ @ApiProperty({ example: 'cl6nzvo780000qcw38ihpd8w6' })
44
+ @Column({
45
+ allowNull: false,
46
+ type: DataType.STRING(30),
47
+ })
48
+ AccountNo: string;
49
+
50
+ @ApiProperty({ example: '100.0' })
51
+ @Column({
52
+ allowNull: false,
53
+ type: DataType.DECIMAL(10, 2),
54
+ })
55
+ ProcessingFeeRate: number;
56
+
57
+ @ForeignKey(() => AccountModel)
58
+ @ApiProperty({ example: 'cl6nzvo780000qcw38ihpd8w6' })
59
+ @Column({
60
+ allowNull: false,
61
+ type: DataType.STRING(30),
62
+ })
63
+ ProcessingFeeAccountNo: string;
64
+
65
+ @BelongsTo(() => AccountModel)
66
+ Account: AccountModel;
67
+
68
+ @BelongsTo(() => PaymentMethodModel)
69
+ PaymentMethod: PaymentMethodModel;
70
+ }
@@ -0,0 +1,28 @@
1
+ import { ApiProperty } from '@nestjs/swagger';
2
+ import { Column, DataType, HasMany, Model, Table } from 'sequelize-typescript';
3
+ import PaymentMethodTypeModel from './payment-method-type.entity';
4
+
5
+ @Table({
6
+ tableName: 'finance_PaymentMethod',
7
+ createdAt: false,
8
+ updatedAt: false,
9
+ })
10
+ export default class PaymentMethodModel extends Model {
11
+ @ApiProperty({ example: 'cl6nzvo780000qcw38ihpd8w6' })
12
+ @Column({
13
+ primaryKey: true,
14
+ allowNull: false,
15
+ type: DataType.STRING(30),
16
+ })
17
+ MethodId: string;
18
+
19
+ @ApiProperty({ example: 'Cash' })
20
+ @Column({
21
+ allowNull: false,
22
+ type: DataType.STRING(100),
23
+ })
24
+ Name: string;
25
+
26
+ @HasMany(() => PaymentMethodTypeModel)
27
+ PaymentMethodType: PaymentMethodTypeModel[];
28
+ }
@@ -1,3 +1,4 @@
1
+ import { ApiProperty } from '@nestjs/swagger';
1
2
  import {
2
3
  BelongsTo,
3
4
  Column,
@@ -6,12 +7,19 @@ import {
6
7
  HasMany,
7
8
  Model,
8
9
  Table,
10
+ UpdatedAt,
9
11
  } from 'sequelize-typescript';
10
- import { PaymentType } from '../enum/payment-type.enum';
11
- import AccountModel from './account.entity';
12
+ import { PaymentType, PaymentStatus } from '../enum';
13
+ import FinanceCompanyModel from './finance-company.entity';
12
14
  import PaymentItemModel from './payment-item.entity';
13
-
14
- @Table({ tableName: 'finance_Payment', createdAt: false, updatedAt: false })
15
+ import PaymentMethodTypeModel from './payment-method-type.entity';
16
+
17
+ @Table({
18
+ tableName: 'finance_Payment',
19
+ timestamps: false,
20
+ createdAt: false,
21
+ updatedAt: false,
22
+ })
15
23
  export default class PaymentModel extends Model {
16
24
  @Column({
17
25
  primaryKey: true,
@@ -20,16 +28,9 @@ export default class PaymentModel extends Model {
20
28
  })
21
29
  PaymentId: string;
22
30
 
23
- @ForeignKey(() => AccountModel)
24
31
  @Column({
25
32
  allowNull: false,
26
- type: DataType.STRING(30),
27
- })
28
- AccountNo: string;
29
-
30
- @Column({
31
- allowNull: false,
32
- type: DataType.STRING(30),
33
+ type: DataType.ENUM('Payment Received', 'Payout'),
33
34
  })
34
35
  PaymentType: PaymentType;
35
36
 
@@ -39,59 +40,69 @@ export default class PaymentModel extends Model {
39
40
  })
40
41
  PaymentDate: Date;
41
42
 
43
+ @ApiProperty({
44
+ example: 'cl6nzvo780000qcw38ihpd8w6',
45
+ description: 'CompanyId',
46
+ })
47
+ @ForeignKey(() => FinanceCompanyModel)
42
48
  @Column({
43
49
  allowNull: false,
44
- type: DataType.CHAR(3),
50
+ type: DataType.STRING(30),
45
51
  })
46
- Currency: string;
52
+ CompanyId: string;
47
53
 
54
+ @ApiProperty({
55
+ example: 'cl6nzvo780000qcw38ihpd8w6',
56
+ description: 'MethodTypeId',
57
+ })
58
+ @ForeignKey(() => PaymentMethodTypeModel)
48
59
  @Column({
49
60
  allowNull: false,
50
- type: DataType.DECIMAL(10, 2),
61
+ type: DataType.STRING(30),
51
62
  })
52
- Amount: number;
63
+ MethodTypeId: string;
53
64
 
54
65
  @Column({
55
66
  allowNull: false,
56
- type: DataType.STRING(30),
67
+ type: DataType.CHAR(3),
57
68
  })
58
- Status: string;
69
+ Currency: string;
59
70
 
60
71
  @Column({
61
72
  allowNull: false,
62
- type: DataType.STRING,
73
+ type: DataType.DECIMAL(10, 2),
63
74
  })
64
- Method: string;
75
+ Amount: number;
65
76
 
66
77
  @Column({
67
78
  allowNull: false,
68
- type: DataType.STRING(255),
79
+ type: DataType.STRING(30),
69
80
  })
70
- MethodParty: string;
81
+ Status: PaymentStatus;
71
82
 
72
83
  @Column({
73
84
  allowNull: true,
74
85
  type: DataType.STRING(100),
75
86
  })
76
- MethodAccountName: string;
87
+ TransactionId: string;
77
88
 
78
89
  @Column({
79
90
  allowNull: true,
80
91
  type: DataType.STRING(100),
81
92
  })
82
- MethodAccountNo: string;
93
+ TransactionApprovalCode: string;
83
94
 
84
95
  @Column({
85
96
  allowNull: true,
86
97
  type: DataType.STRING(100),
87
98
  })
88
- TransactionId: string;
99
+ TransactionAccountName: string;
89
100
 
90
101
  @Column({
91
102
  allowNull: true,
92
103
  type: DataType.STRING(100),
93
104
  })
94
- ApprovalId: string;
105
+ TransactionAccountNo: string;
95
106
 
96
107
  @Column({
97
108
  allowNull: false,
@@ -99,10 +110,11 @@ export default class PaymentModel extends Model {
99
110
  })
100
111
  ReceivedBy: string;
101
112
 
102
- @Column({
103
- allowNull: false,
104
- type: DataType.DATE,
113
+ @ApiProperty({
114
+ example: new Date(),
115
+ description: 'Timestamp for latest data modification',
105
116
  })
117
+ @UpdatedAt
106
118
  UpdatedAt: Date;
107
119
 
108
120
  @Column({
@@ -117,9 +129,52 @@ export default class PaymentModel extends Model {
117
129
  })
118
130
  Remarks: string;
119
131
 
120
- @BelongsTo(() => AccountModel)
121
- Account: AccountModel;
132
+ @ApiProperty({
133
+ type: String,
134
+ description: 'Account Customer Id in API',
135
+ })
136
+ @Column({
137
+ allowNull: true,
138
+ type: DataType.STRING(30),
139
+ })
140
+ AccSystemRefId: string;
141
+
142
+ @ApiProperty({
143
+ example: 'N',
144
+ description: 'PostedToAccSystemYN',
145
+ })
146
+ @Column({
147
+ allowNull: false,
148
+ type: DataType.ENUM('Y', 'N'),
149
+ })
150
+ PostedToAccSystemYN: string;
151
+
152
+ @ApiProperty({
153
+ example: '138140891dd211b288',
154
+ description: 'PostedById',
155
+ })
156
+ @Column({
157
+ allowNull: true,
158
+ type: DataType.STRING(30),
159
+ })
160
+ PostedById: string;
161
+
162
+ @ApiProperty({
163
+ example: new Date(),
164
+ description: 'PostedToAccSystem Date',
165
+ })
166
+ @Column({
167
+ allowNull: true,
168
+ type: DataType.DATE,
169
+ })
170
+ PostedDateTime: Date;
122
171
 
123
172
  @HasMany(() => PaymentItemModel)
124
173
  PaymentItems: PaymentItemModel[];
174
+
175
+ @BelongsTo(() => FinanceCompanyModel)
176
+ FinanceCompany: FinanceCompanyModel;
177
+
178
+ @BelongsTo(() => PaymentMethodTypeModel)
179
+ PaymentMethodType: PaymentMethodTypeModel;
125
180
  }
@@ -1,21 +1,24 @@
1
- import { PaymentType } from '../../enum';
1
+ import { PaymentType, PaymentStatus } from '../../enum';
2
2
 
3
3
  export class IPaymentAttr {
4
4
  PaymentId: string;
5
- AccountNo: string;
6
5
  PaymentType: PaymentType;
7
6
  PaymentDate: Date;
7
+ CompanyId: string;
8
+ MethodTypeId: string;
8
9
  Currency: string;
9
10
  Amount: number;
10
- Status: string;
11
- Method: string;
12
- MethodParty: string;
13
- MethodAccountName?: string;
14
- MethodAccountNo?: string;
11
+ Status: PaymentStatus;
15
12
  TransactionId?: string;
16
- ApprovalId?: string;
13
+ TransactionApprovalCode?: string;
14
+ TransactionAccountName?: string;
15
+ TransactionAccountNo?: string;
17
16
  ReceivedBy: string;
18
17
  UpdatedAt: Date;
19
18
  UpdatedBy: string;
20
19
  Remarks?: string;
20
+ AccSystemRefId?: string;
21
+ PostedToAccSystemYN: string;
22
+ PostedById?: string;
23
+ PostedDateTime?: Date;
21
24
  }
@@ -1,41 +1,11 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { InjectModel } from '@nestjs/sequelize';
3
- import { BaseRepository } from '@tomei/general';
1
+ import { RepositoryBase, IRepositoryBase } from '@tomei/general';
4
2
  import PaymentModel from '../models/payment.entity';
5
- import { IPaymentAttr } from './interfaces/payment-attr.interface';
6
- import { IPaymentRepository } from './interfaces/payment.repository.interface';
7
3
 
8
- @Injectable()
9
4
  export class PaymentRepository
10
- extends BaseRepository<PaymentModel>
11
- implements IPaymentRepository
5
+ extends RepositoryBase<PaymentModel>
6
+ implements IRepositoryBase<PaymentModel>
12
7
  {
13
- constructor(
14
- @InjectModel(PaymentModel)
15
- private readonly paymentModel: typeof PaymentModel,
16
- ) {
17
- super(paymentModel);
18
- }
19
-
20
- create(data: IPaymentAttr, options?: any): Promise<PaymentModel> | any {
21
- return this.paymentModel.create({ ...data }, options);
22
- }
23
-
24
- findAll(options: any): Promise<PaymentModel[]> {
25
- return this.paymentModel.findAll(options);
26
- }
27
-
28
- findAllWithPagination(
29
- options: any,
30
- ): Promise<{ count: number; rows: PaymentModel[] }> {
31
- return this.paymentModel.findAndCountAll(options);
32
- }
33
-
34
- findOne(options: any): Promise<PaymentModel> {
35
- return this.paymentModel.findOne(options);
36
- }
37
-
38
- update(data: IPaymentAttr, options?: any): any {
39
- return this.paymentModel.update({ ...data }, options);
8
+ constructor() {
9
+ super(PaymentModel);
40
10
  }
41
11
  }