@tomei/rental 0.17.1 → 0.19.0-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 (135) hide show
  1. package/dist/src/components/rental/rental.d.ts +7 -0
  2. package/dist/src/components/rental/rental.js +135 -0
  3. package/dist/src/components/rental/rental.js.map +1 -1
  4. package/dist/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +11 -6
  6. package/src/ClassMappings/ItemClassMap.ts +7 -0
  7. package/src/ClassMappings/index.ts +3 -0
  8. package/src/components/rental/rental.ts +226 -0
  9. package/src/index.ts +2 -0
  10. package/dist/index.d.ts +0 -1
  11. package/dist/index.js +0 -18
  12. package/dist/index.js.map +0 -1
  13. package/dist/src/components/agreement/agreement.d.ts +0 -27
  14. package/dist/src/components/agreement/agreement.js +0 -137
  15. package/dist/src/components/agreement/agreement.js.map +0 -1
  16. package/dist/src/components/agreement/agreement.repository.d.ts +0 -8
  17. package/dist/src/components/agreement/agreement.repository.js +0 -67
  18. package/dist/src/components/agreement/agreement.repository.js.map +0 -1
  19. package/dist/src/components/agreement-history/agreement-history.d.ts +0 -17
  20. package/dist/src/components/agreement-history/agreement-history.js +0 -51
  21. package/dist/src/components/agreement-history/agreement-history.js.map +0 -1
  22. package/dist/src/components/agreement-history/agreement-history.repository.d.ts +0 -8
  23. package/dist/src/components/agreement-history/agreement-history.repository.js +0 -67
  24. package/dist/src/components/agreement-history/agreement-history.repository.js.map +0 -1
  25. package/dist/src/components/agreement-signature/agreement-signature.d.ts +0 -27
  26. package/dist/src/components/agreement-signature/agreement-signature.js +0 -112
  27. package/dist/src/components/agreement-signature/agreement-signature.js.map +0 -1
  28. package/dist/src/components/agreement-signature/agreement-signature.repository.d.ts +0 -8
  29. package/dist/src/components/agreement-signature/agreement-signature.repository.js +0 -68
  30. package/dist/src/components/agreement-signature/agreement-signature.repository.js.map +0 -1
  31. package/dist/src/components/booking/booking.d.ts +0 -46
  32. package/dist/src/components/booking/booking.js +0 -314
  33. package/dist/src/components/booking/booking.js.map +0 -1
  34. package/dist/src/components/booking/booking.repository.d.ts +0 -8
  35. package/dist/src/components/booking/booking.repository.js +0 -67
  36. package/dist/src/components/booking/booking.repository.js.map +0 -1
  37. package/dist/src/components/joint-hirer/joint-hirer.d.ts +0 -23
  38. package/dist/src/components/joint-hirer/joint-hirer.js +0 -106
  39. package/dist/src/components/joint-hirer/joint-hirer.js.map +0 -1
  40. package/dist/src/components/joint-hirer/joint-hirer.repository.d.ts +0 -8
  41. package/dist/src/components/joint-hirer/joint-hirer.repository.js +0 -67
  42. package/dist/src/components/joint-hirer/joint-hirer.repository.js.map +0 -1
  43. package/dist/src/components/rental/rental.repository.d.ts +0 -8
  44. package/dist/src/components/rental/rental.repository.js +0 -67
  45. package/dist/src/components/rental/rental.repository.js.map +0 -1
  46. package/dist/src/components/rental-price/rental-price.d.ts +0 -18
  47. package/dist/src/components/rental-price/rental-price.js +0 -79
  48. package/dist/src/components/rental-price/rental-price.js.map +0 -1
  49. package/dist/src/components/rental-price/rental-price.repository.d.ts +0 -8
  50. package/dist/src/components/rental-price/rental-price.repository.js +0 -67
  51. package/dist/src/components/rental-price/rental-price.repository.js.map +0 -1
  52. package/dist/src/database.d.ts +0 -4
  53. package/dist/src/database.js +0 -29
  54. package/dist/src/database.js.map +0 -1
  55. package/dist/src/enum/account-type.enum.d.ts +0 -4
  56. package/dist/src/enum/account-type.enum.js +0 -9
  57. package/dist/src/enum/account-type.enum.js.map +0 -1
  58. package/dist/src/enum/aggrement-status.enum.d.ts +0 -5
  59. package/dist/src/enum/aggrement-status.enum.js +0 -10
  60. package/dist/src/enum/aggrement-status.enum.js.map +0 -1
  61. package/dist/src/enum/agreement-signature-status.enum.d.ts +0 -4
  62. package/dist/src/enum/agreement-signature-status.enum.js +0 -9
  63. package/dist/src/enum/agreement-signature-status.enum.js.map +0 -1
  64. package/dist/src/enum/booking.enum.d.ts +0 -5
  65. package/dist/src/enum/booking.enum.js +0 -10
  66. package/dist/src/enum/booking.enum.js.map +0 -1
  67. package/dist/src/enum/hirer-type.enum.d.ts +0 -4
  68. package/dist/src/enum/hirer-type.enum.js +0 -9
  69. package/dist/src/enum/hirer-type.enum.js.map +0 -1
  70. package/dist/src/enum/index.d.ts +0 -7
  71. package/dist/src/enum/index.js +0 -16
  72. package/dist/src/enum/index.js.map +0 -1
  73. package/dist/src/enum/rental-status.enum.d.ts +0 -9
  74. package/dist/src/enum/rental-status.enum.js +0 -14
  75. package/dist/src/enum/rental-status.enum.js.map +0 -1
  76. package/dist/src/index.d.ts +0 -19
  77. package/dist/src/index.js +0 -51
  78. package/dist/src/index.js.map +0 -1
  79. package/dist/src/interfaces/agreemeent-signature-attr.interface.d.ts +0 -14
  80. package/dist/src/interfaces/agreemeent-signature-attr.interface.js +0 -3
  81. package/dist/src/interfaces/agreemeent-signature-attr.interface.js.map +0 -1
  82. package/dist/src/interfaces/agreement-attr.interface.d.ts +0 -7
  83. package/dist/src/interfaces/agreement-attr.interface.js +0 -3
  84. package/dist/src/interfaces/agreement-attr.interface.js.map +0 -1
  85. package/dist/src/interfaces/agreement-history-attr.interface.d.ts +0 -7
  86. package/dist/src/interfaces/agreement-history-attr.interface.js +0 -3
  87. package/dist/src/interfaces/agreement-history-attr.interface.js.map +0 -1
  88. package/dist/src/interfaces/booking-attr.interface.d.ts +0 -18
  89. package/dist/src/interfaces/booking-attr.interface.js +0 -3
  90. package/dist/src/interfaces/booking-attr.interface.js.map +0 -1
  91. package/dist/src/interfaces/booking-find-all-search-attr.interface.d.ts +0 -12
  92. package/dist/src/interfaces/booking-find-all-search-attr.interface.js +0 -3
  93. package/dist/src/interfaces/booking-find-all-search-attr.interface.js.map +0 -1
  94. package/dist/src/interfaces/index.d.ts +0 -9
  95. package/dist/src/interfaces/index.js +0 -3
  96. package/dist/src/interfaces/index.js.map +0 -1
  97. package/dist/src/interfaces/joint-hirer-attr.interface.d.ts +0 -10
  98. package/dist/src/interfaces/joint-hirer-attr.interface.js +0 -3
  99. package/dist/src/interfaces/joint-hirer-attr.interface.js.map +0 -1
  100. package/dist/src/interfaces/rental-attr.interface.d.ts +0 -24
  101. package/dist/src/interfaces/rental-attr.interface.js +0 -3
  102. package/dist/src/interfaces/rental-attr.interface.js.map +0 -1
  103. package/dist/src/interfaces/rental-find-all-search-attr.interface.d.ts +0 -10
  104. package/dist/src/interfaces/rental-find-all-search-attr.interface.js +0 -3
  105. package/dist/src/interfaces/rental-find-all-search-attr.interface.js.map +0 -1
  106. package/dist/src/interfaces/rental-price-attr.interface.d.ts +0 -7
  107. package/dist/src/interfaces/rental-price-attr.interface.js +0 -3
  108. package/dist/src/interfaces/rental-price-attr.interface.js.map +0 -1
  109. package/dist/src/interfaces/response-hirer-signature-attr.interface.d.ts +0 -14
  110. package/dist/src/interfaces/response-hirer-signature-attr.interface.js +0 -3
  111. package/dist/src/interfaces/response-hirer-signature-attr.interface.js.map +0 -1
  112. package/dist/src/models/agreement-history.entity.d.ts +0 -10
  113. package/dist/src/models/agreement-history.entity.js +0 -65
  114. package/dist/src/models/agreement-history.entity.js.map +0 -1
  115. package/dist/src/models/agreement-signature.entity.d.ts +0 -18
  116. package/dist/src/models/agreement-signature.entity.js +0 -101
  117. package/dist/src/models/agreement-signature.entity.js.map +0 -1
  118. package/dist/src/models/agreement.entity.d.ts +0 -14
  119. package/dist/src/models/agreement.entity.js +0 -70
  120. package/dist/src/models/agreement.entity.js.map +0 -1
  121. package/dist/src/models/booking.entity.d.ts +0 -21
  122. package/dist/src/models/booking.entity.js +0 -128
  123. package/dist/src/models/booking.entity.js.map +0 -1
  124. package/dist/src/models/index.d.ts +0 -8
  125. package/dist/src/models/index.js +0 -18
  126. package/dist/src/models/index.js.map +0 -1
  127. package/dist/src/models/joint-hirer.entity.d.ts +0 -13
  128. package/dist/src/models/joint-hirer.entity.js +0 -79
  129. package/dist/src/models/joint-hirer.entity.js.map +0 -1
  130. package/dist/src/models/rental-price.entity.d.ts +0 -8
  131. package/dist/src/models/rental-price.entity.js +0 -59
  132. package/dist/src/models/rental-price.entity.js.map +0 -1
  133. package/dist/src/models/rental.entity.d.ts +0 -29
  134. package/dist/src/models/rental.entity.js +0 -160
  135. package/dist/src/models/rental.entity.js.map +0 -1
