@tomei/rental 0.17.3-dev.4 → 0.17.3-staging.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 (41) hide show
  1. package/dist/src/ClassMappings/ItemClassMap.d.ts +4 -0
  2. package/dist/src/ClassMappings/ItemClassMap.js +8 -0
  3. package/dist/src/ClassMappings/ItemClassMap.js.map +1 -0
  4. package/dist/src/ClassMappings/index.d.ts +2 -0
  5. package/dist/src/ClassMappings/index.js +6 -0
  6. package/dist/src/ClassMappings/index.js.map +1 -0
  7. package/dist/src/components/agreement/agreement.d.ts +1 -1
  8. package/dist/src/components/rental/rental.d.ts +7 -0
  9. package/dist/src/components/rental/rental.js +135 -0
  10. package/dist/src/components/rental/rental.js.map +1 -1
  11. package/dist/src/index.d.ts +2 -1
  12. package/dist/src/index.js +3 -1
  13. package/dist/src/index.js.map +1 -1
  14. package/dist/tsconfig.tsbuildinfo +1 -1
  15. package/package.json +9 -4
  16. package/src/ClassMappings/ItemClassMap.ts +7 -0
  17. package/src/ClassMappings/index.ts +3 -0
  18. package/src/components/agreement/agreement.ts +1 -1
  19. package/src/components/rental/rental.ts +226 -0
  20. package/src/index.ts +2 -0
  21. package/dist/src/components/agreement-signature/hirer-signature.d.ts +0 -27
  22. package/dist/src/components/agreement-signature/hirer-signature.js +0 -112
  23. package/dist/src/components/agreement-signature/hirer-signature.js.map +0 -1
  24. package/dist/src/components/agreement-signature/hirer-signature.repository.d.ts +0 -8
  25. package/dist/src/components/agreement-signature/hirer-signature.repository.js +0 -67
  26. package/dist/src/components/agreement-signature/hirer-signature.repository.js.map +0 -1
  27. package/dist/src/components/hirer-signature/hirer-signature.d.ts +0 -27
  28. package/dist/src/components/hirer-signature/hirer-signature.js +0 -112
  29. package/dist/src/components/hirer-signature/hirer-signature.js.map +0 -1
  30. package/dist/src/components/hirer-signature/hirer-signature.repository.d.ts +0 -8
  31. package/dist/src/components/hirer-signature/hirer-signature.repository.js +0 -67
  32. package/dist/src/components/hirer-signature/hirer-signature.repository.js.map +0 -1
  33. package/dist/src/enum/hirer-signature-status.enum.d.ts +0 -4
  34. package/dist/src/enum/hirer-signature-status.enum.js +0 -9
  35. package/dist/src/enum/hirer-signature-status.enum.js.map +0 -1
  36. package/dist/src/interfaces/hirer-signature-attr.interface.d.ts +0 -14
  37. package/dist/src/interfaces/hirer-signature-attr.interface.js +0 -3
  38. package/dist/src/interfaces/hirer-signature-attr.interface.js.map +0 -1
  39. package/dist/src/models/hirer-signature.entity.d.ts +0 -16
  40. package/dist/src/models/hirer-signature.entity.js +0 -100
  41. package/dist/src/models/hirer-signature.entity.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/rental",
3
- "version": "0.17.3-dev.4",
3
+ "version": "0.17.3-staging.1",
4
4
  "description": "Tomei Rental Package",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -59,11 +59,13 @@
59
59
  "peerDependencies": {
60
60
  "@tomei/activity-history": "^0.4.1",
61
61
  "@tomei/config": "^0.3.21",
62
- "@tomei/general": "^0.21.3",
62
+ "@tomei/finance": "^0.11.7-staging.12",
63
+ "@tomei/general": "^0.21.7",
63
64
  "@tomei/sso": "^0.60.4",
64
- "luxon": "^3.5.0",
65
+ "@tomei/stock": "^0.18.1",
66
+ "luxon": "^3.6.1",
65
67
  "reflect-metadata": "^0.2.2",
66
- "sequelize": "^6.37.5",
68
+ "sequelize": "^6.37.7",
67
69
  "sequelize-typescript": "^2.1.6"
68
70
  },
