@tomei/rental 0.17.3-dev.6 → 0.17.3-dev.8
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/components/agreement-signature/agreement-signature.d.ts +4 -0
- package/dist/components/agreement-signature/agreement-signature.js +8 -0
- package/dist/components/agreement-signature/agreement-signature.js.map +1 -1
- package/dist/components/rental/rental.d.ts +2 -1
- package/dist/components/rental/rental.js +4 -1
- package/dist/components/rental/rental.js.map +1 -1
- package/dist/enum/agreement-signature-verification-method.enum.d.ts +4 -0
- package/dist/enum/agreement-signature-verification-method.enum.js +9 -0
- package/dist/enum/agreement-signature-verification-method.enum.js.map +1 -0
- package/dist/enum/index.d.ts +2 -1
- package/dist/enum/index.js +3 -1
- package/dist/enum/index.js.map +1 -1
- package/dist/interfaces/agreemeent-signature-attr.interface.d.ts +4 -0
- package/dist/models/agreement-signature.entity.d.ts +4 -0
- package/dist/models/agreement-signature.entity.js +22 -0
- package/dist/models/agreement-signature.entity.js.map +1 -1
- package/dist/src/ClassMappings/ItemClassMap.d.ts +4 -0
- package/dist/src/ClassMappings/ItemClassMap.js +8 -0
- package/dist/src/ClassMappings/ItemClassMap.js.map +1 -0
- package/dist/src/ClassMappings/index.d.ts +2 -0
- package/dist/src/ClassMappings/index.js +6 -0
- package/dist/src/ClassMappings/index.js.map +1 -0
- package/dist/src/components/agreement/agreement.js +91 -72
- package/dist/src/components/agreement/agreement.js.map +1 -1
- package/dist/src/components/agreement/agreement.repository.js +50 -35
- package/dist/src/components/agreement/agreement.repository.js.map +1 -1
- package/dist/src/components/agreement-history/agreement-history.js +21 -10
- package/dist/src/components/agreement-history/agreement-history.js.map +1 -1
- package/dist/src/components/agreement-history/agreement-history.repository.js +50 -35
- package/dist/src/components/agreement-history/agreement-history.repository.js.map +1 -1
- package/dist/src/components/agreement-signature/agreement-signature.js +70 -57
- package/dist/src/components/agreement-signature/agreement-signature.js.map +1 -1
- package/dist/src/components/agreement-signature/agreement-signature.repository.js +51 -36
- package/dist/src/components/agreement-signature/agreement-signature.repository.js.map +1 -1
- package/dist/src/components/booking/booking.js +231 -206
- package/dist/src/components/booking/booking.js.map +1 -1
- package/dist/src/components/booking/booking.repository.js +50 -35
- package/dist/src/components/booking/booking.repository.js.map +1 -1
- package/dist/src/components/hirer-change-request-new-hirer/hirer-change-request-new-hirer.js +62 -47
- package/dist/src/components/hirer-change-request-new-hirer/hirer-change-request-new-hirer.js.map +1 -1
- package/dist/src/components/hirer-change-request-new-hirer/hirer-change-request-new-hirer.repository.js +63 -46
- package/dist/src/components/hirer-change-request-new-hirer/hirer-change-request-new-hirer.repository.js.map +1 -1
- package/dist/src/components/hirer-change-request-remove-hirer/hirer-change-request-remove-hirer.js +64 -49
- package/dist/src/components/hirer-change-request-remove-hirer/hirer-change-request-remove-hirer.js.map +1 -1
- package/dist/src/components/hirer-change-request-remove-hirer/hirer-change-request-remove-hirer.repository.js +64 -47
- package/dist/src/components/hirer-change-request-remove-hirer/hirer-change-request-remove-hirer.repository.js.map +1 -1
- package/dist/src/components/hirer-change-request-signature/hirer-change-request-signature.js +167 -150
- package/dist/src/components/hirer-change-request-signature/hirer-change-request-signature.js.map +1 -1
- package/dist/src/components/hirer-change-request-signature/hirer-change-request-signature.repository.js +64 -47
- package/dist/src/components/hirer-change-request-signature/hirer-change-request-signature.repository.js.map +1 -1
- package/dist/src/components/joint-hirer/joint-hirer.d.ts +2 -0
- package/dist/src/components/joint-hirer/joint-hirer.js +133 -81
- package/dist/src/components/joint-hirer/joint-hirer.js.map +1 -1
- package/dist/src/components/joint-hirer/joint-hirer.repository.js +50 -35
- package/dist/src/components/joint-hirer/joint-hirer.repository.js.map +1 -1
- package/dist/src/components/rental/rental.d.ts +12 -3
- package/dist/src/components/rental/rental.js +755 -549
- package/dist/src/components/rental/rental.js.map +1 -1
- package/dist/src/components/rental/rental.repository.js +50 -35
- package/dist/src/components/rental/rental.repository.js.map +1 -1
- package/dist/src/components/rental-hirer-change-request/rental-hirer-change-request.js +456 -416
- package/dist/src/components/rental-hirer-change-request/rental-hirer-change-request.js.map +1 -1
- package/dist/src/components/rental-hirer-change-request/rental-hirer-change-request.repository.js +63 -46
- package/dist/src/components/rental-hirer-change-request/rental-hirer-change-request.repository.js.map +1 -1
- package/dist/src/components/rental-price/rental-price.js +46 -33
- package/dist/src/components/rental-price/rental-price.js.map +1 -1
- package/dist/src/components/rental-price/rental-price.repository.js +50 -35
- package/dist/src/components/rental-price/rental-price.repository.js.map +1 -1
- package/dist/src/enum/agreement-signature-verification-method.enum.d.ts +4 -0
- package/dist/src/enum/agreement-signature-verification-method.enum.js +9 -0
- package/dist/src/enum/agreement-signature-verification-method.enum.js.map +1 -0
- package/dist/src/enum/index.d.ts +2 -1
- package/dist/src/enum/index.js +3 -1
- package/dist/src/enum/index.js.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +3 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/models/agreement-signature.entity.d.ts +4 -0
- package/dist/src/models/agreement-signature.entity.js +22 -0
- package/dist/src/models/agreement-signature.entity.js.map +1 -1
- package/dist/src/models/hirer-change-request-new-hirer.entity.d.ts +1 -1
- package/dist/src/models/hirer-change-request-remove-hirer.entity.d.ts +1 -1
- package/dist/src/models/hirer-change-request-signature.entity.d.ts +1 -1
- package/dist/src/models/joint-hirer.entity.js +0 -4
- package/dist/src/models/joint-hirer.entity.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/migrations/agreement-signature-table-migration.js +12 -0
- package/package.json +1 -1
- package/src/components/agreement-signature/agreement-signature.ts +12 -0
- package/src/components/rental/rental.ts +7 -1
- package/src/enum/agreement-signature-verification-method.enum.ts +4 -0
- package/src/enum/index.ts +2 -0
- package/src/interfaces/agreemeent-signature-attr.interface.ts +4 -0
- package/src/models/agreement-signature.entity.ts +19 -0
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.JointHirer = void 0;
|
|
4
13
|
const general_1 = require("@tomei/general");
|
|
5
14
|
const joint_hirer_repository_1 = require("./joint-hirer.repository");
|
|
6
15
|
const config_1 = require("@tomei/config");
|
|
7
16
|
const activity_history_1 = require("@tomei/activity-history");
|
|
17
|
+
const rental_1 = require("../rental/rental");
|
|
18
|
+
const account_type_enum_1 = require("../../enum/account-type.enum");
|
|
8
19
|
class JointHirer extends general_1.ObjectBase {
|
|
9
20
|
get HirerId() {
|
|
10
21
|
return this.ObjectId;
|
|
@@ -42,94 +53,135 @@ class JointHirer extends general_1.ObjectBase {
|
|
|
42
53
|
UpdatedAt: this.UpdatedAt,
|
|
43
54
|
};
|
|
44
55
|
}
|
|
45
|
-
static
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
static init(hirerId, dbTransaction) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
try {
|
|
59
|
+
if (hirerId) {
|
|
60
|
+
const jr = yield JointHirer._Repository.findByPk(hirerId, dbTransaction);
|
|
61
|
+
if (jr) {
|
|
62
|
+
return new JointHirer(jr.get({ plain: true }));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
throw new general_1.ClassError('JointHirer', 'JointHirerErrMsg01', 'JointHirer not found');
|
|
66
|
+
}
|
|
51
67
|
}
|
|
52
|
-
|
|
53
|
-
|
|
68
|
+
return new JointHirer();
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
create(loginUser, dbTransaction) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
try {
|
|
78
|
+
const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
|
|
79
|
+
const isPrivileged = yield loginUser.checkPrivileges(systemCode, 'JointHirer - Create');
|
|
80
|
+
if (!isPrivileged) {
|
|
81
|
+
throw new general_1.ClassError('JointHirer', 'JointHirerErrMsg00', "You do not have 'JointHirer - Create' privilege.");
|
|
82
|
+
}
|
|
83
|
+
if (!this.RentalId || !this.CustomerId || !this.CustomerType) {
|
|
84
|
+
throw new general_1.ClassError('JointHirer', 'JointHirerErrMsg03', 'RentalId, CustomerId and CustomerType are required.');
|
|
85
|
+
}
|
|
86
|
+
this.ObjectId = this.createId();
|
|
87
|
+
this.CreatedById = loginUser.ObjectId;
|
|
88
|
+
this.CreatedAt = new Date();
|
|
89
|
+
this.UpdatedById = loginUser.ObjectId;
|
|
90
|
+
this.UpdatedAt = new Date();
|
|
91
|
+
const entityValueAfter = {
|
|
92
|
+
HirerId: this.HirerId,
|
|
93
|
+
RentalId: this.RentalId,
|
|
94
|
+
CustomerId: this.CustomerId,
|
|
95
|
+
CustomerType: this.CustomerType,
|
|
96
|
+
Status: this.Status,
|
|
97
|
+
CreatedById: this.CreatedById,
|
|
98
|
+
CreatedAt: this.CreatedAt,
|
|
99
|
+
UpdatedById: this.UpdatedById,
|
|
100
|
+
UpdatedAt: this.UpdatedAt,
|
|
101
|
+
};
|
|
102
|
+
yield JointHirer._Repository.create(entityValueAfter, {
|
|
103
|
+
transaction: dbTransaction,
|
|
104
|
+
});
|
|
105
|
+
const activity = new activity_history_1.Activity();
|
|
106
|
+
activity.ObjectId = this._createId();
|
|
107
|
+
activity.Action = activity_history_1.ActionEnum.CREATE;
|
|
108
|
+
activity.Description = 'Add Joint Hirer';
|
|
109
|
+
activity.EntityId = this.ObjectId;
|
|
110
|
+
activity.EntityType = this.ObjectType;
|
|
111
|
+
activity.EntityValueBefore = JSON.stringify({});
|
|
112
|
+
activity.EntityValueAfter = JSON.stringify(entityValueAfter);
|
|
113
|
+
yield activity.create(loginUser.ObjectId, dbTransaction);
|
|
114
|
+
const rental = yield this.getRental(dbTransaction);
|
|
115
|
+
const totalIds = yield rental.getCustomerIds(loginUser, dbTransaction);
|
|
116
|
+
if (totalIds.length > 1 && rental.AccountType === 'Single') {
|
|
117
|
+
yield rental.update(loginUser, dbTransaction, {
|
|
118
|
+
AccountType: account_type_enum_1.RentalAccountTypeEnum.JOINT,
|
|
119
|
+
});
|
|
54
120
|
}
|
|
121
|
+
return this;
|
|
55
122
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
61
127
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
128
|
+
remove(loginUser, dbTransaction) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
try {
|
|
131
|
+
if (!this.HirerId) {
|
|
132
|
+
throw new general_1.ClassError('JointHirer', 'JointHirerErrMsg02', 'HirerId is required to remove Joint Hirer.');
|
|
133
|
+
}
|
|
134
|
+
if (this.Status === 'Inactive') {
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
const entityValueBefore = this.toJSON();
|
|
138
|
+
this.Status = 'Inactive';
|
|
139
|
+
this.UpdatedById = loginUser.ObjectId;
|
|
140
|
+
this.UpdatedAt = new Date();
|
|
141
|
+
const entityValueAfter = this.toJSON();
|
|
142
|
+
yield JointHirer._Repository.update(entityValueAfter, {
|
|
143
|
+
where: {
|
|
144
|
+
HirerId: this.HirerId,
|
|
145
|
+
},
|
|
146
|
+
transaction: dbTransaction,
|
|
147
|
+
});
|
|
148
|
+
const activity = new activity_history_1.Activity();
|
|
149
|
+
activity.ObjectId = this._createId();
|
|
150
|
+
activity.Action = activity_history_1.ActionEnum.UPDATE;
|
|
151
|
+
activity.Description = 'Mark Joint Hirer as Inactive';
|
|
152
|
+
activity.EntityId = this.ObjectId;
|
|
153
|
+
activity.EntityType = this.ObjectType;
|
|
154
|
+
activity.EntityValueBefore = JSON.stringify(entityValueBefore);
|
|
155
|
+
activity.EntityValueAfter = JSON.stringify(entityValueAfter);
|
|
156
|
+
yield activity.create(loginUser.ObjectId, dbTransaction);
|
|
157
|
+
const rental = yield this.getRental(dbTransaction);
|
|
158
|
+
const totalIds = yield rental.getCustomerIds(loginUser, dbTransaction);
|
|
159
|
+
if (totalIds.length === 1 && rental.AccountType === 'Joint') {
|
|
160
|
+
yield rental.update(loginUser, dbTransaction, {
|
|
161
|
+
AccountType: account_type_enum_1.RentalAccountTypeEnum.SINGLE,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
return this;
|
|
68
165
|
}
|
|
69
|
-
|
|
70
|
-
throw
|
|
166
|
+
catch (error) {
|
|
167
|
+
throw error;
|
|
71
168
|
}
|
|
72
|
-
|
|
73
|
-
this.CreatedById = loginUser.ObjectId;
|
|
74
|
-
this.CreatedAt = new Date();
|
|
75
|
-
this.UpdatedById = loginUser.ObjectId;
|
|
76
|
-
this.UpdatedAt = new Date();
|
|
77
|
-
const entityValueAfter = {
|
|
78
|
-
HirerId: this.HirerId,
|
|
79
|
-
RentalId: this.RentalId,
|
|
80
|
-
CustomerId: this.CustomerId,
|
|
81
|
-
CustomerType: this.CustomerType,
|
|
82
|
-
Status: this.Status,
|
|
83
|
-
CreatedById: this.CreatedById,
|
|
84
|
-
CreatedAt: this.CreatedAt,
|
|
85
|
-
UpdatedById: this.UpdatedById,
|
|
86
|
-
UpdatedAt: this.UpdatedAt,
|
|
87
|
-
};
|
|
88
|
-
await JointHirer._Repository.create(entityValueAfter, {
|
|
89
|
-
transaction: dbTransaction,
|
|
90
|
-
});
|
|
91
|
-
const activity = new activity_history_1.Activity();
|
|
92
|
-
activity.ObjectId = this._createId();
|
|
93
|
-
activity.Action = activity_history_1.ActionEnum.CREATE;
|
|
94
|
-
activity.Description = 'Add Joint Hirer';
|
|
95
|
-
activity.EntityId = this.ObjectId;
|
|
96
|
-
activity.EntityType = this.ObjectType;
|
|
97
|
-
activity.EntityValueBefore = JSON.stringify({});
|
|
98
|
-
activity.EntityValueAfter = JSON.stringify(entityValueAfter);
|
|
99
|
-
await activity.create(loginUser.ObjectId, dbTransaction);
|
|
100
|
-
return this;
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
throw error;
|
|
104
|
-
}
|
|
169
|
+
});
|
|
105
170
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
this.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
activity.ObjectId = this._createId();
|
|
121
|
-
activity.Action = activity_history_1.ActionEnum.UPDATE;
|
|
122
|
-
activity.Description = 'Mark Joint Hirer as Inactive';
|
|
123
|
-
activity.EntityId = this.ObjectId;
|
|
124
|
-
activity.EntityType = this.ObjectType;
|
|
125
|
-
activity.EntityValueBefore = JSON.stringify(entityValueBefore);
|
|
126
|
-
activity.EntityValueAfter = JSON.stringify(entityValueAfter);
|
|
127
|
-
await activity.create(loginUser.ObjectId, dbTransaction);
|
|
128
|
-
return this;
|
|
129
|
-
}
|
|
130
|
-
catch (error) {
|
|
131
|
-
throw error;
|
|
132
|
-
}
|
|
171
|
+
getRental(dbTransaction) {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
if (this._Rental) {
|
|
174
|
+
return this._Rental;
|
|
175
|
+
}
|
|
176
|
+
if (!this.RentalId) {
|
|
177
|
+
throw new general_1.ClassError('JointHirer', 'JointHirerErrMsg04', 'RentalId is empty.');
|
|
178
|
+
}
|
|
179
|
+
this._Rental = yield rental_1.Rental.init(dbTransaction, this.RentalId);
|
|
180
|
+
if (!this._Rental) {
|
|
181
|
+
throw new general_1.ClassError('JointHirer', 'JointHirerErrMsg05', 'Rental not found.');
|
|
182
|
+
}
|
|
183
|
+
return this._Rental;
|
|
184
|
+
});
|
|
133
185
|
}
|
|
134
186
|
}
|
|
135
187
|
exports.JointHirer = JointHirer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"joint-hirer.js","sourceRoot":"","sources":["../../../../src/components/joint-hirer/joint-hirer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"joint-hirer.js","sourceRoot":"","sources":["../../../../src/components/joint-hirer/joint-hirer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAwD;AACxD,qEAAgE;AAEhE,0CAAkD;AAElD,8DAA+D;AAC/D,6CAA0C;AAC1C,oEAAqE;AAErE,MAAa,UAAW,SAAQ,oBAAU;IAexC,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAI,OAAO,CAAC,KAAa;QACvB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IAID,YAAsB,cAAgC;QACpD,KAAK,EAAE,CAAC;QAvBV,eAAU,GAAW,YAAY,CAAC;QAClC,cAAS,GAAW,mBAAmB,CAAC;QAIxC,WAAM,GAAG,QAAQ,CAAC;QAmBhB,IAAI,cAAc,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC;YACtC,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,QAAQ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OAAO,CAAC;QACtB,CAAC;KAAA;;AAjPH,gCAkPC;AA3NkB,sBAAW,GAAG,IAAI,6CAAoB,EAAE,AAA7B,CAA8B"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.JointHirerRepository = void 0;
|
|
4
13
|
const general_1 = require("@tomei/general");
|
|
@@ -7,45 +16,51 @@ class JointHirerRepository extends general_1.RepositoryBase {
|
|
|
7
16
|
constructor() {
|
|
8
17
|
super(joint_hirer_entity_1.JointHirerModel);
|
|
9
18
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
findByPk(id, transaction) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
try {
|
|
22
|
+
const result = yield joint_hirer_entity_1.JointHirerModel.findByPk(id, {
|
|
23
|
+
transaction: transaction,
|
|
24
|
+
});
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw new Error(`An Error occured when fetching : ${error.message}`);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
20
31
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
delete(hirerId, dbTransaction) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
try {
|
|
35
|
+
const options = {
|
|
36
|
+
where: {
|
|
37
|
+
HirerId: hirerId,
|
|
38
|
+
},
|
|
39
|
+
transaction: dbTransaction,
|
|
40
|
+
};
|
|
41
|
+
yield joint_hirer_entity_1.JointHirerModel.destroy(options);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
throw new Error(`An Error occured when delete : ${error.message}`);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
34
47
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
48
|
+
findAndCountAll(options) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
try {
|
|
51
|
+
let jointHirers;
|
|
52
|
+
if (options) {
|
|
53
|
+
jointHirers = yield joint_hirer_entity_1.JointHirerModel.findAndCountAll(options);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
jointHirers = yield joint_hirer_entity_1.JointHirerModel.findAndCountAll();
|
|
57
|
+
}
|
|
58
|
+
return jointHirers;
|
|
40
59
|
}
|
|
41
|
-
|
|
42
|
-
|
|
60
|
+
catch (error) {
|
|
61
|
+
throw new Error(`An Error occured when retriving : ${error.message}`);
|
|
43
62
|
}
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
throw new Error(`An Error occured when retriving : ${error.message}`);
|
|
48
|
-
}
|
|
63
|
+
});
|
|
49
64
|
}
|
|
50
65
|
}
|
|
51
66
|
exports.JointHirerRepository = JointHirerRepository;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"joint-hirer.repository.js","sourceRoot":"","sources":["../../../../src/components/joint-hirer/joint-hirer.repository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"joint-hirer.repository.js","sourceRoot":"","sources":["../../../../src/components/joint-hirer/joint-hirer.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAiE;AACjE,wEAAkE;AAElE,MAAa,oBACX,SAAQ,wBAA+B;IAGvC;QACE,KAAK,CAAC,oCAAe,CAAC,CAAC;IACzB,CAAC;IAEK,QAAQ,CACZ,EAAU,EACV,WAAiB;;YAEjB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,oCAAe,CAAC,QAAQ,CAAC,EAAE,EAAE;oBAChD,WAAW,EAAE,WAAW;iBACzB,CAAC,CAAC;gBAEH,OAAO,MAAM,CAAC;YAChB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,oCAAoC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;KAAA;IAEK,MAAM,CAAC,OAAe,EAAE,aAAmB;;YAC/C,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG;oBACd,KAAK,EAAE;wBACL,OAAO,EAAE,OAAO;qBACjB;oBACD,WAAW,EAAE,aAAa;iBAC3B,CAAC;gBACF,MAAM,oCAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACzC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,kCAAkC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;KAAA;IAEK,eAAe,CAAC,OAAa;;YACjC,IAAI,CAAC;gBACH,IAAI,WAAgB,CAAC;gBACrB,IAAI,OAAO,EAAE,CAAC;oBACZ,WAAW,GAAG,MAAM,oCAAe,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;gBAC/D,CAAC;qBAAM,CAAC;oBACN,WAAW,GAAG,MAAM,oCAAe,CAAC,eAAe,EAAE,CAAC;gBACxD,CAAC;gBACD,OAAO,WAAW,CAAC;YACrB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,qCAAqC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACxE,CAAC;QACH,CAAC;KAAA;CACF;AAlDD,oDAkDC"}
|
|
@@ -2,7 +2,7 @@ import { IRentalAttr } from '../../interfaces/rental-attr.interface';
|
|
|
2
2
|
import { RentalStatusEnum } from '../../enum/rental-status.enum';
|
|
3
3
|
import { RentalRepository } from './rental.repository';
|
|
4
4
|
import { ObjectBase } from '@tomei/general';
|
|
5
|
-
import {
|
|
5
|
+
import { LoginUser } from '@tomei/sso';
|
|
6
6
|
import { RentalPrice } from '../rental-price/rental-price';
|
|
7
7
|
import { IRentalFindAllSearchAttr } from '../../interfaces/rental-find-all-search-attr.interface';
|
|
8
8
|
import { RentalAccountTypeEnum } from '../../enum/account-type.enum';
|
|
@@ -11,6 +11,8 @@ import { AgreementRepository } from '../agreement/agreement.repository';
|
|
|
11
11
|
import { JointHirerRepository } from '../joint-hirer/joint-hirer.repository';
|
|
12
12
|
import { AgreementSignatureRepository } from '../agreement-signature/agreement-signature.repository';
|
|
13
13
|
import { AgreementHistoryRepository } from '../agreement-history/agreement-history.repository';
|
|
14
|
+
import { Document, IAccountSystem } from '@tomei/finance';
|
|
15
|
+
import { AgreementSignatureVerificationMethodEnum } from '../../enum/agreement-signature-verification-method.enum';
|
|
14
16
|
export declare class Rental extends ObjectBase {
|
|
15
17
|
ObjectId: string;
|
|
16
18
|
ObjectName: string;
|
|
@@ -28,6 +30,8 @@ export declare class Rental extends ObjectBase {
|
|
|
28
30
|
AgreementNo: string;
|
|
29
31
|
AccountType: RentalAccountTypeEnum;
|
|
30
32
|
JointHirers: JointHirer[];
|
|
33
|
+
Invoices: Document[];
|
|
34
|
+
Item: any;
|
|
31
35
|
protected _Status: RentalStatusEnum | string;
|
|
32
36
|
protected _EscheatmentYN: string;
|
|
33
37
|
protected _CreatedById: string;
|
|
@@ -52,13 +56,18 @@ export declare class Rental extends ObjectBase {
|
|
|
52
56
|
static init(dbTransaction?: any, rentalId?: string): Promise<Rental>;
|
|
53
57
|
create(rentalPrice: RentalPrice, loginUser: LoginUser, jointHirers?: JointHirer[], dbTransaction?: any): Promise<any>;
|
|
54
58
|
static isItemAvailable(itemId: string, itemType: string, startDateTime: Date, endDateTime: Date, dbTransaction?: any): Promise<boolean>;
|
|
55
|
-
static findAll(
|
|
59
|
+
static findAll(loginUser: LoginUser, dbTransaction: any, page?: number, row?: number, search?: IRentalFindAllSearchAttr): Promise<any>;
|
|
56
60
|
static checkActiveByItemId(loginUser: LoginUser, itemId: string, itemType: string, dbTransaction?: any): Promise<boolean>;
|
|
57
61
|
setStartDateTime(startDateTime: Date): void;
|
|
58
62
|
periodEndProcess(loginUser: LoginUser, dbTransaction: any, stockInventory: any): Promise<this>;
|
|
59
63
|
getCustomerActiveRentals(loginUser: LoginUser, dbTransaction: any, CustomerId: string): Promise<IRentalAttr[]>;
|
|
60
64
|
getJointHirers(dbTransaction: any): Promise<JointHirer[]>;
|
|
61
65
|
getCustomerIds(loginUser: LoginUser, dbTransaction: any): Promise<string[]>;
|
|
62
|
-
signAgreement(loginUser: LoginUser, party: string, PartyId: string, PartyType: string, dbTransaction: any, statusAfterSign?: RentalStatusEnum | string): Promise<void>;
|
|
66
|
+
signAgreement(loginUser: LoginUser, party: string, PartyId: string, PartyType: string, dbTransaction: any, statusAfterSign?: RentalStatusEnum | string, method?: AgreementSignatureVerificationMethodEnum, justification?: string): Promise<void>;
|
|
63
67
|
generateAgreement(loginUser: LoginUser, dbTransaction: any, MediaId: string): Promise<void>;
|
|
68
|
+
toJSON(): IRentalAttr;
|
|
69
|
+
getInvoices(loginUser: LoginUser, dbTransaction: any, accountingSystem?: IAccountSystem): Promise<Document[]>;
|
|
70
|
+
getItem(dbTransaction: any): Promise<any>;
|
|
71
|
+
cancel(loginUser: LoginUser, dbTransaction: any, remarks: string): Promise<Rental>;
|
|
72
|
+
update(loginUser: LoginUser, dbTransaction: any, updates: Partial<IRentalAttr>): Promise<Rental>;
|
|
64
73
|
}
|