law-common 10.26.1-beta.9 → 10.28.0

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 (47) hide show
  1. package/dist/src/api/interface/billing.transaction.create.dto.interface.d.ts +7 -2
  2. package/dist/src/api/interface/billing.transaction.entity.response.d.ts +24 -1
  3. package/dist/src/api/interface/billing.transaction.update.dto.interface.d.ts +13 -2
  4. package/dist/src/constants/entity_constants.d.ts +1 -0
  5. package/dist/src/constants/entity_constants.js +2 -1
  6. package/dist/src/entities/enums/billing-transaction-action.enum.d.ts +5 -0
  7. package/dist/src/entities/enums/billing-transaction-action.enum.js +15 -0
  8. package/dist/src/entities/enums/billing-transaction-status.enum.d.ts +6 -0
  9. package/dist/src/entities/enums/billing-transaction-status.enum.js +10 -0
  10. package/dist/src/entities/index.d.ts +5 -1
  11. package/dist/src/entities/index.js +5 -2
  12. package/dist/src/entities/interface/billing-transaction-history.entity.d.ts +7 -0
  13. package/dist/src/entities/interface/billing-transaction-history.entity.js +2 -0
  14. package/dist/src/entities/interface/billing.entity.interface.d.ts +1 -0
  15. package/dist/src/entities/interface/billing_transaction.entity.interface.d.ts +7 -0
  16. package/dist/src/entities/interface/entity.utils.interface.d.ts +17 -7
  17. package/dist/src/entities/interface/entity.utils.interface.js +2 -1
  18. package/dist/src/entities/interface/leave.entity.interface.js +12 -12
  19. package/dist/src/entities/model/base.entity.model.d.ts +8 -2
  20. package/dist/src/entities/model/base.entity.model.js +53 -34
  21. package/dist/src/entities/model/billing-reimbursement-expense.entity.model.d.ts +1 -1
  22. package/dist/src/entities/model/billing-reimbursement-expense.entity.model.js +1 -1
  23. package/dist/src/entities/model/billing-timesheet.entity.model.d.ts +1 -1
  24. package/dist/src/entities/model/billing-timesheet.entity.model.js +1 -1
  25. package/dist/src/entities/model/billing-transaction.model.d.ts +38 -0
  26. package/dist/src/entities/model/billing-transaction.model.js +71 -0
  27. package/dist/src/entities/model/billing.entity.model.d.ts +4 -1
  28. package/dist/src/entities/model/billing.entity.model.js +9 -0
  29. package/dist/src/entities/model/entity.model.interface.d.ts +12 -1
  30. package/dist/src/entities/model/entity.model.interface.js +46 -2
  31. package/dist/src/entities/model/holiday.entity.model.d.ts +14 -1
  32. package/dist/src/entities/model/holiday.entity.model.js +26 -42
  33. package/dist/src/entities/model/leave.entity.model.d.ts +50 -3
  34. package/dist/src/entities/model/leave.entity.model.js +169 -21
  35. package/dist/src/entities/model/leave_count.entity.model.d.ts +19 -0
  36. package/dist/src/entities/model/leave_count.entity.model.js +60 -0
  37. package/dist/src/utils/entity.flow.util.d.ts +32 -0
  38. package/dist/src/utils/entity.flow.util.js +83 -0
  39. package/dist/src/utils/helper.fn.util.d.ts +37 -1
  40. package/dist/src/utils/helper.fn.util.js +53 -0
  41. package/dist/src/utils/index.d.ts +2 -0
  42. package/dist/src/utils/index.js +2 -0
  43. package/dist/src/utils/string.util.d.ts +1 -0
  44. package/dist/src/utils/string.util.js +14 -0
  45. package/package.json +35 -35
  46. package/dist/src/entities/func/convert-to-common-entity.func.d.ts +0 -15
  47. package/dist/src/entities/func/convert-to-common-entity.func.js +0 -24
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LeaveCountVirtualEntityModel = void 0;
4
+ const utils_1 = require("../../utils");
5
+ const leave_type_enum_1 = require("../enums/leave-type.enum");
6
+ const entity_utils_interface_1 = require("../interface/entity.utils.interface");
7
+ const base_entity_model_1 = require("./base.entity.model");
8
+ class LeaveCountVirtualEntityModel extends base_entity_model_1.BaseEntityModel {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.id = 0;
12
+ this.period = "";
13
+ this.count = 0;
14
+ this.createdBy = 0;
15
+ this.updatedBy = 0;
16
+ this.createdOn = 0;
17
+ this.updatedOn = 0;
18
+ }
19
+ static fromEntity(entity) {
20
+ const result = new LeaveCountVirtualEntityModel(entity_utils_interface_1.VirtualEntityEnum.LEAVE_COUNT);
21
+ Object.assign(result, entity);
22
+ return result;
23
+ }
24
+ getRelationConfigs() {
25
+ return this.constructor.prototype.constructor.relationConfigs;
26
+ }
27
+ static fromLeaveHoliday(leaveModel, holidayDateCodes) {
28
+ const leaveCountVirtualEntity = {
29
+ leaveId: leaveModel.id,
30
+ count: leaveModel.getLeaveDuration([utils_1.Weekday.Sunday, utils_1.Weekday.Saturday], holidayDateCodes) +
31
+ (leaveModel.type === leave_type_enum_1.LeaveTypeEnum.SICK &&
32
+ (leaveModel.isWeekendPrecedes() ||
33
+ leaveModel.isWeekendSucceeds() ||
34
+ leaveModel.isHolidayPrecedes(holidayDateCodes) ||
35
+ leaveModel.isHolidaySucceeds(holidayDateCodes))
36
+ ? 2
37
+ : 0),
38
+ createdBy: leaveModel.createdBy,
39
+ updatedBy: leaveModel.updatedBy,
40
+ createdOn: leaveModel.createdOn,
41
+ updatedOn: leaveModel.updatedOn,
42
+ id: leaveModel.id,
43
+ period: leaveModel.fromDate + leaveModel.toDate + leaveModel.durationType,
44
+ };
45
+ return LeaveCountVirtualEntityModel.fromEntity(leaveCountVirtualEntity);
46
+ }
47
+ }
48
+ exports.LeaveCountVirtualEntityModel = LeaveCountVirtualEntityModel;
49
+ // static relationConfigs = [
50
+ // {
51
+ // name: EntityEnum.LEAVE,
52
+ // relation: RelationType.ONE,
53
+ // key: 'leaveCount',
54
+ // mapKeyConfig: {
55
+ // relationKey: 'id',
56
+ // key: 'leaveId',
57
+ // },
58
+ // },
59
+ // ];
60
+ LeaveCountVirtualEntityModel.relationConfigs = [];
@@ -0,0 +1,32 @@
1
+ import { LeaveActionEnum, LeaveStatusEnum } from "../entities";
2
+ export type LeaveStatusActionPair = {
3
+ status: LeaveStatusEnum;
4
+ action: LeaveActionEnum;
5
+ };
6
+ /**
7
+ * Gets available actions for a leave based on current status and user permissions
8
+ * @param entityFlowConfig - The flow configuration for the entity
9
+ * @param currentStatus - The current status of the leave
10
+ * @param userPermissions - Array of permissions the user has
11
+ * @param combineActions - Array of action values to combine into a single action
12
+ * @param actionLabels - Object mapping actions to custom labels
13
+ * @param data - Optional function to provide additional visibility conditions
14
+ * @returns Array of available actions with labels and values
15
+ */
16
+ export declare function getPermittedActions<T extends LeaveStatusActionPair, E>(entityFlowConfig: {
17
+ [key in T["status"]]?: {
18
+ actions: {
19
+ [key in T["action"]]?: {
20
+ permissions: string[];
21
+ next: () => T["status"];
22
+ };
23
+ };
24
+ };
25
+ }, currentStatus: T["status"] | null, userPermissions: string[], combineActions?: T["action"][], actionLabels?: {
26
+ [key in T["action"]]?: string;
27
+ }, data?: (a: E) => {
28
+ [key: string]: () => boolean;
29
+ }): {
30
+ label: string;
31
+ value: T["action"] | string;
32
+ }[];
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPermittedActions = getPermittedActions;
4
+ /**
5
+ * Converts an action or combined action to a value-label pair
6
+ * @param action - The action or combined action key
7
+ * @param actionLabels - Object mapping actions to custom labels
8
+ * @returns Object with label and value
9
+ */
10
+ function convertToValueLabel(action, actionLabels) {
11
+ return {
12
+ label: actionLabels[action] || action,
13
+ value: action,
14
+ };
15
+ }
16
+ /**
17
+ * Filters actions based on user permissions and visibility conditions
18
+ * @param actionConfig - The actions configuration for the current status
19
+ * @param userPermissions - Array of permissions the user has
20
+ * @param data - Optional function to provide additional visibility conditions
21
+ * @returns Array of permitted action keys
22
+ * @throws Error if multiple permissions are found for a single action
23
+ */
24
+ function _getPermittedActions(actionConfig, userPermissions, data) {
25
+ return Object.entries(actionConfig)
26
+ .filter(([actionKey, config]) => {
27
+ var _a;
28
+ const actionRequiredPermissions = (_a = config === null || config === void 0 ? void 0 : config.permissions) !== null && _a !== void 0 ? _a : [];
29
+ const matchingPermissions = actionRequiredPermissions.filter((permission) => userPermissions.includes(permission));
30
+ if (matchingPermissions.length > 1) {
31
+ throw new Error(`Multiple permissions found for action ${actionKey}: ${matchingPermissions.join(", ")}`);
32
+ }
33
+ return (matchingPermissions.length > 0 &&
34
+ (!data ||
35
+ !data({})[matchingPermissions[0]] ||
36
+ data({})[matchingPermissions[0]]()));
37
+ })
38
+ .map(([actionKey, _]) => actionKey);
39
+ }
40
+ /**
41
+ * Combines specified actions into a single action if all are present
42
+ * @param permittedActions - Array of permitted action keys
43
+ * @param combineActions - Array of actions to combine
44
+ * @returns Array of action keys, with combined action if applicable
45
+ */
46
+ function combinePermittedActions(permittedActions, combineActions) {
47
+ if (combineActions.length === 0) {
48
+ return permittedActions;
49
+ }
50
+ const isCombinedActionPresent = combineActions.every((action) => permittedActions.includes(action));
51
+ if (isCombinedActionPresent) {
52
+ const combinedValue = combineActions.join("_");
53
+ return [
54
+ ...permittedActions.filter((action) => !combineActions.includes(action)),
55
+ combinedValue,
56
+ ];
57
+ }
58
+ return permittedActions;
59
+ }
60
+ /**
61
+ * Gets available actions for a leave based on current status and user permissions
62
+ * @param entityFlowConfig - The flow configuration for the entity
63
+ * @param currentStatus - The current status of the leave
64
+ * @param userPermissions - Array of permissions the user has
65
+ * @param combineActions - Array of action values to combine into a single action
66
+ * @param actionLabels - Object mapping actions to custom labels
67
+ * @param data - Optional function to provide additional visibility conditions
68
+ * @returns Array of available actions with labels and values
69
+ */
70
+ function getPermittedActions(entityFlowConfig, currentStatus, userPermissions, combineActions = [], actionLabels = {}, data = (_) => ({})) {
71
+ var _a;
72
+ // Handle invalid inputs
73
+ if (!currentStatus || !entityFlowConfig[currentStatus]) {
74
+ return [];
75
+ }
76
+ const actionConfig = ((_a = entityFlowConfig[currentStatus]) === null || _a === void 0 ? void 0 : _a.actions) || {};
77
+ // Get permitted actions
78
+ const permittedActions = _getPermittedActions(actionConfig, userPermissions, data);
79
+ // Combine actions if specified
80
+ const finalActions = combinePermittedActions(permittedActions, combineActions);
81
+ // Convert to value-label pairs
82
+ return finalActions.map((action) => convertToValueLabel(action, actionLabels));
83
+ }
@@ -1,4 +1,4 @@
1
- import { EntityEnum, EnumEntityType, IBaseEntityServiceResponse, IEntityFilterData } from "../entities";
1
+ import { EntityEnum, EnumEntityType, IBaseEntityServiceResponse, IEntityFilterData, IEntityServiceResponse } from "../entities";
2
2
  import { Modify } from "../misc";