69
71
  "lint-staged": {
@@ -71,5 +73,8 @@
71
73
  "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
72
74
  "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
73
75
  ]
76
+ },
77
+ "overrides": {
78
+ "glob": "^9.0.0"
74
79
  }
75
80
  }
@@ -0,0 +1,7 @@
1
+ // Import all item classes that Rental might reference
2
+ import { StockInventory } from '@tomei/stock';
3
+
4
+ // Create and export the mapping
5
+ export const ItemClassMap = {
6
+ StockInventory,
7
+ };
@@ -0,0 +1,3 @@
1
+ import { ItemClassMap } from './ItemClassMap';
2
+
3
+ export { ItemClassMap };
@@ -9,7 +9,7 @@ import * as rentalDb from '../../database';
9
9
  import { QueryTypes, where } from 'sequelize';
10
10
  import { IResponseAgreementSignature } from '../../interfaces/response-hirer-signature-attr.interface';
11
11
  import { AgreementHistoryRepository } from '../agreement-history/agreement-history.repository';
12
- import { IAgreementHistoryAttr } from 'interfaces/agreement-history-attr.interface';
12
+ import { IAgreementHistoryAttr } from '../../interfaces/agreement-history-attr.interface';
13
13
  import { ActionEnum, Activity } from '@tomei/activity-history';
14
14
 
