@tomei/rental 0.16.3 → 0.16.5
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/.commitlintrc.json +22 -22
- package/.gitlab-ci.yml +16 -16
- package/.husky/commit-msg +15 -15
- package/.husky/pre-commit +7 -7
- package/.prettierrc +4 -4
- package/Jenkinsfile +51 -51
- package/README.md +8 -8
- package/dist/src/components/agreement/agreement.d.ts +4 -4
- package/dist/src/components/agreement/agreement.js +9 -9
- package/dist/src/components/agreement/agreement.js.map +1 -1
- package/dist/src/components/agreement-signature/agreement-signature.d.ts +27 -0
- package/dist/src/components/agreement-signature/agreement-signature.js +112 -0
- package/dist/src/components/agreement-signature/agreement-signature.js.map +1 -0
- package/dist/src/components/agreement-signature/agreement-signature.repository.d.ts +8 -0
- package/dist/src/components/agreement-signature/agreement-signature.repository.js +68 -0
- package/dist/src/components/agreement-signature/agreement-signature.repository.js.map +1 -0
- package/dist/src/components/agreement-signature/hirer-signature.d.ts +27 -0
- package/dist/src/components/agreement-signature/hirer-signature.js +112 -0
- package/dist/src/components/agreement-signature/hirer-signature.js.map +1 -0
- package/dist/src/components/agreement-signature/hirer-signature.repository.d.ts +8 -0
- package/dist/src/components/agreement-signature/hirer-signature.repository.js +67 -0
- package/dist/src/components/agreement-signature/hirer-signature.repository.js.map +1 -0
- package/dist/src/components/hirer-signature/hirer-signature.d.ts +2 -2
- package/dist/src/components/hirer-signature/hirer-signature.repository.d.ts +1 -1
- package/dist/src/components/hirer-signature/hirer-signature.repository.js +6 -6
- package/dist/src/components/hirer-signature/hirer-signature.repository.js.map +1 -1
- package/dist/src/components/rental/rental.d.ts +5 -5
- package/dist/src/components/rental/rental.js +46 -40
- package/dist/src/components/rental/rental.js.map +1 -1
- package/dist/src/database.js +2 -2
- package/dist/src/database.js.map +1 -1
- package/dist/src/enum/agreement-signature-status.enum.d.ts +4 -0
- package/dist/src/enum/agreement-signature-status.enum.js +9 -0
- package/dist/src/enum/agreement-signature-status.enum.js.map +1 -0
- package/dist/src/enum/index.d.ts +2 -2
- package/dist/src/enum/index.js +3 -3
- package/dist/src/enum/index.js.map +1 -1
- package/dist/src/enum/rental-status.enum.d.ts +1 -2
- package/dist/src/enum/rental-status.enum.js +0 -1
- package/dist/src/enum/rental-status.enum.js.map +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.js +5 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/interfaces/agreemeent-signature-attr.interface.d.ts +14 -0
- package/dist/src/interfaces/agreemeent-signature-attr.interface.js +3 -0
- package/dist/src/interfaces/agreemeent-signature-attr.interface.js.map +1 -0
- package/dist/src/interfaces/index.d.ts +3 -3
- package/dist/src/interfaces/rental-attr.interface.d.ts +1 -1
- package/dist/src/interfaces/response-hirer-signature-attr.interface.d.ts +6 -6
- package/dist/src/models/agreement-signature.entity.d.ts +18 -0
- package/dist/src/models/agreement-signature.entity.js +101 -0
- package/dist/src/models/agreement-signature.entity.js.map +1 -0
- package/dist/src/models/agreement.entity.d.ts +2 -2
- package/dist/src/models/agreement.entity.js +3 -3
- package/dist/src/models/agreement.entity.js.map +1 -1
- package/dist/src/models/hirer-signature.entity.d.ts +2 -2
- package/dist/src/models/hirer-signature.entity.js +18 -18
- package/dist/src/models/hirer-signature.entity.js.map +1 -1
- package/dist/src/models/index.d.ts +2 -2
- package/dist/src/models/index.js +3 -3
- package/dist/src/models/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/eslint.config.mjs +58 -58
- package/jest.config.js +10 -10
- package/migrations/booking-table-migration.js +79 -79
- package/migrations/hirer-signature-table-migration.js +64 -64
- package/migrations/joint-hirer-table-migration.js +52 -52
- package/migrations/rental-aggreement-history-migration.js +41 -41
- package/migrations/rental-aggrement-table-migration.js +30 -30
- package/migrations/rental-price-table-migration.js +32 -32
- package/migrations/rental-table-migrations.js +96 -96
- package/package.json +75 -75
- package/sonar-project.properties +12 -12
- package/src/components/agreement/agreement.repository.ts +54 -54
- package/src/components/agreement/agreement.ts +180 -180
- package/src/components/agreement-history/agreement-history.repository.ts +54 -54
- package/src/components/agreement-history/agreement-history.ts +57 -57
- package/src/components/agreement-signature/agreement-signature.repository.ts +55 -0
- package/src/components/agreement-signature/agreement-signature.ts +143 -0
- package/src/components/booking/booking.repository.ts +51 -51
- package/src/components/booking/booking.ts +492 -492
- package/src/components/joint-hirer/joint-hirer.repository.ts +54 -54
- package/src/components/joint-hirer/joint-hirer.ts +137 -137
- package/src/components/rental/rental.repository.ts +51 -51
- package/src/components/rental/rental.ts +1125 -1116
- package/src/components/rental-price/rental-price.repository.ts +54 -54
- package/src/components/rental-price/rental-price.ts +100 -100
- package/src/database.ts +31 -31
- package/src/enum/account-type.enum.ts +4 -4
- package/src/enum/agreement-signature-status.enum.ts +4 -0
- package/src/enum/booking.enum.ts +5 -5
- package/src/enum/hirer-type.enum.ts +4 -4
- package/src/enum/index.ts +15 -15
- package/src/enum/rental-status.enum.ts +34 -39
- package/src/index.ts +36 -36
- package/src/interfaces/agreemeent-signature-attr.interface.ts +15 -0
- package/src/interfaces/agreement-attr.interface.ts +7 -7
- package/src/interfaces/agreement-history-attr.interface.ts +7 -7
- package/src/interfaces/booking-attr.interface.ts +19 -19
- package/src/interfaces/booking-find-all-search-attr.interface.ts +12 -12
- package/src/interfaces/index.ts +19 -19
- package/src/interfaces/joint-hirer-attr.interface.ts +10 -10
- package/src/interfaces/rental-attr.interface.ts +25 -25
- package/src/interfaces/rental-find-all-search-attr.interface.ts +11 -11
- package/src/interfaces/rental-price-attr.interface.ts +7 -7
- package/src/interfaces/response-hirer-signature-attr.interface.ts +15 -15
- package/src/models/agreement-history.entity.ts +51 -51
- package/src/models/{hirer-signature.entity.ts → agreement-signature.entity.ts} +86 -81
- package/src/models/agreement.entity.ts +47 -47
- package/src/models/booking.entity.ts +105 -105
- package/src/models/index.ts +17 -17
- package/src/models/joint-hirer.entity.ts +63 -63
- package/src/models/rental-price.entity.ts +38 -38
- package/src/models/rental.entity.ts +133 -133
- package/tsconfig.build.json +5 -5
- package/tsconfig.json +24 -24
- package/src/components/hirer-signature/hirer-signature.repository.ts +0 -54
- package/src/components/hirer-signature/hirer-signature.ts +0 -140
- package/src/enum/hirer-signature-status.enum.ts +0 -4
- package/src/interfaces/hirer-signature-attr.interface.ts +0 -15
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Column,
|
|
3
|
-
DataType,
|
|
4
|
-
Table,
|
|
5
|
-
Model,
|
|
6
|
-
ForeignKey,
|
|
7
|
-
BelongsTo,
|
|
8
|
-
CreatedAt,
|
|
9
|
-
UpdatedAt,
|
|
10
|
-
HasMany,
|
|
11
|
-
} from 'sequelize-typescript';
|
|
12
|
-
import { RentalPriceModel } from './rental-price.entity';
|
|
13
|
-
import { RentalStatusEnum } from '../enum/rental-status.enum';
|
|
14
|
-
import { JointHirerModel } from './joint-hirer.entity';
|
|
15
|
-
import { RentalAccountTypeEnum } from '../enum/account-type.enum';
|
|
16
|
-
import { AgreementModel } from './agreement.entity';
|
|
17
|
-
|
|
18
|
-
@Table({
|
|
19
|
-
tableName: 'rental_Rental',
|
|
20
|
-
})
|
|
21
|
-
export class RentalModel extends Model {
|
|
22
|
-
@Column({
|
|
23
|
-
primaryKey: true,
|
|
24
|
-
allowNull: false,
|
|
25
|
-
type: DataType.STRING(30),
|
|
26
|
-
})
|
|
27
|
-
RentalId: string;
|
|
28
|
-
|
|
29
|
-
@Column({
|
|
30
|
-
allowNull: false,
|
|
31
|
-
type: DataType.STRING(30),
|
|
32
|
-
})
|
|
33
|
-
CustomerId: string;
|
|
34
|
-
|
|
35
|
-
@Column({
|
|
36
|
-
allowNull: false,
|
|
37
|
-
type: DataType.STRING(30),
|
|
38
|
-
})
|
|
39
|
-
CustomerType: string;
|
|
40
|
-
|
|
41
|
-
@Column({
|
|
42
|
-
allowNull: false,
|
|
43
|
-
type: DataType.STRING(30),
|
|
44
|
-
})
|
|
45
|
-
ItemId: string;
|
|
46
|
-
|
|
47
|
-
@Column({
|
|
48
|
-
allowNull: false,
|
|
49
|
-
type: DataType.STRING(30),
|
|
50
|
-
})
|
|
51
|
-
ItemType: string;
|
|
52
|
-
|
|
53
|
-
@ForeignKey(() => RentalPriceModel)
|
|
54
|
-
@Column({
|
|
55
|
-
allowNull: false,
|
|
56
|
-
type: DataType.STRING(30),
|
|
57
|
-
})
|
|
58
|
-
PriceId: string;
|
|
59
|
-
|
|
60
|
-
@Column({
|
|
61
|
-
allowNull: false,
|
|
62
|
-
type: DataType.DATE,
|
|
63
|
-
})
|
|
64
|
-
StartDateTime: Date;
|
|
65
|
-
|
|
66
|
-
@Column({
|
|
67
|
-
allowNull: false,
|
|
68
|
-
type: DataType.DATE,
|
|
69
|
-
})
|
|
70
|
-
EndDateTime: Date;
|
|
71
|
-
|
|
72
|
-
@Column({
|
|
73
|
-
allowNull: false,
|
|
74
|
-
type: DataType.STRING(50),
|
|
75
|
-
})
|
|
76
|
-
Status: RentalStatusEnum;
|
|
77
|
-
|
|
78
|
-
@Column({
|
|
79
|
-
type: DataType.STRING(3000),
|
|
80
|
-
})
|
|
81
|
-
CancelRemarks: string;
|
|
82
|
-
|
|
83
|
-
@Column({
|
|
84
|
-
type: DataType.STRING(3000),
|
|
85
|
-
})
|
|
86
|
-
TerminateRemarks: string;
|
|
87
|
-
|
|
88
|
-
@Column({
|
|
89
|
-
type: DataType.CHAR(1),
|
|
90
|
-
})
|
|
91
|
-
EscheatmentYN: string;
|
|
92
|
-
|
|
93
|
-
@ForeignKey(() => AgreementModel)
|
|
94
|
-
@Column({
|
|
95
|
-
allowNull: false,
|
|
96
|
-
unique: true,
|
|
97
|
-
type: DataType.STRING(30),
|
|
98
|
-
})
|
|
99
|
-
AgreementNo: string;
|
|
100
|
-
|
|
101
|
-
@Column({
|
|
102
|
-
allowNull: false,
|
|
103
|
-
type: DataType.STRING(10),
|
|
104
|
-
})
|
|
105
|
-
AccountType: RentalAccountTypeEnum;
|
|
106
|
-
|
|
107
|
-
@Column({
|
|
108
|
-
allowNull: false,
|
|
109
|
-
type: DataType.STRING(30),
|
|
110
|
-
})
|
|
111
|
-
CreatedById: string;
|
|
112
|
-
|
|
113
|
-
@CreatedAt
|
|
114
|
-
CreatedAt: Date;
|
|
115
|
-
|
|
116
|
-
@Column({
|
|
117
|
-
allowNull: false,
|
|
118
|
-
type: DataType.STRING(30),
|
|
119
|
-
})
|
|
120
|
-
UpdatedById: string;
|
|
121
|
-
|
|
122
|
-
@UpdatedAt
|
|
123
|
-
UpdatedAt: Date;
|
|
124
|
-
|
|
125
|
-
@BelongsTo(() => RentalPriceModel)
|
|
126
|
-
RentalPrice: RentalPriceModel;
|
|
127
|
-
|
|
128
|
-
@BelongsTo(() => AgreementModel)
|
|
129
|
-
Agreement: AgreementModel;
|
|
130
|
-
|
|
131
|
-
@HasMany(() => JointHirerModel)
|
|
132
|
-
JointHirers: JointHirerModel[];
|
|
133
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
Column,
|
|
3
|
+
DataType,
|
|
4
|
+
Table,
|
|
5
|
+
Model,
|
|
6
|
+
ForeignKey,
|
|
7
|
+
BelongsTo,
|
|
8
|
+
CreatedAt,
|
|
9
|
+
UpdatedAt,
|
|
10
|
+
HasMany,
|
|
11
|
+
} from 'sequelize-typescript';
|
|
12
|
+
import { RentalPriceModel } from './rental-price.entity';
|
|
13
|
+
import { RentalStatusEnum } from '../enum/rental-status.enum';
|
|
14
|
+
import { JointHirerModel } from './joint-hirer.entity';
|
|
15
|
+
import { RentalAccountTypeEnum } from '../enum/account-type.enum';
|
|
16
|
+
import { AgreementModel } from './agreement.entity';
|
|
17
|
+
|
|
18
|
+
@Table({
|
|
19
|
+
tableName: 'rental_Rental',
|
|
20
|
+
})
|
|
21
|
+
export class RentalModel extends Model {
|
|
22
|
+
@Column({
|
|
23
|
+
primaryKey: true,
|
|
24
|
+
allowNull: false,
|
|
25
|
+
type: DataType.STRING(30),
|
|
26
|
+
})
|
|
27
|
+
RentalId: string;
|
|
28
|
+
|
|
29
|
+
@Column({
|
|
30
|
+
allowNull: false,
|
|
31
|
+
type: DataType.STRING(30),
|
|
32
|
+
})
|
|
33
|
+
CustomerId: string;
|
|
34
|
+
|
|
35
|
+
@Column({
|
|
36
|
+
allowNull: false,
|
|
37
|
+
type: DataType.STRING(30),
|
|
38
|
+
})
|
|
39
|
+
CustomerType: string;
|
|
40
|
+
|
|
41
|
+
@Column({
|
|
42
|
+
allowNull: false,
|
|
43
|
+
type: DataType.STRING(30),
|
|
44
|
+
})
|
|
45
|
+
ItemId: string;
|
|
46
|
+
|
|
47
|
+
@Column({
|
|
48
|
+
allowNull: false,
|
|
49
|
+
type: DataType.STRING(30),
|
|
50
|
+
})
|
|
51
|
+
ItemType: string;
|
|
52
|
+
|
|
53
|
+
@ForeignKey(() => RentalPriceModel)
|
|
54
|
+
@Column({
|
|
55
|
+
allowNull: false,
|
|
56
|
+
type: DataType.STRING(30),
|
|
57
|
+
})
|
|
58
|
+
PriceId: string;
|
|
59
|
+
|
|
60
|
+
@Column({
|
|
61
|
+
allowNull: false,
|
|
62
|
+
type: DataType.DATE,
|
|
63
|
+
})
|
|
64
|
+
StartDateTime: Date;
|
|
65
|
+
|
|
66
|
+
@Column({
|
|
67
|
+
allowNull: false,
|
|
68
|
+
type: DataType.DATE,
|
|
69
|
+
})
|
|
70
|
+
EndDateTime: Date;
|
|
71
|
+
|
|
72
|
+
@Column({
|
|
73
|
+
allowNull: false,
|
|
74
|
+
type: DataType.STRING(50),
|
|
75
|
+
})
|
|
76
|
+
Status: RentalStatusEnum;
|
|
77
|
+
|
|
78
|
+
@Column({
|
|
79
|
+
type: DataType.STRING(3000),
|
|
80
|
+
})
|
|
81
|
+
CancelRemarks: string;
|
|
82
|
+
|
|
83
|
+
@Column({
|
|
84
|
+
type: DataType.STRING(3000),
|
|
85
|
+
})
|
|
86
|
+
TerminateRemarks: string;
|
|
87
|
+
|
|
88
|
+
@Column({
|
|
89
|
+
type: DataType.CHAR(1),
|
|
90
|
+
})
|
|
91
|
+
EscheatmentYN: string;
|
|
92
|
+
|
|
93
|
+
@ForeignKey(() => AgreementModel)
|
|
94
|
+
@Column({
|
|
95
|
+
allowNull: false,
|
|
96
|
+
unique: true,
|
|
97
|
+
type: DataType.STRING(30),
|
|
98
|
+
})
|
|
99
|
+
AgreementNo: string;
|
|
100
|
+
|
|
101
|
+
@Column({
|
|
102
|
+
allowNull: false,
|
|
103
|
+
type: DataType.STRING(10),
|
|
104
|
+
})
|
|
105
|
+
AccountType: RentalAccountTypeEnum;
|
|
106
|
+
|
|
107
|
+
@Column({
|
|
108
|
+
allowNull: false,
|
|
109
|
+
type: DataType.STRING(30),
|
|
110
|
+
})
|
|
111
|
+
CreatedById: string;
|
|
112
|
+
|
|
113
|
+
@CreatedAt
|
|
114
|
+
CreatedAt: Date;
|
|
115
|
+
|
|
116
|
+
@Column({
|
|
117
|
+
allowNull: false,
|
|
118
|
+
type: DataType.STRING(30),
|
|
119
|
+
})
|
|
120
|
+
UpdatedById: string;
|
|
121
|
+
|
|
122
|
+
@UpdatedAt
|
|
123
|
+
UpdatedAt: Date;
|
|
124
|
+
|
|
125
|
+
@BelongsTo(() => RentalPriceModel)
|
|
126
|
+
RentalPrice: RentalPriceModel;
|
|
127
|
+
|
|
128
|
+
@BelongsTo(() => AgreementModel)
|
|
129
|
+
Agreement: AgreementModel;
|
|
130
|
+
|
|
131
|
+
@HasMany(() => JointHirerModel)
|
|
132
|
+
JointHirers: JointHirerModel[];
|
|
133
|
+
}
|
package/tsconfig.build.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"include": ["**/*.ts"],
|
|
4
|
-
"exclude": ["node_modules", "__tests__", "dist", "**/*spec.ts"]
|
|
5
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"include": ["**/*.ts"],
|
|
4
|
+
"exclude": ["node_modules", "__tests__", "dist", "**/*spec.ts"]
|
|
5
|
+
}
|
|
6
6
|
|
package/tsconfig.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"removeComments": true,
|
|
6
|
-
"emitDecoratorMetadata": true,
|
|
7
|
-
"experimentalDecorators": true,
|
|
8
|
-
"allowSyntheticDefaultImports": true,
|
|
9
|
-
"moduleResolution": "node",
|
|
10
|
-
"target": "es6",
|
|
11
|
-
"sourceMap": true,
|
|
12
|
-
"outDir": "dist",
|
|
13
|
-
"baseUrl": "./src",
|
|
14
|
-
"rootDir": "./",
|
|
15
|
-
"incremental": true,
|
|
16
|
-
"skipLibCheck": true,
|
|
17
|
-
"noImplicitAny": false,
|
|
18
|
-
"strictBindCallApply": false,
|
|
19
|
-
"forceConsistentCasingInFileNames": false,
|
|
20
|
-
"noFallthroughCasesInSwitch": false,
|
|
21
|
-
"strictNullChecks": false,
|
|
22
|
-
},
|
|
23
|
-
"exclude": ["node_modules", "dist"]
|
|
24
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"removeComments": true,
|
|
6
|
+
"emitDecoratorMetadata": true,
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"moduleResolution": "node",
|
|
10
|
+
"target": "es6",
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"outDir": "dist",
|
|
13
|
+
"baseUrl": "./src",
|
|
14
|
+
"rootDir": "./",
|
|
15
|
+
"incremental": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"noImplicitAny": false,
|
|
18
|
+
"strictBindCallApply": false,
|
|
19
|
+
"forceConsistentCasingInFileNames": false,
|
|
20
|
+
"noFallthroughCasesInSwitch": false,
|
|
21
|
+
"strictNullChecks": false,
|
|
22
|
+
},
|
|
23
|
+
"exclude": ["node_modules", "dist"]
|
|
24
|
+
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
|
|
2
|
-
import { HirerSignatureModel } from '../../models/hirer-signature.entity';
|
|
3
|
-
|
|
4
|
-
export class HirerSignatureRepository
|
|
5
|
-
extends RepositoryBase<HirerSignatureModel>
|
|
6
|
-
implements IRepositoryBase<HirerSignatureModel>
|
|
7
|
-
{
|
|
8
|
-
constructor() {
|
|
9
|
-
super(HirerSignatureModel);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async findByPk(
|
|
13
|
-
id: string,
|
|
14
|
-
transaction?: any,
|
|
15
|
-
): Promise<HirerSignatureModel | null> {
|
|
16
|
-
try {
|
|
17
|
-
const result = await HirerSignatureModel.findByPk(id, {
|
|
18
|
-
transaction: transaction,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
return result;
|
|
22
|
-
} catch (error) {
|
|
23
|
-
throw new Error(`An Error occured when fetching : ${error.message}`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async delete(hirerId: string, dbTransaction?: any) {
|
|
28
|
-
try {
|
|
29
|
-
const options = {
|
|
30
|
-
where: {
|
|
31
|
-
HirerId: hirerId,
|
|
32
|
-
},
|
|
33
|
-
transaction: dbTransaction,
|
|
34
|
-
};
|
|
35
|
-
await HirerSignatureModel.destroy(options);
|
|
36
|
-
} catch (error) {
|
|
37
|
-
throw new Error(`An Error occured when delete : ${error.message}`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async findAndCountAll(options?: any) {
|
|
42
|
-
try {
|
|
43
|
-
let jointHirers: any;
|
|
44
|
-
if (options) {
|
|
45
|
-
jointHirers = await HirerSignatureModel.findAndCountAll(options);
|
|
46
|
-
} else {
|
|
47
|
-
jointHirers = await HirerSignatureModel.findAndCountAll();
|
|
48
|
-
}
|
|
49
|
-
return jointHirers;
|
|
50
|
-
} catch (error) {
|
|
51
|
-
throw new Error(`An Error occured when retriving : ${error.message}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { ClassError, ObjectBase } from '@tomei/general';
|
|
2
|
-
import { HirerSignatureRepository } from './hirer-signature.repository';
|
|
3
|
-
import { IHirerSignatureAttr } from '../../interfaces/hirer-signature-attr.interface';
|
|
4
|
-
import { ApplicationConfig } from '@tomei/config';
|
|
5
|
-
import { LoginUser } from '@tomei/sso';
|
|
6
|
-
import { ActionEnum, Activity } from '@tomei/activity-history';
|
|
7
|
-
import { HirerSignatureStatusEnum } from '../../enum/hirer-signature-status.enum';
|
|
8
|
-
|
|
9
|
-
export class HirerSignature extends ObjectBase {
|
|
10
|
-
ObjectId: string;
|
|
11
|
-
ObjectName: string;
|
|
12
|
-
ObjectType: string = 'HirerSignature';
|
|
13
|
-
TableName: string = 'rental_HirerSignature';
|
|
14
|
-
AgreementNo: string;
|
|
15
|
-
HirerType: string;
|
|
16
|
-
CustomerId: string;
|
|
17
|
-
CustomerType: string;
|
|
18
|
-
SignatureStatus: HirerSignatureStatusEnum;
|
|
19
|
-
SignedAt: Date;
|
|
20
|
-
CreatedById: string;
|
|
21
|
-
CreatedAt: Date;
|
|
22
|
-
UpdatedById: string;
|
|
23
|
-
UpdatedAt: Date;
|
|
24
|
-
|
|
25
|
-
get HirerSignatureId(): string {
|
|
26
|
-
return this.ObjectId;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
set HirerSignatureId(value: string) {
|
|
30
|
-
this.ObjectId = value;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
protected static _Repository = new HirerSignatureRepository();
|
|
34
|
-
|
|
35
|
-
protected constructor(hirerSignatureAttr?: IHirerSignatureAttr) {
|
|
36
|
-
super();
|
|
37
|
-
if (hirerSignatureAttr) {
|
|
38
|
-
this.HirerSignatureId = hirerSignatureAttr.HirerSignatureId;
|
|
39
|
-
this.AgreementNo = hirerSignatureAttr.AgreementNo;
|
|
40
|
-
this.HirerType = hirerSignatureAttr.HirerType;
|
|
41
|
-
this.CustomerId = hirerSignatureAttr.CustomerId;
|
|
42
|
-
this.CustomerType = hirerSignatureAttr.CustomerType;
|
|
43
|
-
this.SignatureStatus = hirerSignatureAttr.SignatureStatus;
|
|
44
|
-
this.SignedAt = hirerSignatureAttr.SignedAt;
|
|
45
|
-
this.CreatedById = hirerSignatureAttr.CreatedById;
|
|
46
|
-
this.CreatedAt = hirerSignatureAttr.CreatedAt;
|
|
47
|
-
this.UpdatedById = hirerSignatureAttr.UpdatedById;
|
|
48
|
-
this.UpdatedAt = hirerSignatureAttr.UpdatedAt;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
public static async init(HirerSignatureId?: string, dbTransaction?: any) {
|
|
53
|
-
try {
|
|
54
|
-
if (HirerSignatureId) {
|
|
55
|
-
const hs = await HirerSignature._Repository.findByPk(
|
|
56
|
-
HirerSignatureId,
|
|
57
|
-
dbTransaction,
|
|
58
|
-
);
|
|
59
|
-
if (hs) {
|
|
60
|
-
return new HirerSignature(hs.get({ plain: true }));
|
|
61
|
-
} else {
|
|
62
|
-
throw new ClassError(
|
|
63
|
-
'HirerSignature',
|
|
64
|
-
'HirerSignatureErrMsg01',
|
|
65
|
-
'HirerSignature not found',
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return new HirerSignature();
|
|
70
|
-
} catch (error) {
|
|
71
|
-
throw error;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
public async create(loginUser: LoginUser, dbTransaction?: any) {
|
|
76
|
-
try {
|
|
77
|
-
const systemCode =
|
|
78
|
-
ApplicationConfig.getComponentConfigValue('system-code');
|
|
79
|
-
const isPrivileged = await loginUser.checkPrivileges(
|
|
80
|
-
systemCode,
|
|
81
|
-
'HirerSignature - Create',
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
if (!isPrivileged) {
|
|
85
|
-
throw new ClassError(
|
|
86
|
-
'HirerSignature',
|
|
87
|
-
'HirerSignatureErrMsg00',
|
|
88
|
-
"You do not have 'HirerSignature - Create' privilege.",
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (!this.AgreementNo || !this.CustomerId || !this.CustomerType) {
|
|
93
|
-
throw new ClassError(
|
|
94
|
-
'HirerSignature',
|
|
95
|
-
'HirerSignatureErrMsg03',
|
|
96
|
-
'AgreementNo, CustomerId and CustomerType are required.',
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
this.ObjectId = this.createId();
|
|
101
|
-
this.CreatedById = loginUser.ObjectId;
|
|
102
|
-
this.CreatedAt = new Date();
|
|
103
|
-
this.UpdatedById = loginUser.ObjectId;
|
|
104
|
-
this.UpdatedAt = new Date();
|
|
105
|
-
|
|
106
|
-
const entityValueAfter: IHirerSignatureAttr = {
|
|
107
|
-
HirerSignatureId: this.HirerSignatureId,
|
|
108
|
-
AgreementNo: this.AgreementNo,
|
|
109
|
-
HirerType: this.HirerType,
|
|
110
|
-
CustomerId: this.CustomerId,
|
|
111
|
-
CustomerType: this.CustomerType,
|
|
112
|
-
SignatureStatus: this.SignatureStatus,
|
|
113
|
-
SignedAt: this.SignedAt,
|
|
114
|
-
CreatedById: this.CreatedById,
|
|
115
|
-
CreatedAt: this.CreatedAt,
|
|
116
|
-
UpdatedById: this.UpdatedById,
|
|
117
|
-
UpdatedAt: this.UpdatedAt,
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
await HirerSignature._Repository.create(entityValueAfter, {
|
|
121
|
-
transaction: dbTransaction,
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
const activity = new Activity();
|
|
125
|
-
activity.ObjectId = this.createId();
|
|
126
|
-
activity.Action = ActionEnum.CREATE;
|
|
127
|
-
activity.Description = 'Add Joint Hirer Signature';
|
|
128
|
-
activity.EntityId = this.ObjectId;
|
|
129
|
-
activity.EntityType = this.ObjectType;
|
|
130
|
-
activity.EntityValueBefore = JSON.stringify({});
|
|
131
|
-
activity.EntityValueAfter = JSON.stringify(entityValueAfter);
|
|
132
|
-
|
|
133
|
-
await activity.create(loginUser.ObjectId, dbTransaction);
|
|
134
|
-
|
|
135
|
-
return this;
|
|
136
|
-
} catch (error) {
|
|
137
|
-
throw error;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { HirerSignatureStatusEnum } from '../enum/hirer-signature-status.enum';
|
|
2
|
-
|
|
3
|
-
export interface IHirerSignatureAttr {
|
|
4
|
-
HirerSignatureId: string;
|
|
5
|
-
AgreementNo: string;
|
|
6
|
-
HirerType: string;
|
|
7
|
-
CustomerId: string;
|
|
8
|
-
CustomerType: string;
|
|
9
|
-
SignatureStatus: HirerSignatureStatusEnum;
|
|
10
|
-
SignedAt: Date;
|
|
11
|
-
CreatedById: string;
|
|
12
|
-
CreatedAt: Date;
|
|
13
|
-
UpdatedById: string;
|
|
14
|
-
UpdatedAt: Date;
|
|
15
|
-
}
|