3
3
  export declare function groupByFunction<T, K>(list: T[], keyGetter: (input: T) => K): Map<K, T[]>;
4
4
  export declare function groupByOneToOneFunction<T, K>(list: T[], keyGetter: (input: T) => K): Map<K, T>;
@@ -176,6 +176,42 @@ export declare function transformDate<T extends {
176
176
  export declare function capitalizeFirstWord(str: string): string;
177
177
  export declare function getEntitiesFromSearchV2Response<E extends EntityEnum, // Enum key like EntityEnum.USER, EntityEnum.PROJECT, etc.
178
178
  T extends EnumEntityType<E>>(searchResponseV2: IBaseEntityServiceResponse<EnumEntityType<EntityEnum>>, entityEnumKey: E, EntityClass: new () => T): T[];
179
+ /**
180
+ * Recursively searches for entities of a specific type within a nested `relatedEntities` structure.
181
+ *
182
+ * This function traverses the `relatedEntities` tree, looking for a target entity key.
183
+ * When found, it collects all `baseEntities` for that key and instantiates them
184
+ * as instances of the provided `EntityClass`. The function continues to traverse
185
+ * all nested `relatedEntities` recursively, accumulating all matches.
186
+ *
187
+ * @template E - The enum type representing the target entity key (`EntityEnum`).
188
+ * @template T - The corresponding entity type for the target key (`EnumEntityType<E>`).
189
+ *
190
+ * @param relatedEntities - The nested `relatedEntities` structure, typically from a
191
+ * `IBaseEntityServiceResponse`. Can be undefined, in which case an empty array is returned.
192
+ * @param targetKey - The entity key (`EntityEnum`) to search for in the nested structure.
193
+ * @param EntityClass - A constructor function for the entity type `T`. Used to
194
+ * instantiate new objects from the raw base entity data.
195
+ *
196
+ * @returns An array of entities of type `T` found at any level of the nested structure.
197
+ * If no entities are found, an empty array is returned.
198
+ *
199
+ * @example
200
+ * ```ts
201
+ * const billingEntities = findEntitiesAtAnyLevel(
202
+ * projectUserMappingsOfCurrentUser.relatedEntities,
203
+ * EntityEnum.BILLING,
204
+ * BillingEntity
205
+ * );
206
+ *
207
+ * console.log(billingEntities); // [BillingEntity {...}, BillingEntity {...}]
208
+ * ```
209
+ *
210
+ * @note
211
+ * - This function preserves the type of entities by mapping the raw objects to the provided `EntityClass`.
212
+ * - It can handle deeply nested `relatedEntities` structures.
213
+ */
214
+ export declare function findEntitiesFromSearchV2RelatedEntities<E extends EntityEnum, T extends EnumEntityType<E>>(relatedEntities: IEntityServiceResponse | undefined, targetKey: EntityEnum, EntityClass: new () => T): T[];
179
215
  /**
180
216
  * Checks if two decimal numbers are approximately equal within a given tolerance.
181
217
  *
@@ -33,6 +33,7 @@ exports.createKeyLabelMap = createKeyLabelMap;
33
33
  exports.transformDate = transformDate;
34
34
  exports.capitalizeFirstWord = capitalizeFirstWord;
35
35
  exports.getEntitiesFromSearchV2Response = getEntitiesFromSearchV2Response;
36
+ exports.findEntitiesFromSearchV2RelatedEntities = findEntitiesFromSearchV2RelatedEntities;
36
37
  exports.areDecimalNumbersEqual = areDecimalNumbersEqual;
37
38
  exports.formatIndianNumber = formatIndianNumber;
38
39
  exports.findDuplicateIds = findDuplicateIds;
@@ -403,6 +404,58 @@ function getEntitiesFromSearchV2Response(searchResponseV2, entityEnumKey, Entity
403
404
  }
404
405
  return (((_a = searchResponseV2.relatedEntities[entityEnumKey]) === null || _a === void 0 ? void 0 : _a.baseEntities) || []).map((entity) => Object.assign(new EntityClass(), entity));
405
406
  }
407
+ /**
408
+ * Recursively searches for entities of a specific type within a nested `relatedEntities` structure.
409
+ *
410
+ * This function traverses the `relatedEntities` tree, looking for a target entity key.
411
+ * When found, it collects all `baseEntities` for that key and instantiates them
412
+ * as instances of the provided `EntityClass`. The function continues to traverse
413
+ * all nested `relatedEntities` recursively, accumulating all matches.
414
+ *
415
+ * @template E - The enum type representing the target entity key (`EntityEnum`).
416
+ * @template T - The corresponding entity type for the target key (`EnumEntityType<E>`).
417
+ *
418
+ * @param relatedEntities - The nested `relatedEntities` structure, typically from a
419
+ * `IBaseEntityServiceResponse`. Can be undefined, in which case an empty array is returned.
420
+ * @param targetKey - The entity key (`EntityEnum`) to search for in the nested structure.
421
+ * @param EntityClass - A constructor function for the entity type `T`. Used to
422
+ * instantiate new objects from the raw base entity data.
423
+ *
424
+ * @returns An array of entities of type `T` found at any level of the nested structure.
425
+ * If no entities are found, an empty array is returned.
426
+ *
427
+ * @example
428
+ * ```ts
429
+ * const billingEntities = findEntitiesAtAnyLevel(
430
+ * projectUserMappingsOfCurrentUser.relatedEntities,
431
+ * EntityEnum.BILLING,
432
+ * BillingEntity
433
+ * );
434
+ *
435
+ * console.log(billingEntities); // [BillingEntity {...}, BillingEntity {...}]
436
+ * ```
437
+ *
438
+ * @note
439
+ * - This function preserves the type of entities by mapping the raw objects to the provided `EntityClass`.
440
+ * - It can handle deeply nested `relatedEntities` structures.
441
+ */
442
+ function findEntitiesFromSearchV2RelatedEntities(relatedEntities, targetKey, EntityClass) {
443
+ if (!relatedEntities)
444
+ return [];
445
+ let result = [];
446
+ for (const key of Object.keys(relatedEntities)) {
447
+ const value = relatedEntities[key];
448
+ // If this key is the target and has baseEntities
449
+ if (key === targetKey && (value === null || value === void 0 ? void 0 : value.baseEntities)) {
450
+ result.push(...value.baseEntities.map((entity) => Object.assign(new EntityClass(), entity)));
451
+ }
452
+ // If value has relatedEntities, recurse
453
+ if (value === null || value === void 0 ? void 0 : value.relatedEntities) {
454
+ result.push(...findEntitiesFromSearchV2RelatedEntities(value.relatedEntities, targetKey, EntityClass));
455
+ }
456
+ }
457
+ return result;
458
+ }
406
459
  /**
407
460
  * Checks if two decimal numbers are approximately equal within a given tolerance.
408
461
  *
@@ -1,3 +1,5 @@
1
1
  export * from "./date.util";
2
2
  export * from "./helper.fn.util";
3
3
  export * from "./models/date-code.model.util";
4
+ export * from "./string.util";
5
+ export * from "./entity.flow.util";
@@ -17,3 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./date.util"), exports);
18
18
  __exportStar(require("./helper.fn.util"), exports);
19
19
  __exportStar(require("./models/date-code.model.util"), exports);
20
+ __exportStar(require("./string.util"), exports);
21
+ __exportStar(require("./entity.flow.util"), exports);
@@ -0,0 +1 @@
1
+ export declare function formatString(input: string): string;
@@ -1 +1,15 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatString = formatString;
4
+ function formatString(input) {
5
+ if (input.includes('_')) {
6
+ return input
7
+ .split('_')
8
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
9
+ .join(' ');
10
+ }
11
+ else {
12
+ // For single-word strings, capitalize the first letter
13
+ return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();
14
+ }
15
+ }
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "name": "law-common",
3
- "version": "10.26.1-beta.9",
4
- "description": "",
5
- "main": "dist/index.js",
6
- "files": [
7
- "dist/**/*"
8
- ],
9
- "scripts": {
10
- "clean": "rm -rf dist",
11
- "build": "npm run clean && tsc",
12
- "publish:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
13
- "publish:patch": "npm version patch && git push && npm run build && npm publish",
14
- "publish:minor": "npm version minor && git push && npm run build && npm publish",
15
- "publish:major": "npm version major && git push && npm run build && npm publish",
16
- "link": "npm run build && npm link",
17
- "test": "jest"
18
- },
19
- "keywords": [],
20
- "author": "",
21
- "license": "ISC",
22
- "devDependencies": {
23
- "@types/jest": "^29.5.13",
24
- "@types/node": "^22.6.1",
25
- "jest": "^29.7.0",
26
- "ts-jest": "^29.2.5",
27
- "ts-node": "^10.9.2",
28
- "typescript": "^5.6.2"
29
- },
30
- "dependencies": {
31
- "@types/express": "^5.0.0",
32
- "@types/multer": "^1.4.12",
33
- "date-fns": "^4.1.0"
34
- }
35
- }
1
+ {
2
+ "name": "law-common",
3
+ "version": "10.28.0",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "files": [
7
+ "dist/**/*"
8
+ ],
9
+ "scripts": {
10
+ "clean": "rm -rf dist",
11
+ "build": "npm run clean && tsc",
12
+ "publish:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
13
+ "publish:patch": "npm version patch && git push && npm run build && npm publish",
14
+ "publish:minor": "npm version minor && git push && npm run build && npm publish",
15
+ "publish:major": "npm version major && git push && npm run build && npm publish",
16
+ "link": "npm run build && npm link",
17
+ "test": "jest"
18
+ },
19
+ "keywords": [],
20
+ "author": "",
21
+ "license": "ISC",
22
+ "devDependencies": {
23
+ "@types/jest": "^29.5.13",
24
+ "@types/node": "^22.6.1",
25
+ "jest": "^29.7.0",
26
+ "ts-jest": "^29.2.5",
27
+ "ts-node": "^10.9.2",
28
+ "typescript": "^5.6.2"
29
+ },
30
+ "dependencies": {
31
+ "@types/express": "^5.0.0",
32
+ "@types/multer": "^1.4.12",
33
+ "date-fns": "^4.1.0"
34
+ }
35
+ }
@@ -1,15 +0,0 @@
1
- import { Modify } from "../../misc/interface/modify.interface";
2
- export declare function ConvertToCommonEntity<T extends {
3
- createdOn: Date;
4
- updatedOn: Date;
5
- }, R extends Modify<T, {
6
- createdOn: string;
7
- updatedOn: string;
8
- }>>(obj: T): R;
9
- export declare function ConvertApiToEntity<T extends {
10
- createdOn: string;
11
- updatedOn: string;
12
- }, R extends Modify<T, {
13
- createdOn: Date;
14
- updatedOn: Date;
15
- }>>(obj: T): R;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.ConvertToCommonEntity = ConvertToCommonEntity;
15
- exports.ConvertApiToEntity = ConvertApiToEntity;
16
- function ConvertToCommonEntity(obj) {
17
- var _a, _b;
18
- const { createdOn: _, updatedOn: __ } = obj, objectToAssign = __rest(obj, ["createdOn", "updatedOn"]);
19
- return Object.assign({ createdOn: (_a = obj.createdOn) === null || _a === void 0 ? void 0 : _a.toISOString(), updatedOn: (_b = obj.updatedOn) === null || _b === void 0 ? void 0 : _b.toISOString() }, objectToAssign);
20
- }
21
- function ConvertApiToEntity(obj) {
22
- const { createdOn: _, updatedOn: __ } = obj, objectToAssign = __rest(obj, ["createdOn", "updatedOn"]);
23
- return Object.assign({ createdOn: new Date(obj.createdOn), updatedOn: new Date(obj.updatedOn) }, objectToAssign);
24
- }