15
15
  export class Agreement extends ObjectBase {
@@ -22,6 +22,8 @@ import { AgreementSignatureRepository } from '../agreement-signature/agreement-s
22
22
  import { AgreementSignatureStatusEnum } from '../../enum/agreement-signature-status.enum';
23
23
  import { HirerTypeEnum } from '../../enum/hirer-type.enum';
24
24
  import { AgreementHistoryRepository } from '../agreement-history/agreement-history.repository';
25
+ import { DocType, Document, IAccountSystem } from '@tomei/finance';
26
+ import { ItemClassMap } from '../../ClassMappings/ItemClassMap';
25
27
 
26
28
  export class Rental extends ObjectBase {
27
29
  ObjectId: string;
@@ -40,6 +42,8 @@ export class Rental extends ObjectBase {
40
42
  AgreementNo: string;
41
43
  AccountType: RentalAccountTypeEnum;
42
44
  JointHirers: JointHirer[] = [];
45
+ Invoices: Document[] = [];
46
+ Item: any;
43
47
  protected _Status: RentalStatusEnum | string;
44
48
  protected _EscheatmentYN: string = 'N';
45
49
  protected _CreatedById: string;
@@ -1164,4 +1168,226 @@ export class Rental extends ObjectBase {
1164
1168
  throw error;
1165
1169
  }
1166
1170
  }
1171
+
1172
+ public toJSON(): IRentalAttr {
1173
+ return {
1174
+ RentalId: this.RentalId,
1175
+ CustomerId: this.CustomerId,
1176
+ CustomerType: this.CustomerType,
1177
+ ItemId: this.ItemId,
1178
+ ItemType: this.ItemType,
1179
+ PriceId: this.PriceId,
1180
+ StartDateTime: this.StartDateTime,
1181
+ EndDateTime: this.EndDateTime,
1182
+ Status: this.Status,
1183
+ CancelRemarks: this.CancelRemarks,
1184
+ TerminateRemarks: this.TerminateRemarks,
1185
+ EscheatmentYN: this.EscheatmentYN,
1186
+ AgreementNo: this.AgreementNo,
1187
+ AccountType: this.AccountType,
1188
+ CreatedById: this.CreatedById,
1189
+ CreatedAt: this.CreatedAt,
1190
+ UpdatedById: this.UpdatedById,
1191
+ UpdatedAt: this.UpdatedAt,
1192
+ };
1193
+ }
1194
+
1195
+ public async getInvoices(
1196
+ loginUser: LoginUser,
1197
+ dbTransaction: any,
1198
+ accountingSystem?: IAccountSystem,
1199
+ ) {
1200
+ try {
1201
+ // Part 1: Privilege Checking
1202
+ // Call loginUser.checkPrivileges() by passing:
1203
+ // SystemCode: <get_from_app_config>
1204
+ // PrivilegeCode: "RENTAL_VIEW_INVOICE"
1205
+ const systemCode =
1206
+ ApplicationConfig.getComponentConfigValue('system-code');
1207
+ const isPrivileged = loginUser.checkPrivileges(
1208
+ systemCode,
1209
+ 'RENTAL_VIEW_INVOICE',
1210
+ );
1211
+
1212
+ if (!isPrivileged) {
1213
+ throw new ClassError(
1214
+ 'Rental',
1215
+ 'RentalErrMsg01',
1216
+ "You do not have 'RENTAL_VIEW_INVOICE' privilege.",
1217
+ );
1218
+ }
1219
+
1220
+ // Part 2: Validation
1221
+ // Make sure this._ObjectId exists, if not throw new ClassError by passing
1222
+ if (!this.ObjectId) {
1223
+ throw new ClassError(
1224
+ 'Rental',
1225
+ 'RentalErrMsg01',
1226
+ 'ObjectId is missing.',
1227
+ );
1228
+ }
1229
+
1230
+ // Part 3: Check Existing Invoices
1231
+ if (this.Invoices.length > 0) {
1232
+ return this.Invoices;
1233
+ }
1234
+
1235
+ // Part 4: Retrieve Invoices and Returns
1236
+ const search = {
1237
+ DocType: DocType.INVOICE,
1238
+ RelatedObjectId: this.ObjectId,
1239
+ RelatedObjectType: this.ObjectType,
1240
+ };
1241
+
1242
+ const documents = await Document.findAll(
1243
+ loginUser,
1244
+ dbTransaction,
1245
+ undefined,
1246
+ undefined,
1247
+ search,
1248
+ undefined,
1249
+ accountingSystem,
1250
+ );
1251
+
1252
+ this.Invoices = documents.rows.map((doc) => {
1253
+ const document = new Document(dbTransaction, doc);
1254
+ return document;
1255
+ });
1256
+
1257
+ return this.Invoices;
1258
+ } catch (error) {
1259
+ throw error;
1260
+ }
1261
+ }
1262
+
1263
+ public async getItem(dbTransaction: any): Promise<any> {
1264
+ if (this.Item) {
1265
+ return this.Item;
1266
+ } else {
1267
+ const ItemClass = ItemClassMap[this.ItemType];
1268
+
1269
+ if (!ItemClass || typeof ItemClass.init !== 'function') {
1270
+ throw new Error(`Invalid or unregistered ItemType: ${this.ItemType}`);
1271
+ }
1272
+
1273
+ ItemClass._Repo = ItemClass._Repo || ItemClass.getRepo();
1274
+
1275
+ if (!ItemClass._Repo) {
1276
+ throw new Error(
1277
+ `ItemType ${this.ItemType} does not have a repository.`,
1278
+ );
1279
+ }
1280
+
1281
+ const itemInstance = await ItemClass.init(this.ItemId, dbTransaction);
1282
+
1283
+ if (!itemInstance) {
1284
+ throw new Error(`${this.ItemType} not found with ID ${this.ItemId}`);
1285
+ }
1286
+ this.Item = itemInstance;
1287
+
1288
+ // Make sure item has setAvailable method
1289
+ if (typeof this.Item.setAvailable !== 'function') {
1290
+ throw new Error(`${this.ItemType} does not implement setAvailable()`);
1291
+ }
1292
+ return this.Item;
1293
+ }
1294
+ }
1295
+
1296
+ public async cancel(
1297
+ loginUser: LoginUser,
1298
+ dbTransaction: any,
1299
+ remarks: string,
1300
+ ): Promise<Rental> {
1301
+ try {
1302
+ // Part 1: Privilege Checking
1303
+ const systemCode =
1304
+ ApplicationConfig.getComponentConfigValue('system-code');
1305
+ const isPrivileged = await loginUser.checkPrivileges(
1306
+ systemCode,
1307
+ 'RENTAL_CANCEL',
1308
+ );
1309
+
1310
+ if (!isPrivileged) {
1311
+ throw new ClassError(
1312
+ 'Rental',
1313
+ 'RentalErrMsg01',
1314
+ "You do not have 'RENTAL_CANCEL' privilege.",
1315
+ );
1316
+ }
1317
+
1318
+ // Part 2: Validation
1319
+ if (!this.ObjectId) {
1320
+ throw new ClassError(
1321
+ 'Rental',
1322
+ 'RentalErrMsg01',
1323
+ 'Rental not found. Rental Id is empty.',
1324
+ );
1325
+ }
1326
+
1327
+ if (
1328
+ this.Status === RentalStatusEnum.ACTIVE ||
1329
+ this.Status === RentalStatusEnum.SUSPENDED
1330
+ ) {
1331
+ throw new ClassError(
1332
+ 'Rental',
1333
+ 'RentalErrMsg01',
1334
+ `Rental already ${this.Status}, please do termination process.`,
1335
+ );
1336
+ }
1337
+
1338
+ if (!remarks) {
1339
+ throw new ClassError(
1340
+ 'Rental',
1341
+ 'RentalErrMsg01',
1342
+ 'Cancellation remarks is required.',
1343
+ );
1344
+ }
1345
+
1346
+ // Part 3: Capture Record Info Before Changes
1347
+ const entityValueBefore = this.toJSON();
1348
+
1349
+ // Part 4: Update Rental Status and Remarks
1350
+ this._Status = RentalStatusEnum.CANCELLED;
1351
+ this.CancelRemarks = remarks;
1352
+ this._UpdatedById = loginUser.ObjectId;
1353
+ this._UpdatedAt = new Date();
1354
+
1355
+ // Part 5: Update Rental Record
1356
+ await Rental._Repo.update(
1357
+ {
1358
+ Status: this.Status,
1359
+ CancelRemarks: this.CancelRemarks,
1360
+ UpdatedById: this.UpdatedById,
1361
+ UpdatedAt: this.UpdatedAt,
1362
+ },
1363
+ {
1364
+ where: {
1365
+ RentalId: this.RentalId,
1366
+ },
1367
+ transaction: dbTransaction,
1368
+ },
1369
+ );
1370
+
1371
+ // Part 6: Mark Item as Available
1372
+ const item = await this.getItem(dbTransaction);
1373
+
1374
+ await item.setAvailable(loginUser, dbTransaction);
1375
+
1376
+ // Part 7: Capture Record Info After Changes
1377
+ const entityValueAfter = this.toJSON();
1378
+ // Part 8: Record Activity
1379
+ const activity = new Activity();
1380
+ activity.ActivityId = activity.createId();
1381
+ activity.Action = ActionEnum.UPDATE;
1382
+ activity.Description = 'Rental Cancellation';
1383
+ activity.EntityType = this.ObjectType;
1384
+ activity.EntityId = this.ObjectId;
1385
+ activity.EntityValueBefore = JSON.stringify(entityValueBefore);
1386
+ activity.EntityValueAfter = JSON.stringify(entityValueAfter);
1387
+ await activity.create(loginUser.ObjectId, dbTransaction);
1388
+ return this;
1389
+ } catch (error) {
1390
+ throw error;
1391
+ }
1392
+ }
1167
1393
  }
package/src/index.ts CHANGED
@@ -12,6 +12,7 @@ import { AgreementSignature } from './components/agreement-signature/agreement-s
12
12
  import { AgreementSignatureRepository } from './components/agreement-signature/agreement-signature.repository';
13
13
  import { AgreementHistory } from './components/agreement-history/agreement-history';
14
14
  import { AgreementHistoryRepository } from './components/agreement-history/agreement-history.repository';
15
+ import { ItemClassMap } from './ClassMappings/ItemClassMap';
15
16
  import { RentalHirerChangeRequest } from './components/rental-hirer-change-request/rental-hirer-change-request';
16
17
  import { RentalHirerChangeRequestRepository } from './components/rental-hirer-change-request/rental-hirer-change-request.repository';
17
18
  import { HirerChangeRequestSignature } from './components/hirer-change-request-signature/hirer-change-request-signature';
@@ -41,6 +42,7 @@ export {
41
42
  AgreementSignatureRepository,
42
43
  AgreementHistory,
43
44
  AgreementHistoryRepository,
45
+ ItemClassMap,
44
46
  RentalHirerChangeRequest,
45
47
  RentalHirerChangeRequestRepository,
46
48
  HirerChangeRequestSignature,
@@ -1,27 +0,0 @@
1
- import { ObjectBase } from '@tomei/general';
2
- import { HirerSignatureRepository } from './hirer-signature.repository';
3
- import { IHirerSignatureAttr } from '../../interfaces/agreemeent-signature-attr.interface';
4
- import { LoginUser } from '@tomei/sso';
5
- import { HirerSignatureStatusEnum } from '../../enum/agreement-signature-status.enum';
6
- export declare class HirerSignature extends ObjectBase {
7
- ObjectId: string;
8
- ObjectName: string;
9
- ObjectType: string;
10
- TableName: string;
11
- AgreementNo: string;
12
- HirerType: string;
13
- CustomerId: string;
14
- CustomerType: string;
15
- SignatureStatus: HirerSignatureStatusEnum;
16
- SignedAt: Date;
17
- CreatedById: string;
18
- CreatedAt: Date;
19
- UpdatedById: string;
20
- UpdatedAt: Date;
21
- get HirerSignatureId(): string;
22
- set HirerSignatureId(value: string);
23
- protected static _Repository: HirerSignatureRepository;
24
- protected constructor(hirerSignatureAttr?: IHirerSignatureAttr);
25
- static init(HirerSignatureId?: string, dbTransaction?: any): Promise<HirerSignature>;
26
- create(loginUser: LoginUser, dbTransaction?: any): Promise<this>;
27
- }
@@ -1,112 +0,0 @@
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
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.HirerSignature = void 0;
13
- const general_1 = require("@tomei/general");
14
- const hirer_signature_repository_1 = require("./hirer-signature.repository");
15
- const config_1 = require("@tomei/config");
16
- const activity_history_1 = require("@tomei/activity-history");
17
- class HirerSignature extends general_1.ObjectBase {
18
- get HirerSignatureId() {
19
- return this.ObjectId;
20
- }
21
- set HirerSignatureId(value) {
22
- this.ObjectId = value;
23
- }
24
- constructor(hirerSignatureAttr) {
25
- super();
26
- this.ObjectType = 'HirerSignature';
27
- this.TableName = 'rental_HirerSignature';
28
- if (hirerSignatureAttr) {
29
- this.HirerSignatureId = hirerSignatureAttr.HirerSignatureId;
30
- this.AgreementNo = hirerSignatureAttr.AgreementNo;
31
- this.HirerType = hirerSignatureAttr.HirerType;
32
- this.CustomerId = hirerSignatureAttr.CustomerId;
33
- this.CustomerType = hirerSignatureAttr.CustomerType;
34
- this.SignatureStatus = hirerSignatureAttr.SignatureStatus;
35
- this.SignedAt = hirerSignatureAttr.SignedAt;
36
- this.CreatedById = hirerSignatureAttr.CreatedById;
37
- this.CreatedAt = hirerSignatureAttr.CreatedAt;
38
- this.UpdatedById = hirerSignatureAttr.UpdatedById;
39
- this.UpdatedAt = hirerSignatureAttr.UpdatedAt;
40
- }
41
- }
42
- static init(HirerSignatureId, dbTransaction) {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- try {
45
- if (HirerSignatureId) {
46
- const hs = yield HirerSignature._Repository.findByPk(HirerSignatureId, dbTransaction);
47
- if (hs) {
48
- return new HirerSignature(hs.get({ plain: true }));
49
- }
50
- else {
51
- throw new general_1.ClassError('HirerSignature', 'HirerSignatureErrMsg01', 'HirerSignature not found');
52
- }
53
- }
54
- return new HirerSignature();
55
- }
56
- catch (error) {
57
- throw error;
58
- }
59
- });
60
- }
61
- create(loginUser, dbTransaction) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- try {
64
- const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
65
- const isPrivileged = yield loginUser.checkPrivileges(systemCode, 'HirerSignature - Create');
66
- if (!isPrivileged) {
67
- throw new general_1.ClassError('HirerSignature', 'HirerSignatureErrMsg00', "You do not have 'HirerSignature - Create' privilege.");
68
- }
69
- if (!this.AgreementNo || !this.CustomerId || !this.CustomerType) {
70
- throw new general_1.ClassError('HirerSignature', 'HirerSignatureErrMsg03', 'AgreementNo, CustomerId and CustomerType are required.');
71
- }
72
- this.ObjectId = this.createId();
73
- this.CreatedById = loginUser.ObjectId;
74
- this.CreatedAt = new Date();
75
- this.UpdatedById = loginUser.ObjectId;
76
- this.UpdatedAt = new Date();
77
- const entityValueAfter = {
78
- HirerSignatureId: this.HirerSignatureId,
79
- AgreementNo: this.AgreementNo,
80
- HirerType: this.HirerType,
81
- CustomerId: this.CustomerId,
82
- CustomerType: this.CustomerType,
83
- SignatureStatus: this.SignatureStatus,
84
- SignedAt: this.SignedAt,
85
- CreatedById: this.CreatedById,
86
- CreatedAt: this.CreatedAt,
87
- UpdatedById: this.UpdatedById,
88
- UpdatedAt: this.UpdatedAt,
89
- };
90
- yield HirerSignature._Repository.create(entityValueAfter, {
91
- transaction: dbTransaction,
92
- });
93
- const activity = new activity_history_1.Activity();
94
- activity.ObjectId = this.createId();
95
- activity.Action = activity_history_1.ActionEnum.CREATE;
96
- activity.Description = 'Add Joint Hirer Signature';
97
- activity.EntityId = this.ObjectId;
98
- activity.EntityType = this.ObjectType;
99
- activity.EntityValueBefore = JSON.stringify({});
100
- activity.EntityValueAfter = JSON.stringify(entityValueAfter);
101
- yield activity.create(loginUser.ObjectId, dbTransaction);
102
- return this;
103
- }
104
- catch (error) {
105
- throw error;
106
- }
107
- });
108
- }
109
- }
110
- exports.HirerSignature = HirerSignature;
111
- HirerSignature._Repository = new hirer_signature_repository_1.HirerSignatureRepository();
112
- //# sourceMappingURL=hirer-signature.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hirer-signature.js","sourceRoot":"","sources":["../../../../src/components/agreement-signature/hirer-signature.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAwD;AACxD,6EAAwE;AAExE,0CAAkD;AAElD,8DAA+D;AAG/D,MAAa,cAAe,SAAQ,oBAAU;IAgB5C,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAI,gBAAgB,CAAC,KAAa;QAChC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IAID,YAAsB,kBAAwC;QAC5D,KAAK,EAAE,CAAC;QAxBV,eAAU,GAAW,gBAAgB,CAAC;QACtC,cAAS,GAAW,uBAAuB,CAAC;QAwB1C,IAAI,kBAAkB,EAAE,CAAC;YACvB,IAAI,CAAC,gBAAgB,GAAG,kBAAkB,CAAC,gBAAgB,CAAC;YAC5D,IAAI,CAAC,WAAW,GAAG,kBAAkB,CAAC,W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EF,MAAM,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,gBAAgB,EAAE;oBACxD,WAAW,EAAE,aAAa;iBAC3B,CAAC,CAAC;gBAEH,MAAM,QAAQ,GAAG,IAAI,2BAAQ,EAAE,CAAC;gBAChC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACpC,QAAQ,CAAC,MAAM,GAAG,6BAAU,CAAC,MAAM,CAAC;gBACpC,QAAQ,CAAC,WAAW,GAAG,2BAA2B,CAAC;gBACnD,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;gBAClC,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;gBACtC,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;gBAChD,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;gBAE7D,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;gBAEzD,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KAAA;;AAlIH,wCAmIC;AA3GkB,0BAAW,GAAG,IAAI,qDAAwB,EAAE,AAAjC,CAAkC"}
@@ -1,8 +0,0 @@
1
- import { RepositoryBase, IRepositoryBase } from '@tomei/general';
2
- import { HirerSignatureModel } from '../../models/agreement-signature.entity';
3
- export declare class HirerSignatureRepository extends RepositoryBase<HirerSignatureModel> implements IRepositoryBase<HirerSignatureModel> {
4
- constructor();
5
- findByPk(id: string, transaction?: any): Promise<HirerSignatureModel | null>;
6
- delete(hirerId: string, dbTransaction?: any): Promise<void>;
7
- findAndCountAll(options?: any): Promise<any>;
8
- }
@@ -1,67 +0,0 @@
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
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.HirerSignatureRepository = void 0;
13
- const general_1 = require("@tomei/general");
14
- const agreement_signature_entity_1 = require("../../models/agreement-signature.entity");
15
- class HirerSignatureRepository extends general_1.RepositoryBase {
16
- constructor() {
17
- super(agreement_signature_entity_1.HirerSignatureModel);
18
- }
19
- findByPk(id, transaction) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- try {
22
- const result = yield agreement_signature_entity_1.HirerSignatureModel.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
- });
31
- }
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 agreement_signature_entity_1.HirerSignatureModel.destroy(options);
42
- }
43
- catch (error) {
44
- throw new Error(`An Error occured when delete : ${error.message}`);
45
- }
46
- });
47
- }
48
- findAndCountAll(options) {
49
- return __awaiter(this, void 0, void 0, function* () {
50
- try {
51
- let jointHirers;
52
- if (options) {
53
- jointHirers = yield agreement_signature_entity_1.HirerSignatureModel.findAndCountAll(options);
54
- }
55
- else {
56
- jointHirers = yield agreement_signature_entity_1.HirerSignatureModel.findAndCountAll();
57
- }
58
- return jointHirers;
59
- }
60
- catch (error) {
61
- throw new Error(`An Error occured when retriving : ${error.message}`);
62
- }
63
- });
64
- }
65
- }
66
- exports.HirerSignatureRepository = HirerSignatureRepository;
67
- //# sourceMappingURL=hirer-signature.repository.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hirer-signature.repository.js","sourceRoot":"","sources":["../../../../src/components/agreement-signature/hirer-signature.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAiE;AACjE,wFAA8E;AAE9E,MAAa,wBACX,SAAQ,wBAAmC;IAG3C;QACE,KAAK,CAAC,gDAAmB,CAAC,CAAC;IAC7B,CAAC;IAEK,QAAQ,CACZ,EAAU,EACV,WAAiB;;YAEjB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,gDAAmB,CAAC,QAAQ,CAAC,EAAE,EAAE;oBACpD,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,gDAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC7C,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,gDAAmB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;gBACnE,CAAC;qBAAM,CAAC;oBACN,WAAW,GAAG,MAAM,gDAAmB,CAAC,eAAe,EAAE,CAAC;gBAC5D,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,4DAkDC"}
@@ -1,27 +0,0 @@
1
- import { ObjectBase } from '@tomei/general';
2
- import { HirerSignatureRepository } from './hirer-signature.repository';
3
- import { IHirerSignatureAttr } from '../../interfaces/agreemeent-signature-attr.interface';
4
- import { LoginUser } from '@tomei/sso';
5
- import { HirerSignatureStatusEnum } from '../../enum/agreement-signature-status.enum';
6
- export declare class HirerSignature extends ObjectBase {
7
- ObjectId: string;
8
- ObjectName: string;
9
- ObjectType: string;
10
- TableName: string;
11
- AgreementNo: string;
12
- HirerType: string;
13
- CustomerId: string;
14
- CustomerType: string;
15
- SignatureStatus: HirerSignatureStatusEnum;
16
- SignedAt: Date;
17
- CreatedById: string;
18
- CreatedAt: Date;
19
- UpdatedById: string;
20
- UpdatedAt: Date;
21
- get HirerSignatureId(): string;
22
- set HirerSignatureId(value: string);
23
- protected static _Repository: HirerSignatureRepository;
24
- protected constructor(hirerSignatureAttr?: IHirerSignatureAttr);
25
- static init(HirerSignatureId?: string, dbTransaction?: any): Promise<HirerSignature>;
26
- create(loginUser: LoginUser, dbTransaction?: any): Promise<this>;
27
- }