@@ -1,314 +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.Booking = void 0;
13
- const general_1 = require("@tomei/general");
14
- const booking_repository_1 = require("./booking.repository");
15
- const luxon_1 = require("luxon");
16
- const config_1 = require("@tomei/config");
17
- const sequelize_1 = require("sequelize");
18
- const rental_1 = require("../rental/rental");
19
- const activity_history_1 = require("@tomei/activity-history");
20
- class Booking extends general_1.ObjectBase {
21
- get BookingNo() {
22
- return this.ObjectId;
23
- }
24
- set BookingNo(value) {
25
- this.ObjectId = value;
26
- }
27
- get CreatedById() {
28
- return this._CreatedById;
29
- }
30
- get CreatedAt() {
31
- return this._CreatedAt;
32
- }
33
- get UpdatedById() {
34
- return this._UpdatedById;
35
- }
36
- get UpdatedAt() {
37
- return this._UpdatedAt;
38
- }
39
- get ScheduledStartDateTime() {
40
- return this._ScheduledStartDateTime;
41
- }
42
- get ScheduledEndDateTime() {
43
- return this._ScheduledEndDateTime;
44
- }
45
- setScheduledStartDateTime(datetime) {
46
- return __awaiter(this, void 0, void 0, function* () {
47
- const dateTime = luxon_1.DateTime.fromJSDate(datetime);
48
- const currentDateTime = luxon_1.DateTime.now();
49
- if (dateTime <= currentDateTime) {
50
- throw new general_1.ClassError('Booking', 'BookingErrMsg01', 'Booking must be for future date time.');
51
- }
52
- this._ScheduledStartDateTime = datetime;
53
- });
54
- }
55
- setScheduledEndDateTime(datetime) {
56
- return __awaiter(this, void 0, void 0, function* () {
57
- const dateTime = luxon_1.DateTime.fromJSDate(datetime);
58
- const currentDateTime = luxon_1.DateTime.now();
59
- if (dateTime <= currentDateTime) {
60
- throw new general_1.ClassError('Booking', 'BookingErrMsg01', 'Booking must be for future date time.');
61
- }
62
- if (!this._ScheduledStartDateTime) {
63
- throw new general_1.ClassError('Booking', 'BookingErrMsg01', 'Booking start date time must be set before setting end date time.');
64
- }
65
- const startDateTime = luxon_1.DateTime.fromJSDate(this._ScheduledStartDateTime);
66
- if (dateTime <= startDateTime) {
67
- throw new general_1.ClassError('Booking', 'BookingErrMsg03', 'Booking end date time must be more than start date time.');
68
- }
69
- this._ScheduledEndDateTime = datetime;
70
- });
71
- }
72
- constructor(bookingAttr) {
73
- super();
74
- this.ObjectType = 'Booking';
75
- this.TableName = 'booking_Booking';
76
- if (bookingAttr) {
77
- this.ObjectId = bookingAttr.BookingNo;
78
- this.CustomerId = bookingAttr.CustomerId;
79
- this.CustomerType = bookingAttr.CustomerType;
80
- this.ItemId = bookingAttr.ItemId;
81
- this.ItemType = bookingAttr.ItemType;
82
- this.PriceId = bookingAttr.PriceId;
83
- this._ScheduledStartDateTime = bookingAttr.ScheduledStartDateTime;
84
- this._ScheduledEndDateTime = bookingAttr.ScheduledEndDateTime;
85
- this.BookingFee = bookingAttr.BookingFee;
86
- this.Status = bookingAttr.Status;
87
- this.CancelRemarks = bookingAttr.CancelRemarks;
88
- this._CreatedById = bookingAttr.CreatedById;
89
- this._CreatedAt = bookingAttr.CreatedAt;
90
- this._UpdatedById = bookingAttr.UpdatedById;
91
- this._UpdatedAt = bookingAttr.UpdatedAt;
92
- }
93
- }
94
- static init(dbTransaction, bookingNo) {
95
- return __awaiter(this, void 0, void 0, function* () {
96
- try {
97
- if (bookingNo) {
98
- const booking = yield Booking._Repo.findOne({
99
- where: {
100
- BookingNo: bookingNo,
101
- },
102
- transaction: dbTransaction,
103
- });
104
- if (booking) {
105
- return new Booking(booking.get({ plain: true }));
106
- }
107
- else {
108
- throw new Error('Booking not found');
109
- }
110
- }
111
- return new Booking();
112
- }
113
- catch (error) {
114
- throw error;
115
- }
116
- });
117
- }
118
- create(dbTransaction, loginUser, rentalPrice) {
119
- return __awaiter(this, void 0, void 0, function* () {
120
- try {
121
- const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
122
- const isPrivileged = yield loginUser.checkPrivileges(systemCode, 'Booking - Create');
123
- if (!isPrivileged) {
124
- throw new general_1.ClassError('Booking', 'BookingErrMsg02', "You do not have 'Booking - Create' privilege.");
125
- }
126
- const isRentalAvailable = yield rental_1.Rental.isItemAvailable(this.ItemId, this.ItemType, this._ScheduledStartDateTime, this._ScheduledEndDateTime, dbTransaction);
127
- const isBookingAvailable = yield Booking.isBookingItemAvailable(dbTransaction, this.ItemId, this.ItemType, this._ScheduledStartDateTime, this._ScheduledEndDateTime);
128
- if (!isRentalAvailable || !isBookingAvailable) {
129
- throw new general_1.ClassError('Booking', 'BookingErrMsg02', 'Booking is not available for the item on the chosen date.');
130
- }
131
- const rp = yield rentalPrice.create(loginUser, dbTransaction);
132
- this.BookingNo = this.createId();
133
- this.PriceId = rp.PriceId;
134
- this._CreatedById = loginUser.ObjectId;
135
- this._CreatedAt = luxon_1.DateTime.now().toJSDate();
136
- this._UpdatedById = loginUser.ObjectId;
137
- this._UpdatedAt = luxon_1.DateTime.now().toJSDate();
138
- const data = {
139
- BookingNo: this.BookingNo,
140
- CustomerId: this.CustomerId,
141
- CustomerType: this.CustomerType,
142
- ItemId: this.ItemId,
143
- ItemType: this.ItemType,
144
- PriceId: this.PriceId,
145
- ScheduledStartDateTime: this._ScheduledStartDateTime,
146
- ScheduledEndDateTime: this._ScheduledEndDateTime,
147
- BookingFee: this.BookingFee,
148
- Status: this.Status,
149
- CancelRemarks: this.CancelRemarks,
150
- CreatedById: this._CreatedById,
151
- CreatedAt: this._CreatedAt,
152
- UpdatedById: this._UpdatedById,
153
- UpdatedAt: this._UpdatedAt,
154
- };
155
- yield Booking._Repo.create(data, {
156
- transaction: dbTransaction,
157
- });
158
- const activity = new activity_history_1.Activity();
159
- activity.ActivityId = activity.createId();
160
- activity.Action = activity_history_1.ActionEnum.CREATE;
161
- activity.Description = 'Add Booking';
162
- activity.EntityId = this.BookingNo;
163
- activity.EntityType = this.ObjectType;
164
- activity.EntityValueBefore = JSON.stringify({});
165
- activity.EntityValueAfter = JSON.stringify(data);
166
- yield activity.create(loginUser.ObjectId, dbTransaction);
167
- return this;
168
- }
169
- catch (error) {
170
- throw error;
171
- }
172
- });
173
- }
174
- static isBookingItemAvailable(dbTransaction, itemId, itemType, startDateTime, endDateTime) {
175
- return __awaiter(this, void 0, void 0, function* () {
176
- try {
177
- const booking = yield Booking._Repo.findOne({
178
- where: {
179
- ItemId: itemId,
180
- ItemType: itemType,
181
- [sequelize_1.Op.and]: [
182
- {
183
- ScheduledStartDateTime: {
184
- [sequelize_1.Op.lte]: endDateTime,
185
- },
186
- },
187
- {
188
- ScheduledEndDateTime: {
189
- [sequelize_1.Op.gte]: startDateTime,
190
- },
191
- },
192
- ],
193
- },
194
- transaction: dbTransaction,
195
- });
196
- if (booking) {
197
- return false;
198
- }
199
- return true;
200
- }
201
- catch (error) {
202
- throw error;
203
- }
204
- });
205
- }
206
- static findAll(dbTransaction, page, row, search) {
207
- return __awaiter(this, void 0, void 0, function* () {
208
- try {
209
- const queryObj = {};
210
- let options = {
211
- transaction: dbTransaction,
212
- order: [['CreatedAt', 'DESC']],
213
- };
214
- if (page && row) {
215
- options = Object.assign(Object.assign({}, options), { limit: row, offset: row * (page - 1) });
216
- }
217
- if (search) {
218
- Object.entries(search).forEach(([key, value]) => {
219
- if (key === 'ScheduledStartDateTime') {
220
- queryObj[key] = {
221
- [sequelize_1.Op.gte]: value,
222
- };
223
- }
224
- else if (key === 'ScheduledEndDateTime') {
225
- queryObj[key] = {
226
- [sequelize_1.Op.lte]: value,
227
- };
228
- }
229
- else {
230
- queryObj[key] = {
231
- [sequelize_1.Op.substring]: value,
232
- };
233
- }
234
- });
235
- options = Object.assign(Object.assign({}, options), { where: queryObj });
236
- }
237
- return yield Booking._Repo.findAndCountAll(options);
238
- }
239
- catch (err) {
240
- throw err;
241
- }
242
- });
243
- }
244
- static findOne(loginUser, dbTransaction, searchOptions) {
245
- return __awaiter(this, void 0, void 0, function* () {
246
- try {
247
- const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
248
- const isPrivileged = yield loginUser.checkPrivileges(systemCode, 'BOOKING_VIEW');
249
- if (!isPrivileged) {
250
- throw new general_1.ClassError('Booking', 'BookingErrMsg3', "You do not have 'BOOKING_VIEW' privilege.");
251
- }
252
- const record = yield Booking._Repo.findOne({
253
- where: searchOptions,
254
- transaction: dbTransaction,
255
- });
256
- if (record) {
257
- const booking = yield Booking.init(dbTransaction, record.BookingNo);
258
- return booking;
259
- }
260
- else {
261
- return null;
262
- }
263
- }
264
- catch (error) {
265
- throw error;
266
- }
267
- });
268
- }
269
- static updateLeadToCustomer(loginUser, dbTransaction, LeadId, CustomerId) {
270
- return __awaiter(this, void 0, void 0, function* () {
271
- try {
272
- const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
273
- const isPrivileged = yield loginUser.checkPrivileges(systemCode, 'BOOKING_UPDATE');
274
- if (!isPrivileged) {
275
- throw new general_1.ClassError('Booking', 'BookingErrMsg02', "You do not have 'BOOKING_UPDATE' privilege");
276
- }
277
- if (!LeadId || !CustomerId) {
278
- throw new general_1.ClassError('Booking', 'BookingErrMsg02', 'LeadId and CustomerId cannot be null or invalid');
279
- }
280
- const bookings = yield Booking._Repo.findAll({
281
- where: {
282
- [sequelize_1.Op.and]: [{ CustomerId: LeadId }, { CustomerType: 'Lead' }],
283
- },
284
- transaction: dbTransaction,
285
- });
286
- for (const booking of bookings) {
287
- const EntityValueBefore = Object.assign({}, booking.get({ plain: true }));
288
- booking.CustomerId = CustomerId;
289
- booking.CustomerType = 'Customer';
290
- booking.UpdatedById = loginUser.ObjectId;
291
- booking.UpdatedAt = luxon_1.DateTime.now().toJSDate();
292
- yield booking.save({
293
- transaction: dbTransaction,
294
- });
295
- const activity = new activity_history_1.Activity();
296
- activity.ActivityId = activity.createId();
297
- activity.Action = activity_history_1.ActionEnum.UPDATE;
298
- activity.Description = 'Update Lead to Customer';
299
- activity.EntityType = 'Booking';
300
- activity.EntityId = booking.BookingNo;
301
- activity.EntityValueBefore = JSON.stringify(EntityValueBefore);
302
- activity.EntityValueAfter = JSON.stringify(booking.get({ plain: true }));
303
- yield activity.create(loginUser.ObjectId, dbTransaction);
304
- }
305
- }
306
- catch (error) {
307
- throw error;
308
- }
309
- });
310
- }
311
- }
312
- exports.Booking = Booking;
313
- Booking._Repo = new booking_repository_1.BookingRepository();
314
- //# sourceMappingURL=booking.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"booking.js","sourceRoot":"","sources":["../../../../src/components/booking/booking.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAwD;AAGxD,6DAAyD;AACzD,iCAAiC;AAGjC,0CAAkD;AAClD,yCAAoD;AACpD,6CAA0C;AAC1C,8DAA+D;AAG/D,MAAa,OAAQ,SAAQ,oBAAU;IAsBrC,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAI,SAAS,CAAC,KAAa;QACzB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,I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MAAM,GAAG,6BAAU,CAAC,MAAM,CAAC;oBACpC,QAAQ,CAAC,WAAW,GAAG,yBAAyB,CAAC;oBACjD,QAAQ,CAAC,UAAU,GAAG,SAAS,CAAC;oBAChC,QAAQ,CAAC,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;oBACtC,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;oBAC/D,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,SAAS,CACxC,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAC7B,CAAC;oBAIF,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;gBAC3D,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KAAA;;AA7dH,0BA8dC;AA1ckB,aAAK,GAAG,IAAI,sCAAiB,EAAE,AAA1B,CAA2B"}
@@ -1,8 +0,0 @@
1
- import { RepositoryBase, IRepositoryBase } from '@tomei/general';
2
- import { BookingModel } from '../../models/booking.entity';
3
- export declare class BookingRepository extends RepositoryBase<BookingModel> implements IRepositoryBase<BookingModel> {
4
- constructor();
5
- findByPk(id: string, transaction?: any): Promise<BookingModel | null>;
6
- delete(BookingNo: 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.BookingRepository = void 0;
13
- const general_1 = require("@tomei/general");
14
- const booking_entity_1 = require("../../models/booking.entity");
15
- class BookingRepository extends general_1.RepositoryBase {
16
- constructor() {
17
- super(booking_entity_1.BookingModel);
18
- }
19
- findByPk(id, transaction) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- try {
22
- const result = yield booking_entity_1.BookingModel.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(BookingNo, dbTransaction) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- try {
35
- const options = {
36
- where: {
37
- BookingNo: BookingNo,
38
- },
39
- transaction: dbTransaction,
40
- };
41
- yield booking_entity_1.BookingModel.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 Bookings;
52
- if (options) {
53
- Bookings = yield booking_entity_1.BookingModel.findAndCountAll(options);
54
- }
55
- else {
56
- Bookings = yield booking_entity_1.BookingModel.findAndCountAll();
57
- }
58
- return Bookings;
59
- }
60
- catch (error) {
61
- throw new Error(`An Error occured when retriving : ${error.message}`);
62
- }
63
- });
64
- }
65
- }
66
- exports.BookingRepository = BookingRepository;
67
- //# sourceMappingURL=booking.repository.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"booking.repository.js","sourceRoot":"","sources":["../../../../src/components/booking/booking.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAiE;AACjE,gEAA2D;AAE3D,MAAa,iBACX,SAAQ,wBAA4B;IAGpC;QACE,KAAK,CAAC,6BAAY,CAAC,CAAC;IACtB,CAAC;IAEK,QAAQ,CAAC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
3
- import { IJointHirerAttr } from '../../interfaces/joint-hirer-attr.interface';
4
- import { LoginUser } from '@tomei/sso';
5
- export declare class JointHirer extends ObjectBase {
6
- ObjectId: string;
7
- ObjectName: string;
8
- ObjectType: string;
9
- TableName: string;
10
- RentalId: string;
11
- CustomerId: string;
12
- CustomerType: string;
13
- CreatedById: string;
14
- CreatedAt: Date;
15
- UpdatedById: string;
16
- UpdatedAt: Date;
17
- get HirerId(): string;
18
- set HirerId(value: string);
19
- protected static _Repository: JointHirerRepository;
20
- protected constructor(jointHirerAttr?: IJointHirerAttr);
21
- static init(hirerId?: string, dbTransaction?: any): Promise<JointHirer>;
22
- create(loginUser: LoginUser, dbTransaction?: any): Promise<this>;
23
- }
@@ -1,106 +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.JointHirer = void 0;
13
- const general_1 = require("@tomei/general");
14
- const joint_hirer_repository_1 = require("./joint-hirer.repository");
15
- const config_1 = require("@tomei/config");
16
- const activity_history_1 = require("@tomei/activity-history");
17
- class JointHirer extends general_1.ObjectBase {
18
- get HirerId() {
19
- return this.ObjectId;
20
- }
21
- set HirerId(value) {
22
- this.ObjectId = value;
23
- }
24
- constructor(jointHirerAttr) {
25
- super();
26
- this.ObjectType = 'JointHirer';
27
- this.TableName = 'rental_JointHirer';
28
- if (jointHirerAttr) {
29
- this.HirerId = jointHirerAttr.HirerId;
30
- this.RentalId = jointHirerAttr.RentalId;
31
- this.CustomerId = jointHirerAttr.CustomerId;
32
- this.CustomerType = jointHirerAttr.CustomerType;
33
- this.CreatedById = jointHirerAttr.CreatedById;
34
- this.CreatedAt = jointHirerAttr.CreatedAt;
35
- this.UpdatedById = jointHirerAttr.UpdatedById;
36
- this.UpdatedAt = jointHirerAttr.UpdatedAt;
37
- }
38
- }
39
- static init(hirerId, dbTransaction) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- try {
42
- if (hirerId) {
43
- const jr = yield JointHirer._Repository.findByPk(hirerId, dbTransaction);
44
- if (jr) {
45
- return new JointHirer(jr.get({ plain: true }));
46
- }
47
- else {
48
- throw new general_1.ClassError('JointHirer', 'JointHirerErrMsg01', 'JointHirer not found');
49
- }
50
- }
51
- return new JointHirer();
52
- }
53
- catch (error) {
54
- throw error;
55
- }
56
- });
57
- }
58
- create(loginUser, dbTransaction) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- try {
61
- const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
62
- const isPrivileged = yield loginUser.checkPrivileges(systemCode, 'JointHirer - Create');
63
- if (!isPrivileged) {
64
- throw new general_1.ClassError('JointHirer', 'JointHirerErrMsg00', "You do not have 'JointHirer - Create' privilege.");
65
- }
66
- if (!this.RentalId || !this.CustomerId || !this.CustomerType) {
67
- throw new general_1.ClassError('JointHirer', 'JointHirerErrMsg03', 'RentalId, CustomerId and CustomerType are required.');
68
- }
69
- this.ObjectId = this.createId();
70
- this.CreatedById = loginUser.ObjectId;
71
- this.CreatedAt = new Date();
72
- this.UpdatedById = loginUser.ObjectId;
73
- this.UpdatedAt = new Date();
74
- const entityValueAfter = {
75
- HirerId: this.HirerId,
76
- RentalId: this.RentalId,
77
- CustomerId: this.CustomerId,
78
- CustomerType: this.CustomerType,
79
- CreatedById: this.CreatedById,
80
- CreatedAt: this.CreatedAt,
81
- UpdatedById: this.UpdatedById,
82
- UpdatedAt: this.UpdatedAt,
83
- };
84
- yield JointHirer._Repository.create(entityValueAfter, {
85
- transaction: dbTransaction,
86
- });
87
- const activity = new activity_history_1.Activity();
88
- activity.ObjectId = this._createId();
89
- activity.Action = activity_history_1.ActionEnum.CREATE;
90
- activity.Description = 'Add Joint Hirer';
91
- activity.EntityId = this.ObjectId;
92
- activity.EntityType = this.ObjectType;
93
- activity.EntityValueBefore = JSON.stringify({});
94
- activity.EntityValueAfter = JSON.stringify(entityValueAfter);
95
- yield activity.create(loginUser.ObjectId, dbTransaction);
96
- return this;
97
- }
98
- catch (error) {
99
- throw error;
100
- }
101
- });
102
- }
103
- }
104
- exports.JointHirer = JointHirer;
105
- JointHirer._Repository = new joint_hirer_repository_1.JointHirerRepository();
106
- //# sourceMappingURL=joint-hirer.js.map
@@ -1 +0,0 @@
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;AAE/D,MAAa,UAAW,SAAQ,oBAAU;IAaxC,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;QArBV,eAAU,GAAW,YAAY,CAAC;QAClC,cAAS,GAAW,mBAAmB,CAAC;QAqBtC,IAAI,cAAc,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC;YACtC,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAC;YACxC,IAAI,CAAC,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC;YAC5C,IAAI,CAAC,YAAY,GAAG,cAAc,CAAC,YAAY,CAAC;YAChD,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC;YAC9C,IAAI,CA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AE,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;;AAhIH,gCAiIC;AA5GkB,sBAAW,GAAG,IAAI,6CAAoB,EAAE,AAA7B,CAA8B"}
@@ -1,8 +0,0 @@
1
- import { RepositoryBase, IRepositoryBase } from '@tomei/general';
2
- import { JointHirerModel } from '../../models/joint-hirer.entity';
3
- export declare class JointHirerRepository extends RepositoryBase<JointHirerModel> implements IRepositoryBase<JointHirerModel> {
4
- constructor();
5
- findByPk(id: string, transaction?: any): Promise<JointHirerModel | 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.JointHirerRepository = void 0;
13
- const general_1 = require("@tomei/general");
14
- const joint_hirer_entity_1 = require("../../models/joint-hirer.entity");
15
- class JointHirerRepository extends general_1.RepositoryBase {
16
- constructor() {
17
- super(joint_hirer_entity_1.JointHirerModel);
18
- }
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
- });
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 joint_hirer_entity_1.JointHirerModel.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 joint_hirer_entity_1.JointHirerModel.findAndCountAll(options);
54
- }
55
- else {
56
- jointHirers = yield joint_hirer_entity_1.JointHirerModel.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.JointHirerRepository = JointHirerRepository;
67
- //# sourceMappingURL=joint-hirer.repository.js.map
@@ -1 +0,0 @@
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"}
@@ -1,8 +0,0 @@
1
- import { RepositoryBase, IRepositoryBase } from '@tomei/general';
2
- import { RentalModel } from '../../models/rental.entity';
3
- export declare class RentalRepository extends RepositoryBase<RentalModel> implements IRepositoryBase<RentalModel> {
4
- constructor();
5
- findByPk(id: string, transaction?: any): Promise<RentalModel | null>;
6
- delete(RentalId: string, dbTransaction?: any): Promise<void>;
7
- findAndCountAll(options?: any): Promise<any>;
8
- }