@tomei/finance 0.0.15 → 0.0.17
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 +12 -13
- package/dist/account/account.js +9 -10
- package/dist/account/account.js.map +1 -1
- package/dist/account/account.repository.d.ts +1 -1
- package/dist/account/account.repository.js +1 -1
- package/dist/account/account.repository.js.map +1 -1
- package/dist/account/entities/account.entity.d.ts +1 -1
- package/dist/account/entities/account.entity.js +3 -5
- package/dist/account/entities/account.entity.js.map +1 -1
- package/dist/account/index.d.ts +2 -2
- package/dist/account/index.js.map +1 -1
- package/dist/account/interfaces/account-attr.interface.d.ts +3 -9
- package/dist/account/interfaces/account.repository.interface.d.ts +1 -1
- package/dist/base/index.d.ts +5 -4
- package/dist/base/index.js +5 -7
- package/dist/base/index.js.map +1 -1
- package/dist/base/object/base.object.abstract.d.ts +5 -0
- package/dist/base/object/base.object.abstract.js +7 -0
- package/dist/base/object/base.object.abstract.js.map +1 -0
- package/dist/base/object/object.interface.d.ts +4 -0
- package/dist/base/object/object.interface.js +3 -0
- package/dist/base/object/object.interface.js.map +1 -0
- package/dist/base/owner/base.owner.abstract.d.ts +20 -0
- package/dist/base/owner/base.owner.abstract.js +8 -0
- package/dist/base/owner/base.owner.abstract.js.map +1 -0
- package/dist/base/owner/owner.interface.d.ts +19 -0
- package/dist/base/owner/owner.interface.js +3 -0
- package/dist/base/owner/owner.interface.js.map +1 -0
- package/dist/base/repository/base.repository.abstract.d.ts +12 -0
- package/dist/base/repository/base.repository.abstract.js +22 -0
- package/dist/base/repository/base.repository.abstract.js.map +1 -0
- package/dist/base/repository/base.repository.interface.d.ts +9 -0
- package/dist/base/repository/base.repository.interface.js +3 -0
- package/dist/base/repository/base.repository.interface.js.map +1 -0
- package/dist/quickbook-client/client.d.ts +9 -1
- package/dist/quickbook-client/client.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/account/account.repository.ts +1 -1
- package/src/account/account.ts +20 -26
- package/src/account/entities/account.entity.ts +2 -4
- package/src/account/index.ts +0 -2
- package/src/account/interfaces/account-attr.interface.ts +3 -10
- package/src/account/interfaces/account.repository.interface.ts +1 -1
- package/src/base/index.ts +5 -5
- package/src/base/object/base.object.abstract.ts +6 -0
- package/src/base/object/object.interface.ts +4 -0
- package/src/base/owner/base.owner.abstract.ts +21 -0
- package/src/base/owner/owner.interface.ts +20 -0
- package/src/base/{base.repository.abstract.ts → repository/base.repository.abstract.ts} +0 -0
- package/src/base/{base.repository.interface.ts → repository/base.repository.interface.ts} +0 -0
- package/src/quickbook-client/client.ts +9 -1
- package/src/base/address.base.abstract.ts +0 -7
- package/src/base/object.base.abstract.ts +0 -8
- package/src/base/person.base.abstract.ts +0 -44
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
2
|
import { InjectModel } from '@nestjs/sequelize';
|
|
3
|
-
import { BaseRepository } from '
|
|
3
|
+
import { BaseRepository } from 'src/base/repository/base.repository.abstract';
|
|
4
4
|
import { AccountModel } from './entities/account.entity';
|
|
5
5
|
import {
|
|
6
6
|
IAccountAttr,
|
package/src/account/account.ts
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import { ObjectBase } from 'src/base
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
IAccountOptions,
|
|
5
|
-
ICreateAccountAttr,
|
|
6
|
-
} from './interfaces/account-attr.interface';
|
|
1
|
+
import { ObjectBase, OwnerBase } from 'src/base';
|
|
2
|
+
import { ICreateAccountAttr } from './interfaces/account-attr.interface';
|
|
7
3
|
import { IAccountRepository } from './interfaces/account.repository.interface';
|
|
8
|
-
import
|
|
4
|
+
import { QuickBookClient } from 'src/quickbook-client';
|
|
9
5
|
export class Account {
|
|
10
6
|
accountRepository: IAccountRepository;
|
|
11
7
|
intuitClient: any;
|
|
12
8
|
|
|
13
|
-
OwnerId: string;
|
|
14
|
-
OwnerType: string;
|
|
15
|
-
RelatedObjectId: string;
|
|
16
|
-
RelatedObjectType: string;
|
|
17
|
-
AccSystemId: string;
|
|
18
|
-
parentAccount: Account;
|
|
9
|
+
private OwnerId: string;
|
|
10
|
+
private OwnerType: string;
|
|
11
|
+
private RelatedObjectId: string;
|
|
12
|
+
private RelatedObjectType: string;
|
|
13
|
+
private AccSystemId: string;
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
parentAccountNo: string;
|
|
16
|
+
Owner: OwnerBase;
|
|
21
17
|
RelatedObject: ObjectBase;
|
|
22
18
|
|
|
23
19
|
isParamsInitialized: boolean;
|
|
@@ -27,18 +23,12 @@ export class Account {
|
|
|
27
23
|
constructor(
|
|
28
24
|
accountRepository: IAccountRepository,
|
|
29
25
|
SysCode: string,
|
|
30
|
-
|
|
26
|
+
params?: ICreateAccountAttr,
|
|
31
27
|
) {
|
|
32
28
|
this.accountRepository = accountRepository;
|
|
33
29
|
this.AccSystemId = SysCode;
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
this.init(options.params);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (options.account) {
|
|
40
|
-
this.parentAccount = options.account;
|
|
41
|
-
}
|
|
30
|
+
if (params) {
|
|
31
|
+
this.init(params);
|
|
42
32
|
}
|
|
43
33
|
}
|
|
44
34
|
|
|
@@ -70,13 +60,16 @@ export class Account {
|
|
|
70
60
|
}
|
|
71
61
|
|
|
72
62
|
this.OwnerId = params.Owner.Id;
|
|
73
|
-
this.OwnerType =
|
|
63
|
+
this.OwnerType = typeof this.Owner;
|
|
74
64
|
this.RelatedObjectId = params.RelatedObject.Id;
|
|
75
|
-
this.RelatedObjectType =
|
|
65
|
+
this.RelatedObjectType = typeof this.RelatedObject;
|
|
66
|
+
if (params.ParentAccountNo) {
|
|
67
|
+
this.parentAccountNo = params.ParentAccountNo;
|
|
68
|
+
}
|
|
76
69
|
this.isParamsInitialized = true;
|
|
77
70
|
}
|
|
78
71
|
|
|
79
|
-
async create(client:
|
|
72
|
+
async create(client: QuickBookClient, dbOptions: any) {
|
|
80
73
|
if (!this.Owner || !this.RelatedObject) {
|
|
81
74
|
throw new Error(
|
|
82
75
|
'Owner must be set before creating an account." or "RelatedObject must be set before creating an account.',
|
|
@@ -94,6 +87,7 @@ export class Account {
|
|
|
94
87
|
Owner: this.Owner,
|
|
95
88
|
RelatedObject: this.RelatedObject,
|
|
96
89
|
Client: client,
|
|
90
|
+
ParentAccountNo: this.parentAccountNo,
|
|
97
91
|
},
|
|
98
92
|
dbOptions,
|
|
99
93
|
);
|
|
@@ -102,9 +102,7 @@ export class AccountModel extends Model {
|
|
|
102
102
|
UpdatedById: string;
|
|
103
103
|
|
|
104
104
|
@BeforeValidate
|
|
105
|
-
static
|
|
106
|
-
instance
|
|
107
|
-
instance.UpdatedAt = new Date();
|
|
108
|
-
console.log(instance);
|
|
105
|
+
static beforeValidateProcess(instance: any) {
|
|
106
|
+
console.log(instance, '<<<<<<<');
|
|
109
107
|
}
|
|
110
108
|
}
|
package/src/account/index.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { AccountModel } from './entities/account.entity';
|
|
|
2
2
|
import { Account } from './account';
|
|
3
3
|
import { AccountRepository } from './account.repository';
|
|
4
4
|
import {
|
|
5
|
-
IAccountOptions,
|
|
6
5
|
IAccountAttr,
|
|
7
6
|
ICreateAccountAttr,
|
|
8
7
|
} from './interfaces/account-attr.interface';
|
|
@@ -12,7 +11,6 @@ export {
|
|
|
12
11
|
AccountModel,
|
|
13
12
|
Account,
|
|
14
13
|
AccountRepository,
|
|
15
|
-
IAccountOptions,
|
|
16
14
|
IAccountAttr,
|
|
17
15
|
ICreateAccountAttr,
|
|
18
16
|
IAccountRepository,
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { ObjectBase } from 'src/base
|
|
2
|
-
import { PersonBase } from 'src/base/person.base.abstract';
|
|
3
|
-
import { Account } from '../account';
|
|
1
|
+
import { ObjectBase, OwnerBase } from 'src/base';
|
|
4
2
|
|
|
5
3
|
export interface IAccountAttr {
|
|
6
4
|
AccountNo: string;
|
|
@@ -17,13 +15,8 @@ export interface IAccountAttr {
|
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
export interface ICreateAccountAttr {
|
|
20
|
-
Owner:
|
|
18
|
+
Owner: OwnerBase;
|
|
21
19
|
RelatedObject: ObjectBase;
|
|
22
|
-
AccSystemId: string;
|
|
23
20
|
Client?: any;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export interface IAccountOptions {
|
|
27
|
-
params?: ICreateAccountAttr;
|
|
28
|
-
account?: Account;
|
|
21
|
+
ParentAccountNo?: string;
|
|
29
22
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBaseRepository } from 'src/base/base.repository.interface';
|
|
1
|
+
import { IBaseRepository } from 'src/base/repository/base.repository.interface';
|
|
2
2
|
import { AccountModel } from '../entities/account.entity';
|
|
3
3
|
|
|
4
4
|
export type IAccountRepository = IBaseRepository<AccountModel>;
|
package/src/base/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// import all classes from this folder and export them
|
|
2
1
|
import { IAccountSystem } from './account-system.interface';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { IOwner } from './owner/owner.interface';
|
|
3
|
+
import { OwnerBase } from './owner/base.owner.abstract';
|
|
4
|
+
import { IObject } from './object/object.interface';
|
|
5
|
+
import { ObjectBase } from './object/base.object.abstract';
|
|
6
6
|
|
|
7
|
-
export { IAccountSystem,
|
|
7
|
+
export { IAccountSystem, ObjectBase, OwnerBase, IObject, IOwner };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ObjectBase } from '../object/base.object.abstract';
|
|
2
|
+
import { IOwner } from './owner.interface';
|
|
3
|
+
|
|
4
|
+
export abstract class OwnerBase extends ObjectBase implements IOwner {
|
|
5
|
+
abstract FullName: string;
|
|
6
|
+
abstract IDNo: string;
|
|
7
|
+
abstract IDType: string;
|
|
8
|
+
abstract Email: string;
|
|
9
|
+
abstract ContactNo: string;
|
|
10
|
+
abstract Address: string;
|
|
11
|
+
abstract getDetails(): {
|
|
12
|
+
FullName: string;
|
|
13
|
+
IDNo: string;
|
|
14
|
+
IDType: string;
|
|
15
|
+
Email: string;
|
|
16
|
+
ContactNo: string;
|
|
17
|
+
Address: string;
|
|
18
|
+
Id: string;
|
|
19
|
+
Type: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IObject } from '../object/object.interface';
|
|
2
|
+
|
|
3
|
+
export interface IOwner extends IObject {
|
|
4
|
+
FullName: string;
|
|
5
|
+
IDNo: string;
|
|
6
|
+
IDType: string;
|
|
7
|
+
Email: string;
|
|
8
|
+
ContactNo: string;
|
|
9
|
+
Address: string;
|
|
10
|
+
getDetails(): {
|
|
11
|
+
FullName: string;
|
|
12
|
+
IDNo: string;
|
|
13
|
+
IDType: string;
|
|
14
|
+
Email: string;
|
|
15
|
+
ContactNo: string;
|
|
16
|
+
Address: string;
|
|
17
|
+
Id: string;
|
|
18
|
+
Type: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -67,7 +67,15 @@ export class QuickBookClient {
|
|
|
67
67
|
return this.quickBookClient;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
public get token():
|
|
70
|
+
public get token(): {
|
|
71
|
+
token_type: string;
|
|
72
|
+
access_token: string;
|
|
73
|
+
refresh_token: string;
|
|
74
|
+
expires_in: number;
|
|
75
|
+
x_refresh_token_expires_in: number;
|
|
76
|
+
id_token: string;
|
|
77
|
+
createdAt: number;
|
|
78
|
+
} {
|
|
71
79
|
return this.quickBookClient.token.getToken();
|
|
72
80
|
}
|
|
73
81
|
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { AddressBase } from './address.base.abstract';
|
|
2
|
-
import { ObjectBase } from './object.base.abstract';
|
|
3
|
-
|
|
4
|
-
export abstract class PersonBase extends ObjectBase {
|
|
5
|
-
Fullname: string;
|
|
6
|
-
IDNo: string;
|
|
7
|
-
IDType: string;
|
|
8
|
-
Email: string;
|
|
9
|
-
ContactNo: string;
|
|
10
|
-
Address: AddressBase;
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
13
|
-
id: string,
|
|
14
|
-
name: string,
|
|
15
|
-
fullname: string,
|
|
16
|
-
idNo: string,
|
|
17
|
-
idType: string,
|
|
18
|
-
email: string,
|
|
19
|
-
contactNo: string,
|
|
20
|
-
address: AddressBase,
|
|
21
|
-
) {
|
|
22
|
-
super(id, name);
|
|
23
|
-
this.Fullname = fullname;
|
|
24
|
-
this.IDNo = idNo;
|
|
25
|
-
this.IDType = idType;
|
|
26
|
-
this.Email = email;
|
|
27
|
-
this.ContactNo = contactNo;
|
|
28
|
-
this.Address = address;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
abstract getDetails():
|
|
32
|
-
| {
|
|
33
|
-
Id: string;
|
|
34
|
-
Name: string;
|
|
35
|
-
Fullname: string;
|
|
36
|
-
IDNo: string;
|
|
37
|
-
IDType: string;
|
|
38
|
-
Email: string;
|
|
39
|
-
ContactNo: string;
|
|
40
|
-
Address: AddressBase;
|
|
41
|
-
}
|
|
42
|
-
| null
|
|
43
|
-
| undefined;
|
|
44
|
-
}
|