@tomei/finance 0.2.3 → 0.2.4

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.
@@ -1,33 +1,33 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- async up(queryInterface, Sequelize) {
5
- await queryInterface.createTable('finance_Customer', {
6
- CustomerId: {
7
- type: Sequelize.STRING(30),
8
- primaryKey: true,
9
- allowNull: false,
10
- },
11
- SystemCode: {
12
- type: Sequelize.STRING(30),
13
- allowNull: false,
14
- },
15
- AccSystemCode: {
16
- type: Sequelize.STRING(30),
17
- allowNull: false,
18
- },
19
- AccSystemCustomerId: {
20
- type: Sequelize.STRING(30),
21
- allowNull: false,
22
- },
23
- CustomerRefId: {
24
- type: Sequelize.STRING(30),
25
- allowNull: false,
26
- },
27
- });
28
- },
29
-
30
- async down(queryInterface) {
31
- await queryInterface.dropTable('finance_Customer');
32
- },
33
- };
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ async up(queryInterface, Sequelize) {
5
+ await queryInterface.createTable('finance_Customer', {
6
+ CustomerId: {
7
+ type: Sequelize.STRING(30),
8
+ primaryKey: true,
9
+ allowNull: false,
10
+ },
11
+ SystemCode: {
12
+ type: Sequelize.STRING(30),
13
+ allowNull: false,
14
+ },
15
+ AccSystemCode: {
16
+ type: Sequelize.STRING(30),
17
+ allowNull: false,
18
+ },
19
+ AccSystemCustomerId: {
20
+ type: Sequelize.STRING(30),
21
+ allowNull: false,
22
+ },
23
+ CustomerRefId: {
24
+ type: Sequelize.STRING(30),
25
+ allowNull: false,
26
+ },
27
+ });
28
+ },
29
+
30
+ async down(queryInterface) {
31
+ await queryInterface.dropTable('finance_Customer');
32
+ },
33
+ };
@@ -1,89 +1,89 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- async up(queryInterface, Sequelize) {
5
- await queryInterface.createTable('finance_Payment', {
6
- PaymentId: {
7
- type: Sequelize.STRING(30),
8
- primaryKey: true,
9
- allowNull: false,
10
- },
11
- AccountNo: {
12
- type: Sequelize.STRING(30),
13
- allowNull: false,
14
- references: {
15
- model: 'finance_Account',
16
- key: 'AccountNo',
17
- },
18
- onUpdate: 'CASCADE',
19
- onDelete: 'CASCADE',
20
- },
21
- PaymentType: {
22
- type: Sequelize.ENUM(['Payment Received', 'Payout']),
23
- defaultValue: 'Payment Received',
24
- allowNull: false,
25
- },
26
- PaymentDate: {
27
- type: Sequelize.DATE,
28
- allowNull: false,
29
- },
30
- Currency: {
31
- type: Sequelize.CHAR(3),
32
- allowNull: false,
33
- },
34
- Amount: {
35
- type: Sequelize.DECIMAL(10, 2),
36
- allowNull: false,
37
- },
38
- Status: {
39
- type: Sequelize.STRING(20),
40
- allowNull: false,
41
- },
42
- Method: {
43
- type: Sequelize.STRING,
44
- allowNull: false,
45
- },
46
- MethodParty: {
47
- type: Sequelize.STRING(255),
48
- allowNull: false,
49
- },
50
- MethodAccountName: {
51
- type: Sequelize.STRING(100),
52
- allowNull: true,
53
- },
54
- MethodAccountNo: {
55
- type: Sequelize.STRING(100),
56
- allowNull: true,
57
- },
58
- TransactionId: {
59
- type: Sequelize.STRING(100),
60
- allowNull: true,
61
- },
62
- ApprovalId: {
63
- type: Sequelize.STRING(100),
64
- allowNull: true,
65
- },
66
- ReceivedBy: {
67
- type: Sequelize.STRING(30),
68
- allowNull: false,
69
- },
70
- UpdatedAt: {
71
- allowNull: false,
72
- defaultValue: new Date(),
73
- type: Sequelize.DATE,
74
- },
75
- UpdatedBy: {
76
- allowNull: false,
77
- type: Sequelize.STRING,
78
- },
79
- Remarks: {
80
- type: Sequelize.TEXT,
81
- allowNull: true,
82
- },
83
- });
84
- },
85
-
86
- async down(queryInterface) {
87
- await queryInterface.dropTable('finance_Payment');
88
- },
89
- };
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ async up(queryInterface, Sequelize) {
5
+ await queryInterface.createTable('finance_Payment', {
6
+ PaymentId: {
7
+ type: Sequelize.STRING(30),
8
+ primaryKey: true,
9
+ allowNull: false,
10
+ },
11
+ AccountNo: {
12
+ type: Sequelize.STRING(30),
13
+ allowNull: false,
14
+ references: {
15
+ model: 'finance_Account',
16
+ key: 'AccountNo',
17
+ },
18
+ onUpdate: 'CASCADE',
19
+ onDelete: 'CASCADE',
20
+ },
21
+ PaymentType: {
22
+ type: Sequelize.ENUM(['Payment Received', 'Payout']),
23
+ defaultValue: 'Payment Received',
24
+ allowNull: false,
25
+ },
26
+ PaymentDate: {
27
+ type: Sequelize.DATE,
28
+ allowNull: false,
29
+ },
30
+ Currency: {
31
+ type: Sequelize.CHAR(3),
32
+ allowNull: false,
33
+ },
34
+ Amount: {
35
+ type: Sequelize.DECIMAL(10, 2),
36
+ allowNull: false,
37
+ },
38
+ Status: {
39
+ type: Sequelize.STRING(20),
40
+ allowNull: false,
41
+ },
42
+ Method: {
43
+ type: Sequelize.STRING,
44
+ allowNull: false,
45
+ },
46
+ MethodParty: {
47
+ type: Sequelize.STRING(255),
48
+ allowNull: false,
49
+ },
50
+ MethodAccountName: {
51
+ type: Sequelize.STRING(100),
52
+ allowNull: true,
53
+ },
54
+ MethodAccountNo: {
55
+ type: Sequelize.STRING(100),
56
+ allowNull: true,
57
+ },
58
+ TransactionId: {
59
+ type: Sequelize.STRING(100),
60
+ allowNull: true,
61
+ },
62
+ ApprovalId: {
63
+ type: Sequelize.STRING(100),
64
+ allowNull: true,
65
+ },
66
+ ReceivedBy: {
67
+ type: Sequelize.STRING(30),
68
+ allowNull: false,
69
+ },
70
+ UpdatedAt: {
71
+ allowNull: false,
72
+ defaultValue: new Date(),
73
+ type: Sequelize.DATE,
74
+ },
75
+ UpdatedBy: {
76
+ allowNull: false,
77
+ type: Sequelize.STRING,
78
+ },
79
+ Remarks: {
80
+ type: Sequelize.TEXT,
81
+ allowNull: true,
82
+ },
83
+ });
84
+ },
85
+
86
+ async down(queryInterface) {
87
+ await queryInterface.dropTable('finance_Payment');
88
+ },
89
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/finance",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "NestJS package for finance module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,44 +1,44 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { InjectModel } from '@nestjs/sequelize';
3
- import { AccountModel } from './entities/account.entity';
4
- import { BaseRepository } from '@tomei/general';
5
- import {
6
- IAccountAttr,
7
- ICreateAccountAttr,
8
- } from './interfaces/account-attr.interface';
9
- import { IAccountRepository } from './interfaces/account.repository.interface';
10
-
11
- @Injectable()
12
- export class AccountRepository
13
- extends BaseRepository<AccountModel>
14
- implements IAccountRepository
15
- {
16
- constructor(
17
- @InjectModel(AccountModel)
18
- private readonly accountModel: typeof AccountModel,
19
- ) {
20
- super(accountModel);
21
- }
22
-
23
- create(data: ICreateAccountAttr, options?: any): Promise<AccountModel> | any {
24
- return this.accountModel.create({ ...data }, options);
25
- }
26
-
27
- findAll(options: any): Promise<AccountModel[]> {
28
- return this.accountModel.findAll(options);
29
- }
30
-
31
- findAllWithPagination(
32
- options: any,
33
- ): Promise<{ count: number; rows: AccountModel[] }> {
34
- return this.accountModel.findAndCountAll(options);
35
- }
36
-
37
- findOne(options: any): Promise<AccountModel> {
38
- return this.accountModel.findOne(options);
39
- }
40
-
41
- update(data: IAccountAttr, options?: any): any {
42
- return this.accountModel.update({ ...data }, options);
43
- }
44
- }
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/sequelize';
3
+ import { AccountModel } from './entities/account.entity';
4
+ import { BaseRepository } from '@tomei/general';
5
+ import {
6
+ IAccountAttr,
7
+ ICreateAccountAttr,
8
+ } from './interfaces/account-attr.interface';
9
+ import { IAccountRepository } from './interfaces/account.repository.interface';
10
+
11
+ @Injectable()
12
+ export class AccountRepository
13
+ extends BaseRepository<AccountModel>
14
+ implements IAccountRepository
15
+ {
16
+ constructor(
17
+ @InjectModel(AccountModel)
18
+ private readonly accountModel: typeof AccountModel,
19
+ ) {
20
+ super(accountModel);
21
+ }
22
+
23
+ create(data: ICreateAccountAttr, options?: any): Promise<AccountModel> | any {
24
+ return this.accountModel.create({ ...data }, options);
25
+ }
26
+
27
+ findAll(options: any): Promise<AccountModel[]> {
28
+ return this.accountModel.findAll(options);
29
+ }
30
+
31
+ findAllWithPagination(
32
+ options: any,
33
+ ): Promise<{ count: number; rows: AccountModel[] }> {
34
+ return this.accountModel.findAndCountAll(options);
35
+ }
36
+
37
+ findOne(options: any): Promise<AccountModel> {
38
+ return this.accountModel.findOne(options);
39
+ }
40
+
41
+ update(data: IAccountAttr, options?: any): any {
42
+ return this.accountModel.update({ ...data }, options);
43
+ }
44
+ }
@@ -1,4 +1,4 @@
1
- import { IBaseRepository } from '@tomei/general';
2
- import { AccountModel } from '../entities/account.entity';
3
-
4
- export type IAccountRepository = IBaseRepository<AccountModel>;
1
+ import { IBaseRepository } from '@tomei/general';
2
+ import { AccountModel } from '../entities/account.entity';
3
+
4
+ export type IAccountRepository = IBaseRepository<AccountModel>;