law-common 10.72.14-beta.2 → 10.72.14-beta.3
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/src/api/index.d.ts +2 -0
- package/dist/src/api/index.js +2 -0
- package/dist/src/api/interface/entity_history.create.dto.interface.d.ts +5 -0
- package/dist/src/api/interface/entity_history.create.dto.interface.js +2 -0
- package/dist/src/api/interface/entity_history.update.dto.interface.d.ts +10 -0
- package/dist/src/api/interface/entity_history.update.dto.interface.js +2 -0
- package/dist/src/api/interface/state.create.dto.interface.autocode.js +1 -3
- package/dist/src/api/interface/state.create.dto.interface.d.ts +1 -2
- package/dist/src/api/interface/state.update.dto.interface.d.ts +1 -13
- package/dist/src/api/interface/state.update.dto.interface.js +0 -8
- package/dist/src/entities/enums/entity_history_action.enum.d.ts +5 -0
- package/dist/src/entities/enums/entity_history_action.enum.js +9 -0
- package/dist/src/entities/enums/entity_history_operation_enum.d.ts +5 -0
- package/dist/src/entities/enums/entity_history_operation_enum.js +9 -0
- package/dist/src/entities/enums/entity_history_status_enum.d.ts +5 -0
- package/dist/src/entities/enums/entity_history_status_enum.js +9 -0
- package/dist/src/entities/flow-configs/entity_history_flow.config.d.ts +6 -0
- package/dist/src/entities/flow-configs/entity_history_flow.config.js +88 -0
- package/dist/src/entities/index.d.ts +6 -1
- package/dist/src/entities/index.js +6 -1
- package/dist/src/entities/interface/entity.utils.interface.d.ts +6 -3
- package/dist/src/entities/interface/entity.utils.interface.js +1 -0
- package/dist/src/entities/interface/entity_history.entity.interface.d.ts +11 -0
- package/dist/src/entities/interface/entity_history.entity.interface.js +2 -0
- package/dist/src/entities/interface/state.entity.interface.autocode.js +1 -3
- package/dist/src/entities/interface/state.entity.interface.d.ts +1 -1
- package/dist/src/entities/model/entity.model.interface.js +2 -0
- package/dist/src/entities/model/entity_history.entity.model.d.ts +37 -0
- package/dist/src/entities/model/entity_history.entity.model.js +94 -0
- package/dist/src/entities/model/state.entity.model.d.ts +3 -40
- package/dist/src/entities/model/state.entity.model.js +2 -204
- package/package.json +1 -1
- package/dist/src/api/interface/state.update.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/state.update.dto.interface.autocode.js +0 -10
- package/dist/src/entities/flow-configs/state_flow.config.d.ts +0 -6
- package/dist/src/entities/flow-configs/state_flow.config.js +0 -90
package/dist/src/api/index.d.ts
CHANGED
|
@@ -95,3 +95,5 @@ export * from "./interface/client_quote.update.dto.interface";
|
|
|
95
95
|
export * from "./interface/client_quote_rate.create.dto.interface";
|
|
96
96
|
export * from "./interface/client_quote_rate.update.dto.interface";
|
|
97
97
|
export * from "./interface/project-revenue-split.create.dto";
|
|
98
|
+
export * from "./interface/entity_history.create.dto.interface";
|
|
99
|
+
export * from "./interface/entity_history.update.dto.interface";
|
package/dist/src/api/index.js
CHANGED
|
@@ -115,3 +115,5 @@ __exportStar(require("./interface/client_quote.update.dto.interface"), exports);
|
|
|
115
115
|
__exportStar(require("./interface/client_quote_rate.create.dto.interface"), exports);
|
|
116
116
|
__exportStar(require("./interface/client_quote_rate.update.dto.interface"), exports);
|
|
117
117
|
__exportStar(require("./interface/project-revenue-split.create.dto"), exports);
|
|
118
|
+
__exportStar(require("./interface/entity_history.create.dto.interface"), exports);
|
|
119
|
+
__exportStar(require("./interface/entity_history.update.dto.interface"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IEntityCreateDto } from "../../entities";
|
|
2
|
+
import { IEntityHistoryEntity } from "../../entities/interface/entity_history.entity.interface";
|
|
3
|
+
export type IEntityHistoryCreateExclude = never;
|
|
4
|
+
export interface IEntityHistoryCreateDto extends Omit<IEntityCreateDto<IEntityHistoryEntity>, IEntityHistoryCreateExclude> {
|
|
5
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DeepPartialButRequired } from "./api.utils.interface";
|
|
2
|
+
import { IEntityHistoryCreateDto } from "./entity_history.create.dto.interface";
|
|
3
|
+
import { EntityHistoryActionEnum } from "../../entities/enums/entity_history_action.enum";
|
|
4
|
+
export type IEntityHistoryUpdateDto = DeepPartialButRequired<IEntityHistoryCreateDto, never> & {
|
|
5
|
+
actionData: IEntityHistoryActionDataDto;
|
|
6
|
+
};
|
|
7
|
+
export interface IEntityHistoryActionDataDto {
|
|
8
|
+
action: EntityHistoryActionEnum;
|
|
9
|
+
remark?: string;
|
|
10
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// import { IEntityCreateDto
|
|
3
|
-
// import { IAppFileConfig, IFilePayload, MulterFileWithUrl } from "../../misc";
|
|
4
|
-
// import { IStateEntity } from "../../entities/interface/state.entity.interface";
|
|
2
|
+
// import { IEntityCreateDto } from "../../entities";
|
|
5
3
|
// export type IStateCreateExclude = "status";
|
|
6
4
|
// export interface IStateCreateDto extends Omit<IEntityCreateDto<IStateEntity>, IStateCreateExclude> {}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { IEntityCreateDto } from "../../entities";
|
|
2
|
-
import { IStateEntity } from "../../entities/interface/state.entity.interface";
|
|
1
|
+
import { IEntityCreateDto, IStateEntity } from "../../entities";
|
|
3
2
|
export type IStateCreateExclude = "status";
|
|
4
3
|
export interface IStateCreateDto extends Omit<IEntityCreateDto<IStateEntity>, IStateCreateExclude> {
|
|
5
4
|
}
|
|
@@ -1,15 +1,3 @@
|
|
|
1
1
|
import { DeepPartialButRequired } from "./api.utils.interface";
|
|
2
2
|
import { IStateCreateDto } from "./state.create.dto.interface";
|
|
3
|
-
export type IStateUpdateDto = DeepPartialButRequired<IStateCreateDto, never
|
|
4
|
-
actionData: IStateActionDataDto;
|
|
5
|
-
};
|
|
6
|
-
export interface IStateActionDataDto {
|
|
7
|
-
action: StateActionEnum;
|
|
8
|
-
remark?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare enum StateActionEnum {
|
|
11
|
-
VIEW = "view",
|
|
12
|
-
EDIT = "edit",
|
|
13
|
-
DELETE = "delete",
|
|
14
|
-
CREATE = "create"
|
|
15
|
-
}
|
|
3
|
+
export type IStateUpdateDto = DeepPartialButRequired<IStateCreateDto, never>;
|
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StateActionEnum = void 0;
|
|
4
|
-
var StateActionEnum;
|
|
5
|
-
(function (StateActionEnum) {
|
|
6
|
-
StateActionEnum["VIEW"] = "view";
|
|
7
|
-
StateActionEnum["EDIT"] = "edit";
|
|
8
|
-
StateActionEnum["DELETE"] = "delete";
|
|
9
|
-
StateActionEnum["CREATE"] = "create";
|
|
10
|
-
})(StateActionEnum || (exports.StateActionEnum = StateActionEnum = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntityHistoryActionEnum = void 0;
|
|
4
|
+
var EntityHistoryActionEnum;
|
|
5
|
+
(function (EntityHistoryActionEnum) {
|
|
6
|
+
EntityHistoryActionEnum["CREATE"] = "CREATE";
|
|
7
|
+
EntityHistoryActionEnum["UPDATE"] = "UPDATE";
|
|
8
|
+
EntityHistoryActionEnum["DELETE"] = "DELETE";
|
|
9
|
+
})(EntityHistoryActionEnum || (exports.EntityHistoryActionEnum = EntityHistoryActionEnum = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntityHistoryOperationEnum = void 0;
|
|
4
|
+
var EntityHistoryOperationEnum;
|
|
5
|
+
(function (EntityHistoryOperationEnum) {
|
|
6
|
+
EntityHistoryOperationEnum["CREATE"] = "CREATE";
|
|
7
|
+
EntityHistoryOperationEnum["UPDATE"] = "UPDATE";
|
|
8
|
+
EntityHistoryOperationEnum["DELETE"] = "DELETE";
|
|
9
|
+
})(EntityHistoryOperationEnum || (exports.EntityHistoryOperationEnum = EntityHistoryOperationEnum = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntityHistoryStatusEnum = void 0;
|
|
4
|
+
var EntityHistoryStatusEnum;
|
|
5
|
+
(function (EntityHistoryStatusEnum) {
|
|
6
|
+
EntityHistoryStatusEnum["CREATED"] = "CREATED";
|
|
7
|
+
EntityHistoryStatusEnum["UPDATED"] = "UPDATED";
|
|
8
|
+
EntityHistoryStatusEnum["DELETED"] = "DELETED";
|
|
9
|
+
})(EntityHistoryStatusEnum || (exports.EntityHistoryStatusEnum = EntityHistoryStatusEnum = {}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EntityHistoryActionEnum } from "../enums/entity_history_action.enum";
|
|
2
|
+
import { EntityHistoryStatusEnum } from "../enums/entity_history_status_enum";
|
|
3
|
+
import { FlowConfig } from "./flow-config.type";
|
|
4
|
+
export interface IEntityHistoryFlowConfigContextData {
|
|
5
|
+
}
|
|
6
|
+
export declare const entityHistoryFlowConfig: FlowConfig<EntityHistoryStatusEnum, EntityHistoryActionEnum, IEntityHistoryFlowConfigContextData>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.entityHistoryFlowConfig = void 0;
|
|
4
|
+
// import { EntityHistoryActionEnum } from "../../api";
|
|
5
|
+
// import { EntityHistoryStatusEnum } from "../enums/ENTITY_HISTORY_status_enum";
|
|
6
|
+
const entity_history_action_enum_1 = require("../enums/entity_history_action.enum");
|
|
7
|
+
const entity_history_status_enum_1 = require("../enums/entity_history_status_enum");
|
|
8
|
+
/**
|
|
9
|
+
* State Flow Configuration - Status transition rules for state master.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Simple transition (fixed target status)
|
|
13
|
+
* createActionConfig(EntityHistoryStatusEnum.INACTIVE, EntityHistoryActionEnum.DELETE)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Function-based transition (choose one of possible statuses via context data)
|
|
17
|
+
* // Note: this example uses an extended context shape for illustration.
|
|
18
|
+
* type IExtendedContext = IEntityHistoryFlowConfigContextData & { nextStatus?: EntityHistoryStatusEnum };
|
|
19
|
+
* const transitionWithContext = (context: IExtendedContext) =>
|
|
20
|
+
* context.nextStatus === EntityHistoryStatusEnum.DEACTIVE ? EntityHistoryStatusEnum.DEACTIVE : EntityHistoryStatusEnum.ACTIVE;
|
|
21
|
+
* createActionConfig(transitionWithContext, EntityHistoryActionEnum.EDIT)
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Subset transition — restricts the valid next statuses for a specific (currentStatus, action) pair.
|
|
25
|
+
* //
|
|
26
|
+
* // EntityHistoryActionStatusMap says EDIT can go to: ACTIVE | DEACTIVE | INACTIVE (globally).
|
|
27
|
+
* // But from ACTIVE status, EDIT should only allow ACTIVE or DEACTIVE (not INACTIVE).
|
|
28
|
+
* // The Subset type parameter enforces this narrowing at compile time.
|
|
29
|
+
* //
|
|
30
|
+
* // TypeScript will reject any value outside the declared Subset:
|
|
31
|
+
* // createActionConfig<EntityHistoryActionEnum.EDIT, EntityHistoryStatusEnum.ACTIVE | EntityHistoryStatusEnum.DEACTIVE>(
|
|
32
|
+
* // EntityHistoryStatusEnum.INACTIVE, // ❌ compile error — INACTIVE not in Subset
|
|
33
|
+
* // EntityHistoryActionEnum.EDIT
|
|
34
|
+
* // )
|
|
35
|
+
* //
|
|
36
|
+
* // Correct usage with a fixed subset value:
|
|
37
|
+
* createActionConfig<EntityHistoryActionEnum.EDIT, EntityHistoryStatusEnum.ACTIVE | EntityHistoryStatusEnum.DEACTIVE>(
|
|
38
|
+
* EntityHistoryStatusEnum.ACTIVE,
|
|
39
|
+
* EntityHistoryActionEnum.EDIT
|
|
40
|
+
* )
|
|
41
|
+
* //
|
|
42
|
+
* // Correct usage with a context-driven subset function:
|
|
43
|
+
* type IExtendedContext2 = IEntityHistoryFlowConfigContextData & { deactivate?: boolean };
|
|
44
|
+
* createActionConfig<EntityHistoryActionEnum.EDIT, EntityHistoryStatusEnum.ACTIVE | EntityHistoryStatusEnum.DEACTIVE>(
|
|
45
|
+
* (context: IExtendedContext2) =>
|
|
46
|
+
* context.deactivate ? EntityHistoryStatusEnum.DEACTIVE : EntityHistoryStatusEnum.ACTIVE,
|
|
47
|
+
* EntityHistoryActionEnum.EDIT
|
|
48
|
+
* )
|
|
49
|
+
*/
|
|
50
|
+
const ENTITY_HISTORY_CREATE_PERMISSION = ["ENTITY_HISTORY_CREATE"];
|
|
51
|
+
const ENTITY_HISTORY_UPDATE_PERMISSION = ["ENTITY_HISTORY_UPDATE"];
|
|
52
|
+
const ENTITY_HISTORY_DELETE_PERMISSION = ["ENTITY_HISTORY_DELETE"];
|
|
53
|
+
const createTransition = (transition) => (context) => {
|
|
54
|
+
if (typeof transition === "function") {
|
|
55
|
+
return transition(context);
|
|
56
|
+
}
|
|
57
|
+
return transition;
|
|
58
|
+
};
|
|
59
|
+
const actionPermissionMap = {
|
|
60
|
+
[entity_history_action_enum_1.EntityHistoryActionEnum.CREATE]: ENTITY_HISTORY_CREATE_PERMISSION,
|
|
61
|
+
[entity_history_action_enum_1.EntityHistoryActionEnum.UPDATE]: ENTITY_HISTORY_UPDATE_PERMISSION,
|
|
62
|
+
[entity_history_action_enum_1.EntityHistoryActionEnum.DELETE]: ENTITY_HISTORY_DELETE_PERMISSION,
|
|
63
|
+
};
|
|
64
|
+
const createActionConfig = (nextStatus, action, overridePermissions) => ({
|
|
65
|
+
permissions: overridePermissions !== null && overridePermissions !== void 0 ? overridePermissions : actionPermissionMap[action],
|
|
66
|
+
next: createTransition(nextStatus),
|
|
67
|
+
});
|
|
68
|
+
// const transitionActiveStatusEditAction = (context: IEntityHistoryFlowConfigContextData): EntityHistoryStatusEnum.DEACTIVE | EntityHistoryStatusEnum.ACTIVE =>
|
|
69
|
+
// EntityHistoryStatusEnum.DEACTIVE;
|
|
70
|
+
exports.entityHistoryFlowConfig = {
|
|
71
|
+
[entity_history_status_enum_1.EntityHistoryStatusEnum.CREATED]: {
|
|
72
|
+
actions: {
|
|
73
|
+
[entity_history_action_enum_1.EntityHistoryActionEnum.UPDATE]: createActionConfig(entity_history_status_enum_1.EntityHistoryStatusEnum.UPDATED, entity_history_action_enum_1.EntityHistoryActionEnum.UPDATE),
|
|
74
|
+
[entity_history_action_enum_1.EntityHistoryActionEnum.DELETE]: createActionConfig(entity_history_status_enum_1.EntityHistoryStatusEnum.DELETED, entity_history_action_enum_1.EntityHistoryActionEnum.DELETE),
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
[entity_history_status_enum_1.EntityHistoryStatusEnum.UPDATED]: {
|
|
78
|
+
actions: {
|
|
79
|
+
[entity_history_action_enum_1.EntityHistoryActionEnum.UPDATE]: createActionConfig(entity_history_status_enum_1.EntityHistoryStatusEnum.UPDATED, entity_history_action_enum_1.EntityHistoryActionEnum.UPDATE),
|
|
80
|
+
[entity_history_action_enum_1.EntityHistoryActionEnum.DELETE]: createActionConfig(entity_history_status_enum_1.EntityHistoryStatusEnum.DELETED, entity_history_action_enum_1.EntityHistoryActionEnum.DELETE),
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
[entity_history_status_enum_1.EntityHistoryStatusEnum.DELETED]: {
|
|
84
|
+
actions: {
|
|
85
|
+
[entity_history_action_enum_1.EntityHistoryActionEnum.UPDATE]: createActionConfig(entity_history_status_enum_1.EntityHistoryStatusEnum.UPDATED, entity_history_action_enum_1.EntityHistoryActionEnum.UPDATE),
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
};
|
|
@@ -105,7 +105,6 @@ export * from "./interface/address-book.entity.interface";
|
|
|
105
105
|
export * from "./enums/state_status_enum";
|
|
106
106
|
export * from "./interface/state.entity.interface";
|
|
107
107
|
export * from "./model/state.entity.model";
|
|
108
|
-
export * from "./flow-configs/state_flow.config";
|
|
109
108
|
export * from "./enums/gst_rate_status_enum";
|
|
110
109
|
export * from "./interface/gst_rate.entity.interface";
|
|
111
110
|
export * from "./model/gst_rate.entity.model";
|
|
@@ -211,3 +210,9 @@ export * from "./enums/project-revenue-split.enum";
|
|
|
211
210
|
export * from "./interface/project-revenue-split-mapping.entity";
|
|
212
211
|
export * from "./model/project-revenue-split-mapping.model";
|
|
213
212
|
export * from "./flow-configs/billing-transaction.flow.config";
|
|
213
|
+
export * from "./enums/entity_history_action.enum";
|
|
214
|
+
export * from "./enums/entity_history_operation_enum";
|
|
215
|
+
export * from "./enums/entity_history_status_enum";
|
|
216
|
+
export * from "./interface/entity_history.entity.interface";
|
|
217
|
+
export * from "./flow-configs/entity_history_flow.config";
|
|
218
|
+
export * from "./model/entity_history.entity.model";
|
|
@@ -121,7 +121,6 @@ __exportStar(require("./interface/address-book.entity.interface"), exports);
|
|
|
121
121
|
__exportStar(require("./enums/state_status_enum"), exports);
|
|
122
122
|
__exportStar(require("./interface/state.entity.interface"), exports);
|
|
123
123
|
__exportStar(require("./model/state.entity.model"), exports);
|
|
124
|
-
__exportStar(require("./flow-configs/state_flow.config"), exports);
|
|
125
124
|
__exportStar(require("./enums/gst_rate_status_enum"), exports);
|
|
126
125
|
__exportStar(require("./interface/gst_rate.entity.interface"), exports);
|
|
127
126
|
__exportStar(require("./model/gst_rate.entity.model"), exports);
|
|
@@ -227,3 +226,9 @@ __exportStar(require("./enums/project-revenue-split.enum"), exports);
|
|
|
227
226
|
__exportStar(require("./interface/project-revenue-split-mapping.entity"), exports);
|
|
228
227
|
__exportStar(require("./model/project-revenue-split-mapping.model"), exports);
|
|
229
228
|
__exportStar(require("./flow-configs/billing-transaction.flow.config"), exports);
|
|
229
|
+
__exportStar(require("./enums/entity_history_action.enum"), exports);
|
|
230
|
+
__exportStar(require("./enums/entity_history_operation_enum"), exports);
|
|
231
|
+
__exportStar(require("./enums/entity_history_status_enum"), exports);
|
|
232
|
+
__exportStar(require("./interface/entity_history.entity.interface"), exports);
|
|
233
|
+
__exportStar(require("./flow-configs/entity_history_flow.config"), exports);
|
|
234
|
+
__exportStar(require("./model/entity_history.entity.model"), exports);
|
|
@@ -27,6 +27,7 @@ import { CountryEntityModel } from "../model/country.entity.model";
|
|
|
27
27
|
import { CronJobsEntityModel } from "../model/cron_jobs.entity.model";
|
|
28
28
|
import { DesignationEntityModel } from "../model/designation.entity.model";
|
|
29
29
|
import { DocumentUploadEntityModel } from "../model/document_upload.entity.model";
|
|
30
|
+
import { EntityHistoryEntityModel } from "../model/entity_history.entity.model";
|
|
30
31
|
import { ExpenseHeadEntityModel } from "../model/expense_head.entity.model";
|
|
31
32
|
import { ExpenseTypeEntityModel } from "../model/expense_type.entity.model";
|
|
32
33
|
import { GstRateEntityModel } from "../model/gst_rate.entity.model";
|
|
@@ -93,6 +94,7 @@ import { ICronJobsEntity } from "./cron-job.entity.interface";
|
|
|
93
94
|
import { IDesignationEntity } from "./designation.entity.interface";
|
|
94
95
|
import { IDocumentUploadEntity } from "./document_upload.entity.interface";
|
|
95
96
|
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
97
|
+
import { IEntityHistoryEntity } from "./entity_history.entity.interface";
|
|
96
98
|
import { IExpenseHeadEntity } from "./expense_head.entity.interface";
|
|
97
99
|
import { IExpenseTypeEntity } from "./expense_type.entity.interface";
|
|
98
100
|
import { IGstRateEntity } from "./gst_rate.entity.interface";
|
|
@@ -237,7 +239,8 @@ export declare enum EntityEnum {
|
|
|
237
239
|
VENDOR_INVOICE_ITEM_HISTORY = "vendor_invoice_item_history",
|
|
238
240
|
VENDOR_HISTORY = "vendor_history",
|
|
239
241
|
CLIENT_QUOTE = "client_quote",
|
|
240
|
-
CLIENT_QUOTE_RATE = "client_quote_rate"
|
|
242
|
+
CLIENT_QUOTE_RATE = "client_quote_rate",
|
|
243
|
+
ENTITY_HISTORY = "entity_history"
|
|
241
244
|
}
|
|
242
245
|
export type EntityRelations = {
|
|
243
246
|
[K in EntityEnum | VirtualEntityEnum]: K;
|
|
@@ -262,7 +265,7 @@ export type IBaseEntityApiResponse<T> = {
|
|
|
262
265
|
[key in EntityEnum | VirtualEntityEnum]?: AggregationFields<EnumToModel<key>>[];
|
|
263
266
|
};
|
|
264
267
|
};
|
|
265
|
-
export type EnumEntityType<T extends EntityEnum | VirtualEntityEnum> = (T extends EntityEnum.BILLING ? IBillingEntity : T extends EntityEnum.BILLING_HISTORY ? IBillingHistoryEntity : T extends EntityEnum.BILLING_TIMESHEET ? IBillingTimesheetEntity : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? IBillingReimbursementExpenseEntity : T extends EntityEnum.BILLING_TIMESHEET_HISTORY ? IBillingTimesheetHistoryEntity : T extends EntityEnum.BILLING_REIMBURESMENT_EXPENSE_HISTORY ? IBillingReimbursementExpenseHistoryEntity : T extends EntityEnum.TIMESHEET ? ITimesheetEntity : T extends EntityEnum.USER ? IUserEntity : T extends EntityEnum.PROJECT ? IProjectEntity : T extends EntityEnum.CLIENT ? IClientEntity : T extends EntityEnum.LEAVE ? ILeaveEntity : T extends EntityEnum.BANK ? IBankEntity : T extends EntityEnum.BILLING_TRANSACTION ? IBillingTransactionEntity : T extends EntityEnum.BILLING_TRANSACTION_HISTORY ? IBillingTransactionHistoryEntity : T extends EntityEnum.CLIENT_AFFILIATE ? IClientAffiliateEntity : T extends EntityEnum.CONFIGURATION ? IConfigurationEntity : T extends EntityEnum.HOLIDAY ? IHolidayEntity : T extends EntityEnum.HOLIDAY_LIST ? IHolidayListEntity : T extends EntityEnum.COUNTRY ? ICountryEntity : T extends EntityEnum.EXPENSE_TYPE ? IExpenseTypeEntity : T extends EntityEnum.INDUSTRY ? IIndustryEntity : T extends EntityEnum.INTERMEDIARY_BANK ? IIntermediaryBankEntity : T extends EntityEnum.OFFICE_LOCATION ? IOfficeLocationEntity : T extends EntityEnum.PERMISSION ? IPermissionEntity : T extends EntityEnum.ROLE ? IRoleEntity : T extends EntityEnum.TASK ? ITaskEntity : T extends EntityEnum.DESIGNATION ? IDesignationEntity : T extends EntityEnum.RATE ? IRateEntity : T extends EntityEnum.REIMBURSEMENT ? IReimbursementEntity : T extends EntityEnum.REIMBURSEMENT_EXPENSE ? IReimbursementExpenseEntity : T extends EntityEnum.REIMBURSEMENT_HISTORY ? IReimbursementHistoryEntity : T extends EntityEnum.WORK_FROM_HOME ? IWorkFromHomeEntity : T extends EntityEnum.ORGANIZATION ? IOrganizationEntity : T extends EntityEnum.PROJECT_USER_MAPPING ? IProjectUserMappingEntity : T extends EntityEnum.CLIENT_USER_MAPPING ? IClientUserMappingEntity : T extends EntityEnum.CLIENT_INTRODUCING_MAPPING ? IClientIntroducingMappingEntity : T extends EntityEnum.TO_DO_LIST ? IToDoListEntity : T extends EntityEnum.CRON_JOBS ? ICronJobsEntity : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? IRolePermissionMappingEntity : T extends EntityEnum.BANK_HISTORY ? IBankHistoryEntity : T extends VirtualEntityEnum.LEAVE_COUNT ? ILeaveCountVirtualEntity : T extends EntityEnum.LEAVE_HISTORY ? ILeaveHistoryEntity : T extends EntityEnum.WORK_FROM_HOME_HISTORY ? IWorkFromHomeHistoryEntity : T extends EntityEnum.TIMESHEET_HISTORY ? ITimesheetHistoryEntity : T extends EntityEnum.ADDRESS_BOOK ? IAddressBookEntity : T extends EntityEnum.STATE ? IStateEntity : T extends EntityEnum.GST_RATE ? IGstRateEntity : T extends EntityEnum.ORGANIZATION_TYPE ? IOrganizationTypeEntity : T extends EntityEnum.TDS_RATE ? ITdsRateEntity : T extends EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING ? IOrganizationTypeTdsRateMappingEntity : T extends EntityEnum.VOUCHER_TYPE ? IVoucherTypeEntity : T extends EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING ? ITdsRateVoucherTypeMappingEntity : T extends EntityEnum.EXPENSE_HEAD ? IExpenseHeadEntity : T extends EntityEnum.DOCUMENT_UPLOAD ? IDocumentUploadEntity : T extends EntityEnum.VENDOR ? IVendorEntity : T extends EntityEnum.VENDOR_INVOICE ? IVendorInvoiceEntity : T extends EntityEnum.VENDOR_INVOICE_HISTORY ? IVendorInvoiceHistoryEntity : T extends EntityEnum.VENDOR_INVOICE_HISTORY ? IVendorInvoiceHistoryEntity : T extends EntityEnum.VENDOR_INVOICE_ITEM ? IVendorInvoiceItemEntity : T extends EntityEnum.VENDOR_INVOICE_ITEM_HISTORY ? IVendorInvoiceItemHistoryEntity : T extends EntityEnum.VENDOR_HISTORY ? IVendorHistoryEntity : T extends EntityEnum.WEBSITE_LEAD ? IWebsiteLeadEntity : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? IWebsiteNewsletterSubscriptionEntity : T extends EntityEnum.CLIENT_QUOTE ? IClientQuoteEntity : T extends EntityEnum.CLIENT_QUOTE_RATE ? IClientQuoteRateEntity : T extends EntityEnum.BILLING_PROFILE ? IBillingProfileEntity : T extends EntityEnum.PROJECT_REVENUE_SPLIT_MAPPING ? IProjectRevenueSplitMappingEntity : T extends EntityEnum.VENDOR_INVOICE_ITEM_HISTORY ? IVendorInvoiceItemHistoryEntity : T extends EntityEnum.VENDOR_HISTORY ? IVendorHistoryEntity : T extends EntityEnum.WEBSITE_LEAD ? IWebsiteLeadEntity : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? IWebsiteNewsletterSubscriptionEntity : T extends EntityEnum.CLIENT_QUOTE ? IClientQuoteEntity : T extends EntityEnum.CLIENT_QUOTE_RATE ? IClientQuoteRateEntity : never) & {
|
|
268
|
+
export type EnumEntityType<T extends EntityEnum | VirtualEntityEnum> = (T extends EntityEnum.BILLING ? IBillingEntity : T extends EntityEnum.BILLING_HISTORY ? IBillingHistoryEntity : T extends EntityEnum.BILLING_TIMESHEET ? IBillingTimesheetEntity : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? IBillingReimbursementExpenseEntity : T extends EntityEnum.BILLING_TIMESHEET_HISTORY ? IBillingTimesheetHistoryEntity : T extends EntityEnum.BILLING_REIMBURESMENT_EXPENSE_HISTORY ? IBillingReimbursementExpenseHistoryEntity : T extends EntityEnum.TIMESHEET ? ITimesheetEntity : T extends EntityEnum.USER ? IUserEntity : T extends EntityEnum.PROJECT ? IProjectEntity : T extends EntityEnum.CLIENT ? IClientEntity : T extends EntityEnum.LEAVE ? ILeaveEntity : T extends EntityEnum.BANK ? IBankEntity : T extends EntityEnum.BILLING_TRANSACTION ? IBillingTransactionEntity : T extends EntityEnum.BILLING_TRANSACTION_HISTORY ? IBillingTransactionHistoryEntity : T extends EntityEnum.CLIENT_AFFILIATE ? IClientAffiliateEntity : T extends EntityEnum.CONFIGURATION ? IConfigurationEntity : T extends EntityEnum.HOLIDAY ? IHolidayEntity : T extends EntityEnum.HOLIDAY_LIST ? IHolidayListEntity : T extends EntityEnum.COUNTRY ? ICountryEntity : T extends EntityEnum.EXPENSE_TYPE ? IExpenseTypeEntity : T extends EntityEnum.INDUSTRY ? IIndustryEntity : T extends EntityEnum.INTERMEDIARY_BANK ? IIntermediaryBankEntity : T extends EntityEnum.OFFICE_LOCATION ? IOfficeLocationEntity : T extends EntityEnum.PERMISSION ? IPermissionEntity : T extends EntityEnum.ROLE ? IRoleEntity : T extends EntityEnum.TASK ? ITaskEntity : T extends EntityEnum.DESIGNATION ? IDesignationEntity : T extends EntityEnum.RATE ? IRateEntity : T extends EntityEnum.REIMBURSEMENT ? IReimbursementEntity : T extends EntityEnum.REIMBURSEMENT_EXPENSE ? IReimbursementExpenseEntity : T extends EntityEnum.REIMBURSEMENT_HISTORY ? IReimbursementHistoryEntity : T extends EntityEnum.WORK_FROM_HOME ? IWorkFromHomeEntity : T extends EntityEnum.ORGANIZATION ? IOrganizationEntity : T extends EntityEnum.PROJECT_USER_MAPPING ? IProjectUserMappingEntity : T extends EntityEnum.CLIENT_USER_MAPPING ? IClientUserMappingEntity : T extends EntityEnum.CLIENT_INTRODUCING_MAPPING ? IClientIntroducingMappingEntity : T extends EntityEnum.TO_DO_LIST ? IToDoListEntity : T extends EntityEnum.CRON_JOBS ? ICronJobsEntity : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? IRolePermissionMappingEntity : T extends EntityEnum.BANK_HISTORY ? IBankHistoryEntity : T extends VirtualEntityEnum.LEAVE_COUNT ? ILeaveCountVirtualEntity : T extends EntityEnum.LEAVE_HISTORY ? ILeaveHistoryEntity : T extends EntityEnum.WORK_FROM_HOME_HISTORY ? IWorkFromHomeHistoryEntity : T extends EntityEnum.TIMESHEET_HISTORY ? ITimesheetHistoryEntity : T extends EntityEnum.ADDRESS_BOOK ? IAddressBookEntity : T extends EntityEnum.STATE ? IStateEntity : T extends EntityEnum.GST_RATE ? IGstRateEntity : T extends EntityEnum.ORGANIZATION_TYPE ? IOrganizationTypeEntity : T extends EntityEnum.TDS_RATE ? ITdsRateEntity : T extends EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING ? IOrganizationTypeTdsRateMappingEntity : T extends EntityEnum.VOUCHER_TYPE ? IVoucherTypeEntity : T extends EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING ? ITdsRateVoucherTypeMappingEntity : T extends EntityEnum.EXPENSE_HEAD ? IExpenseHeadEntity : T extends EntityEnum.DOCUMENT_UPLOAD ? IDocumentUploadEntity : T extends EntityEnum.VENDOR ? IVendorEntity : T extends EntityEnum.VENDOR_INVOICE ? IVendorInvoiceEntity : T extends EntityEnum.VENDOR_INVOICE_HISTORY ? IVendorInvoiceHistoryEntity : T extends EntityEnum.VENDOR_INVOICE_HISTORY ? IVendorInvoiceHistoryEntity : T extends EntityEnum.VENDOR_INVOICE_ITEM ? IVendorInvoiceItemEntity : T extends EntityEnum.VENDOR_INVOICE_ITEM_HISTORY ? IVendorInvoiceItemHistoryEntity : T extends EntityEnum.VENDOR_HISTORY ? IVendorHistoryEntity : T extends EntityEnum.WEBSITE_LEAD ? IWebsiteLeadEntity : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? IWebsiteNewsletterSubscriptionEntity : T extends EntityEnum.CLIENT_QUOTE ? IClientQuoteEntity : T extends EntityEnum.CLIENT_QUOTE_RATE ? IClientQuoteRateEntity : T extends EntityEnum.BILLING_PROFILE ? IBillingProfileEntity : T extends EntityEnum.PROJECT_REVENUE_SPLIT_MAPPING ? IProjectRevenueSplitMappingEntity : T extends EntityEnum.VENDOR_INVOICE_ITEM_HISTORY ? IVendorInvoiceItemHistoryEntity : T extends EntityEnum.VENDOR_HISTORY ? IVendorHistoryEntity : T extends EntityEnum.WEBSITE_LEAD ? IWebsiteLeadEntity : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? IWebsiteNewsletterSubscriptionEntity : T extends EntityEnum.CLIENT_QUOTE ? IClientQuoteEntity : T extends EntityEnum.CLIENT_QUOTE_RATE ? IClientQuoteRateEntity : T extends EntityEnum.ENTITY_HISTORY ? IEntityHistoryEntity : never) & {
|
|
266
269
|
id: number;
|
|
267
270
|
};
|
|
268
271
|
export type EntityRelationConfig<T extends EntityEnum | VirtualEntityEnum> = {
|
|
@@ -388,7 +391,7 @@ export declare enum VirtualEntityEnum {
|
|
|
388
391
|
}
|
|
389
392
|
export type IHistoryConstraintSearchResponse<T> = IBaseResponse<IHistoryEntitySearchByConstraintResponse<T>[]>;
|
|
390
393
|
export type IHistoryConstraintSearchServiceResponse<T> = IHistoryEntitySearchByConstraintResponse<T>[];
|
|
391
|
-
export type EnumToModel<T extends EntityEnum | VirtualEntityEnum> = T extends EntityEnum.BILLING ? BillingEntityModel : T extends EntityEnum.BILLING_HISTORY ? BillingHistoryEntityModel : T extends EntityEnum.CLIENT ? ClientEntityModel : T extends EntityEnum.INTERMEDIARY_BANK ? IntermediaryBankEntityModel : T extends EntityEnum.PROJECT ? ProjectEntityModel : T extends EntityEnum.PROJECT_USER_MAPPING ? ProjectUserMappingEntityModel : T extends EntityEnum.REIMBURSEMENT ? ReimbursementEntityModel : T extends EntityEnum.REIMBURSEMENT_EXPENSE ? ReimbursementExpenseEntityModel : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? BillingReimbursementExpneseEntityModel : T extends EntityEnum.BILLING_REIMBURESMENT_EXPENSE_HISTORY ? BillingReimbursementExpenseHistoryEntityModel : T extends EntityEnum.LEAVE ? LeaveEntityModel : T extends EntityEnum.WORK_FROM_HOME ? WorkFromHomeEntityModel : T extends EntityEnum.HOLIDAY ? HolidayEntityModel : T extends VirtualEntityEnum.LEAVE_COUNT ? LeaveCountVirtualEntityModel : T extends EntityEnum.CLIENT_AFFILIATE ? ClientAffiliateEntityModel : T extends EntityEnum.BANK ? BankEntityModel : T extends EntityEnum.CONFIGURATION ? ConfigurationEntityModel : T extends EntityEnum.TASK ? TaskEntityModel : T extends EntityEnum.BILLING_TIMESHEET ? BillingTimesheetEntityModel : T extends EntityEnum.BILLING_TIMESHEET_HISTORY ? BillingTimesheetHistoryEntityModel : T extends EntityEnum.TIMESHEET ? TimesheetEntityModel : T extends EntityEnum.TIMESHEET_HISTORY ? TimesheetHistoryEntityModel : T extends EntityEnum.COUNTRY ? CountryEntityModel : T extends EntityEnum.BILLING_TRANSACTION ? BillingTransactionEntityModel : T extends EntityEnum.BILLING_TRANSACTION_HISTORY ? BillingTransactionHistoryEntityModel : T extends EntityEnum.ADDRESS_BOOK ? AddressBookEntityModel : T extends EntityEnum.STATE ? StateEntityModel : T extends EntityEnum.GST_RATE ? GstRateEntityModel : T extends EntityEnum.ORGANIZATION_TYPE ? OrganizationTypeEntityModel : T extends EntityEnum.TDS_RATE ? TdsRateEntityModel : T extends EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING ? OrganizationTypeTdsRateMappingEntityModel : T extends EntityEnum.VOUCHER_TYPE ? VoucherTypeEntityModel : T extends EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING ? TdsRateVoucherTypeMappingEntityModel : T extends EntityEnum.ORGANIZATION ? OrganizationEntityModel : T extends EntityEnum.INDUSTRY ? IndustryEntityModel : T extends EntityEnum.EXPENSE_TYPE ? ExpenseTypeEntityModel : T extends EntityEnum.DESIGNATION ? DesignationEntityModel : T extends EntityEnum.RATE ? RateEntityModel : T extends EntityEnum.ROLE ? RoleEntityModel : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? RolePermissionMappingEntityModel : T extends EntityEnum.PERMISSION ? PermissionEntityModel : T extends EntityEnum.EXPENSE_HEAD ? ExpenseHeadEntityModel : T extends EntityEnum.DOCUMENT_UPLOAD ? DocumentUploadEntityModel : T extends EntityEnum.VENDOR ? VendorEntityModel : T extends EntityEnum.VENDOR_INVOICE ? VendorInvoiceEntityModel : T extends EntityEnum.VENDOR_INVOICE_HISTORY ? VendorInvoiceHistoryEntityModel : T extends EntityEnum.OFFICE_LOCATION ? OfficeLocationEntityModel : T extends EntityEnum.VENDOR_INVOICE_ITEM ? VendorInvoiceItemEntityModel : T extends EntityEnum.VENDOR_INVOICE_ITEM_HISTORY ? VendorInvoiceItemHistoryEntityModel : T extends EntityEnum.VENDOR_HISTORY ? VendorHistoryEntityModel : T extends EntityEnum.WEBSITE_LEAD ? WebsiteLeadEntityModel : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? WebsiteNewsletterSubscriptionEntityModel : T extends EntityEnum.WORK_FROM_HOME_HISTORY ? WorkFromHomeHistoryEntityModel : T extends EntityEnum.LEAVE_HISTORY ? LeaveHistoryEntityModel : T extends EntityEnum.BANK_HISTORY ? BankHistoryEntityModel : T extends EntityEnum.REIMBURSEMENT_HISTORY ? ReimbursementHistoryEntityModel : T extends EntityEnum.CLIENT_USER_MAPPING ? ClientUserMappingEntityModel : T extends EntityEnum.CLIENT_INTRODUCING_MAPPING ? ClientIntroducingMappingEntityModel : T extends EntityEnum.HOLIDAY_LIST ? HolidayListEntityModel : T extends EntityEnum.CRON_JOBS ? CronJobsEntityModel : T extends EntityEnum.TO_DO_LIST ? ToDoListEntityModel : T extends EntityEnum.CLIENT_QUOTE ? ClientQuoteEntityModel : T extends EntityEnum.CLIENT_QUOTE_RATE ? ClientQuoteRateEntityModel : T extends EntityEnum.BILLING_PROFILE ? BillingProfileEntityModel : T extends EntityEnum.PROJECT_REVENUE_SPLIT_MAPPING ? ProjectRevenueSplitMappingEntityModel : T extends EntityEnum.WEBSITE_LEAD ? WebsiteLeadEntityModel : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? WebsiteNewsletterSubscriptionEntityModel : T extends EntityEnum.CLIENT_QUOTE ? ClientQuoteEntityModel : T extends EntityEnum.CLIENT_QUOTE_RATE ? ClientQuoteRateEntityModel : T extends EntityEnum.DESIGNATION ? DesignationEntityModel : T extends EntityEnum.RATE ? RateEntityModel : UserEntityModel;
|
|
394
|
+
export type EnumToModel<T extends EntityEnum | VirtualEntityEnum> = T extends EntityEnum.BILLING ? BillingEntityModel : T extends EntityEnum.BILLING_HISTORY ? BillingHistoryEntityModel : T extends EntityEnum.CLIENT ? ClientEntityModel : T extends EntityEnum.INTERMEDIARY_BANK ? IntermediaryBankEntityModel : T extends EntityEnum.PROJECT ? ProjectEntityModel : T extends EntityEnum.PROJECT_USER_MAPPING ? ProjectUserMappingEntityModel : T extends EntityEnum.REIMBURSEMENT ? ReimbursementEntityModel : T extends EntityEnum.REIMBURSEMENT_EXPENSE ? ReimbursementExpenseEntityModel : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? BillingReimbursementExpneseEntityModel : T extends EntityEnum.BILLING_REIMBURESMENT_EXPENSE_HISTORY ? BillingReimbursementExpenseHistoryEntityModel : T extends EntityEnum.LEAVE ? LeaveEntityModel : T extends EntityEnum.WORK_FROM_HOME ? WorkFromHomeEntityModel : T extends EntityEnum.HOLIDAY ? HolidayEntityModel : T extends VirtualEntityEnum.LEAVE_COUNT ? LeaveCountVirtualEntityModel : T extends EntityEnum.CLIENT_AFFILIATE ? ClientAffiliateEntityModel : T extends EntityEnum.BANK ? BankEntityModel : T extends EntityEnum.CONFIGURATION ? ConfigurationEntityModel : T extends EntityEnum.TASK ? TaskEntityModel : T extends EntityEnum.BILLING_TIMESHEET ? BillingTimesheetEntityModel : T extends EntityEnum.BILLING_TIMESHEET_HISTORY ? BillingTimesheetHistoryEntityModel : T extends EntityEnum.TIMESHEET ? TimesheetEntityModel : T extends EntityEnum.TIMESHEET_HISTORY ? TimesheetHistoryEntityModel : T extends EntityEnum.COUNTRY ? CountryEntityModel : T extends EntityEnum.BILLING_TRANSACTION ? BillingTransactionEntityModel : T extends EntityEnum.BILLING_TRANSACTION_HISTORY ? BillingTransactionHistoryEntityModel : T extends EntityEnum.ADDRESS_BOOK ? AddressBookEntityModel : T extends EntityEnum.STATE ? StateEntityModel : T extends EntityEnum.GST_RATE ? GstRateEntityModel : T extends EntityEnum.ORGANIZATION_TYPE ? OrganizationTypeEntityModel : T extends EntityEnum.TDS_RATE ? TdsRateEntityModel : T extends EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING ? OrganizationTypeTdsRateMappingEntityModel : T extends EntityEnum.VOUCHER_TYPE ? VoucherTypeEntityModel : T extends EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING ? TdsRateVoucherTypeMappingEntityModel : T extends EntityEnum.ORGANIZATION ? OrganizationEntityModel : T extends EntityEnum.INDUSTRY ? IndustryEntityModel : T extends EntityEnum.EXPENSE_TYPE ? ExpenseTypeEntityModel : T extends EntityEnum.DESIGNATION ? DesignationEntityModel : T extends EntityEnum.RATE ? RateEntityModel : T extends EntityEnum.ROLE ? RoleEntityModel : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? RolePermissionMappingEntityModel : T extends EntityEnum.PERMISSION ? PermissionEntityModel : T extends EntityEnum.EXPENSE_HEAD ? ExpenseHeadEntityModel : T extends EntityEnum.DOCUMENT_UPLOAD ? DocumentUploadEntityModel : T extends EntityEnum.VENDOR ? VendorEntityModel : T extends EntityEnum.VENDOR_INVOICE ? VendorInvoiceEntityModel : T extends EntityEnum.VENDOR_INVOICE_HISTORY ? VendorInvoiceHistoryEntityModel : T extends EntityEnum.OFFICE_LOCATION ? OfficeLocationEntityModel : T extends EntityEnum.VENDOR_INVOICE_ITEM ? VendorInvoiceItemEntityModel : T extends EntityEnum.VENDOR_INVOICE_ITEM_HISTORY ? VendorInvoiceItemHistoryEntityModel : T extends EntityEnum.VENDOR_HISTORY ? VendorHistoryEntityModel : T extends EntityEnum.WEBSITE_LEAD ? WebsiteLeadEntityModel : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? WebsiteNewsletterSubscriptionEntityModel : T extends EntityEnum.WORK_FROM_HOME_HISTORY ? WorkFromHomeHistoryEntityModel : T extends EntityEnum.LEAVE_HISTORY ? LeaveHistoryEntityModel : T extends EntityEnum.BANK_HISTORY ? BankHistoryEntityModel : T extends EntityEnum.REIMBURSEMENT_HISTORY ? ReimbursementHistoryEntityModel : T extends EntityEnum.CLIENT_USER_MAPPING ? ClientUserMappingEntityModel : T extends EntityEnum.CLIENT_INTRODUCING_MAPPING ? ClientIntroducingMappingEntityModel : T extends EntityEnum.HOLIDAY_LIST ? HolidayListEntityModel : T extends EntityEnum.CRON_JOBS ? CronJobsEntityModel : T extends EntityEnum.TO_DO_LIST ? ToDoListEntityModel : T extends EntityEnum.CLIENT_QUOTE ? ClientQuoteEntityModel : T extends EntityEnum.CLIENT_QUOTE_RATE ? ClientQuoteRateEntityModel : T extends EntityEnum.BILLING_PROFILE ? BillingProfileEntityModel : T extends EntityEnum.PROJECT_REVENUE_SPLIT_MAPPING ? ProjectRevenueSplitMappingEntityModel : T extends EntityEnum.WEBSITE_LEAD ? WebsiteLeadEntityModel : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? WebsiteNewsletterSubscriptionEntityModel : T extends EntityEnum.CLIENT_QUOTE ? ClientQuoteEntityModel : T extends EntityEnum.CLIENT_QUOTE_RATE ? ClientQuoteRateEntityModel : T extends EntityEnum.DESIGNATION ? DesignationEntityModel : T extends EntityEnum.RATE ? RateEntityModel : T extends EntityEnum.ENTITY_HISTORY ? EntityHistoryEntityModel : UserEntityModel;
|
|
392
395
|
export type EntityMap = {
|
|
393
396
|
[key in EntityEnum | VirtualEntityEnum]: EnumToModel<key>[];
|
|
394
397
|
} & {
|
|
@@ -98,6 +98,7 @@ var EntityEnum;
|
|
|
98
98
|
EntityEnum["VENDOR_HISTORY"] = "vendor_history";
|
|
99
99
|
EntityEnum["CLIENT_QUOTE"] = "client_quote";
|
|
100
100
|
EntityEnum["CLIENT_QUOTE_RATE"] = "client_quote_rate";
|
|
101
|
+
EntityEnum["ENTITY_HISTORY"] = "entity_history";
|
|
101
102
|
})(EntityEnum || (exports.EntityEnum = EntityEnum = {}));
|
|
102
103
|
var VirtualEntityEnum;
|
|
103
104
|
(function (VirtualEntityEnum) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
2
|
+
import { EntityHistoryOperationEnum } from "../enums/entity_history_operation_enum";
|
|
3
|
+
import { EntityHistoryStatusEnum } from "../enums/entity_history_status_enum";
|
|
4
|
+
export interface IEntityHistoryEntity extends IEntityAuditColumn {
|
|
5
|
+
id: number;
|
|
6
|
+
entity: string;
|
|
7
|
+
entityId: number;
|
|
8
|
+
data: string;
|
|
9
|
+
operation: EntityHistoryOperationEnum;
|
|
10
|
+
status: EntityHistoryStatusEnum;
|
|
11
|
+
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
3
|
-
// import { Nullable } from "./entity.utils.interface";
|
|
4
|
-
// import { StateStatusEnum } from "../enums/state_status_enum";
|
|
5
3
|
// export interface IStateEntity extends IEntityAuditColumn {
|
|
6
4
|
// id: number;
|
|
7
5
|
// name: string;
|
|
8
|
-
// code: string;
|
|
9
6
|
// status: StateStatusEnum;
|
|
7
|
+
// code: string;
|
|
10
8
|
// }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
2
1
|
import { StateStatusEnum } from "../enums/state_status_enum";
|
|
2
|
+
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
3
3
|
export interface IStateEntity extends IEntityAuditColumn {
|
|
4
4
|
id: number;
|
|
5
5
|
name: string;
|
|
@@ -34,6 +34,7 @@ const country_entity_model_1 = require("./country.entity.model");
|
|
|
34
34
|
const cron_jobs_entity_model_1 = require("./cron_jobs.entity.model");
|
|
35
35
|
const designation_entity_model_1 = require("./designation.entity.model");
|
|
36
36
|
const document_upload_entity_model_1 = require("./document_upload.entity.model");
|
|
37
|
+
const entity_history_entity_model_1 = require("./entity_history.entity.model");
|
|
37
38
|
const expense_head_entity_model_1 = require("./expense_head.entity.model");
|
|
38
39
|
const expense_type_entity_model_1 = require("./expense_type.entity.model");
|
|
39
40
|
const gst_rate_entity_model_1 = require("./gst_rate.entity.model");
|
|
@@ -172,6 +173,7 @@ exports.entityEnumToEntityModel = {
|
|
|
172
173
|
[entity_utils_interface_1.EntityEnum.TO_DO_LIST]: to_do_list_entity_model_1.ToDoListEntityModel.fromEntity,
|
|
173
174
|
[entity_utils_interface_1.EntityEnum.PROJECT_REVENUE_SPLIT_MAPPING]: project_revenue_split_mapping_model_1.ProjectRevenueSplitMappingEntityModel.fromEntity,
|
|
174
175
|
[entity_utils_interface_1.EntityEnum.BILLING_PROFILE]: billing_profile_entity_model_1.BillingProfileEntityModel.fromEntity,
|
|
176
|
+
[entity_utils_interface_1.EntityEnum.ENTITY_HISTORY]: entity_history_entity_model_1.EntityHistoryEntityModel.fromEntity,
|
|
175
177
|
};
|
|
176
178
|
function entityMapToModels(entityMap) {
|
|
177
179
|
for (const entityName in entityMap) {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
2
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
3
|
+
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
4
|
+
import { IUserEntity } from "../interface/user.entity.interface";
|
|
5
|
+
import { UserEntityModel } from "./user.entity.model";
|
|
6
|
+
import { IRowActions } from "./interface/row-actions.interface";
|
|
7
|
+
import { IEntityHistoryEntity } from "../interface/entity_history.entity.interface";
|
|
8
|
+
import { EntityHistoryOperationEnum } from "../enums/entity_history_operation_enum";
|
|
9
|
+
import { EntityHistoryStatusEnum } from "../enums/entity_history_status_enum";
|
|
10
|
+
import { EntityHistoryActionEnum } from "../enums/entity_history_action.enum";
|
|
11
|
+
import { IEntityHistoryFlowConfigContextData } from "../flow-configs/entity_history_flow.config";
|
|
12
|
+
export declare class EntityHistoryEntityModel extends BaseEntityModel<EntityEnum.ENTITY_HISTORY> implements IEntityHistoryEntity {
|
|
13
|
+
id: number;
|
|
14
|
+
entity: string;
|
|
15
|
+
entityId: number;
|
|
16
|
+
data: string;
|
|
17
|
+
operation: EntityHistoryOperationEnum;
|
|
18
|
+
status: EntityHistoryStatusEnum;
|
|
19
|
+
createdOn: number;
|
|
20
|
+
updatedOn: number;
|
|
21
|
+
createdBy: number;
|
|
22
|
+
updatedBy: number;
|
|
23
|
+
static relationConfigs: RelationConfigs<[], EntityEnum.ENTITY_HISTORY>;
|
|
24
|
+
static fromEntity(entity: IEntityHistoryEntity): EntityHistoryEntityModel;
|
|
25
|
+
getRelationConfigs(): any[];
|
|
26
|
+
getNextStatus(currentUser: IUserEntity, action: EntityHistoryActionEnum, entityHistoryFlowConfigContextData: IEntityHistoryFlowConfigContextData): EntityHistoryStatusEnum;
|
|
27
|
+
getAvailableActions(currentUser: UserEntityModel, config?: {
|
|
28
|
+
combinedActions?: Record<string, {
|
|
29
|
+
combineActions: EntityHistoryActionEnum[];
|
|
30
|
+
label: string;
|
|
31
|
+
}>;
|
|
32
|
+
customLabels?: Partial<Record<EntityHistoryActionEnum, string>>;
|
|
33
|
+
}): IRowActions<EntityEnum.ENTITY_HISTORY>[];
|
|
34
|
+
getUpdateActionVisibility(currentUser: UserEntityModel): {
|
|
35
|
+
[key: string]: () => boolean;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntityHistoryEntityModel = void 0;
|
|
4
|
+
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
5
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
6
|
+
const exceptions_1 = require("../../exceptions");
|
|
7
|
+
const error_key_enum_1 = require("../../enums/error.key.enum");
|
|
8
|
+
const utils_1 = require("../../utils");
|
|
9
|
+
const entity_history_operation_enum_1 = require("../enums/entity_history_operation_enum");
|
|
10
|
+
const entity_history_status_enum_1 = require("../enums/entity_history_status_enum");
|
|
11
|
+
const entity_history_flow_config_1 = require("../flow-configs/entity_history_flow.config");
|
|
12
|
+
class EntityHistoryEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.id = 0;
|
|
16
|
+
this.entity = "";
|
|
17
|
+
this.entityId = 0;
|
|
18
|
+
this.data = "";
|
|
19
|
+
this.operation = entity_history_operation_enum_1.EntityHistoryOperationEnum.CREATE;
|
|
20
|
+
this.status = entity_history_status_enum_1.EntityHistoryStatusEnum.CREATED;
|
|
21
|
+
this.createdOn = 0;
|
|
22
|
+
this.updatedOn = 0;
|
|
23
|
+
this.createdBy = 0;
|
|
24
|
+
this.updatedBy = 0;
|
|
25
|
+
}
|
|
26
|
+
static fromEntity(entity) {
|
|
27
|
+
const result = new EntityHistoryEntityModel(entity_utils_interface_1.EntityEnum.ENTITY_HISTORY);
|
|
28
|
+
Object.assign(result, entity);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
getRelationConfigs() {
|
|
32
|
+
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
33
|
+
}
|
|
34
|
+
getNextStatus(currentUser, action, entityHistoryFlowConfigContextData) {
|
|
35
|
+
if (!this.status) {
|
|
36
|
+
throw new exceptions_1.AppBadRequestException({
|
|
37
|
+
key: error_key_enum_1.ErrorKeyEnum.STATUS,
|
|
38
|
+
message: [`Status not found: ${this.status}`],
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const flowForStatus = entity_history_flow_config_1.entityHistoryFlowConfig[this.status];
|
|
42
|
+
if (!flowForStatus) {
|
|
43
|
+
throw new exceptions_1.AppBadRequestException({
|
|
44
|
+
key: error_key_enum_1.ErrorKeyEnum.STATUS,
|
|
45
|
+
message: [`No flow configuration found for status: ${this.status}`],
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (!action) {
|
|
49
|
+
throw new exceptions_1.AppBadRequestException({
|
|
50
|
+
key: error_key_enum_1.ErrorKeyEnum.ACTION_DATA,
|
|
51
|
+
message: ["actionData is required"],
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const matchingPermissionConfig = flowForStatus.actions[action];
|
|
55
|
+
if (!matchingPermissionConfig) {
|
|
56
|
+
throw new exceptions_1.AppBadRequestException({
|
|
57
|
+
key: error_key_enum_1.ErrorKeyEnum.ACTION,
|
|
58
|
+
message: [`Action '${action}' is not valid for the current status.`],
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (!currentUser.permissions || currentUser.permissions.length === 0) {
|
|
62
|
+
throw new exceptions_1.AppBadRequestException({
|
|
63
|
+
key: error_key_enum_1.ErrorKeyEnum.PERMISSIONS,
|
|
64
|
+
message: ["Permission not available for currentUser"],
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const hasPermission = matchingPermissionConfig.permissions.some((permission) => currentUser.permissions.includes(permission));
|
|
68
|
+
if (!hasPermission) {
|
|
69
|
+
throw new exceptions_1.AppBadRequestException({
|
|
70
|
+
key: error_key_enum_1.ErrorKeyEnum.PERMISSION,
|
|
71
|
+
message: [`Current user does not have permission to ${action} entityHistory`],
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const nextStatus = matchingPermissionConfig.next(entityHistoryFlowConfigContextData);
|
|
75
|
+
return nextStatus;
|
|
76
|
+
}
|
|
77
|
+
getAvailableActions(currentUser, config) {
|
|
78
|
+
var _a;
|
|
79
|
+
const params = {
|
|
80
|
+
flowConfig: entity_history_flow_config_1.entityHistoryFlowConfig,
|
|
81
|
+
currentStatus: this.status,
|
|
82
|
+
userPermissions: (_a = currentUser.permissions) !== null && _a !== void 0 ? _a : [],
|
|
83
|
+
visibilityData: this.getUpdateActionVisibility.bind(this, currentUser),
|
|
84
|
+
combinedActions: config === null || config === void 0 ? void 0 : config.combinedActions,
|
|
85
|
+
customLabels: config === null || config === void 0 ? void 0 : config.customLabels,
|
|
86
|
+
};
|
|
87
|
+
return utils_1.EntityActionFlowResolverV2.getAvailableActionsData(params);
|
|
88
|
+
}
|
|
89
|
+
getUpdateActionVisibility(currentUser) {
|
|
90
|
+
return {};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.EntityHistoryEntityModel = EntityHistoryEntityModel;
|
|
94
|
+
EntityHistoryEntityModel.relationConfigs = [];
|
|
@@ -1,23 +1,7 @@
|
|
|
1
|
+
import { StateStatusEnum } from "../enums/state_status_enum";
|
|
1
2
|
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
2
|
-
import { BaseEntityModel } from "./base.entity.model";
|
|
3
|
-
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
4
|
-
import { IUserEntity } from "../interface/user.entity.interface";
|
|
5
|
-
import { UserEntityModel } from "./user.entity.model";
|
|
6
|
-
import { IRowActions } from "./interface/row-actions.interface";
|
|
7
3
|
import { IStateEntity } from "../interface/state.entity.interface";
|
|
8
|
-
import {
|
|
9
|
-
import { VendorEntityModel } from "./vendor.entity.model";
|
|
10
|
-
import { CountryEntityModel } from "./country.entity.model";
|
|
11
|
-
import { VendorInvoiceEntityModel } from "./vendor_invoice.entity.model";
|
|
12
|
-
import { OfficeLocationEntityModel } from "./office_location.entity.model";
|
|
13
|
-
import { VendorInvoiceItemEntityModel } from "./vendor_invoice_item.entity.model";
|
|
14
|
-
import { VoucherTypeEntityModel } from "./voucher_type.entity.model";
|
|
15
|
-
import { TdsRateEntityModel } from "./tds_rate.entity.model";
|
|
16
|
-
import { OrganizationTypeEntityModel } from "./organization_type.entity.model";
|
|
17
|
-
import { ExpenseHeadEntityModel } from "./expense_head.entity.model";
|
|
18
|
-
import { GstRateEntityModel } from "./gst_rate.entity.model";
|
|
19
|
-
import { StateActionEnum } from "../../api";
|
|
20
|
-
import { IStateFlowConfigContextData } from "../flow-configs/state_flow.config";
|
|
4
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
21
5
|
export declare class StateEntityModel extends BaseEntityModel<EntityEnum.STATE> implements IStateEntity {
|
|
22
6
|
id: number;
|
|
23
7
|
name: string;
|
|
@@ -27,28 +11,7 @@ export declare class StateEntityModel extends BaseEntityModel<EntityEnum.STATE>
|
|
|
27
11
|
updatedOn: number;
|
|
28
12
|
createdBy: number;
|
|
29
13
|
updatedBy: number;
|
|
30
|
-
vendors?: VendorEntityModel[];
|
|
31
|
-
static relationConfigs: RelationConfigs<[EntityEnum.VENDOR], EntityEnum.STATE>;
|
|
32
14
|
static fromEntity(entity: IStateEntity): StateEntityModel;
|
|
15
|
+
static relationConfigs: never[];
|
|
33
16
|
getRelationConfigs(): any[];
|
|
34
|
-
get countrys(): CountryEntityModel[] | undefined;
|
|
35
|
-
get vendorInvoices(): VendorInvoiceEntityModel[] | undefined;
|
|
36
|
-
get officeLocations(): OfficeLocationEntityModel[] | undefined;
|
|
37
|
-
get vendorInvoiceItems(): VendorInvoiceItemEntityModel[] | undefined;
|
|
38
|
-
get voucherTypes(): VoucherTypeEntityModel[] | undefined;
|
|
39
|
-
get tdsRates(): TdsRateEntityModel[] | undefined;
|
|
40
|
-
get organizationTypes(): OrganizationTypeEntityModel[] | undefined;
|
|
41
|
-
get expenseHeads(): ExpenseHeadEntityModel[] | undefined;
|
|
42
|
-
get gstRates(): GstRateEntityModel[] | undefined;
|
|
43
|
-
getNextStatus(currentUser: IUserEntity, action: StateActionEnum, stateFlowConfigContextData: IStateFlowConfigContextData): StateStatusEnum;
|
|
44
|
-
getAvailableActions(currentUser: UserEntityModel, config?: {
|
|
45
|
-
combinedActions?: Record<string, {
|
|
46
|
-
combineActions: StateActionEnum[];
|
|
47
|
-
label: string;
|
|
48
|
-
}>;
|
|
49
|
-
customLabels?: Partial<Record<StateActionEnum, string>>;
|
|
50
|
-
}): IRowActions<EntityEnum.STATE>[];
|
|
51
|
-
getUpdateActionVisibility(currentUser: UserEntityModel): {
|
|
52
|
-
[key: string]: () => boolean;
|
|
53
|
-
};
|
|
54
17
|
}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StateEntityModel = void 0;
|
|
4
|
+
const state_status_enum_1 = require("../enums/state_status_enum");
|
|
4
5
|
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
5
6
|
const base_entity_model_1 = require("./base.entity.model");
|
|
6
|
-
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
7
|
-
const exceptions_1 = require("../../exceptions");
|
|
8
|
-
const error_key_enum_1 = require("../../enums/error.key.enum");
|
|
9
|
-
const utils_1 = require("../../utils");
|
|
10
|
-
const state_status_enum_1 = require("../enums/state_status_enum");
|
|
11
|
-
const state_flow_config_1 = require("../flow-configs/state_flow.config");
|
|
12
7
|
class StateEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
13
8
|
constructor() {
|
|
14
9
|
super(...arguments);
|
|
@@ -29,203 +24,6 @@ class StateEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
29
24
|
getRelationConfigs() {
|
|
30
25
|
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
31
26
|
}
|
|
32
|
-
get countrys() {
|
|
33
|
-
// many_to_many -> many_to_many verified
|
|
34
|
-
// {'state->vendor': 'one_to_many', 'vendor->country': 'many_to_one'}
|
|
35
|
-
// ['state', 'vendor'] -> one_to_many
|
|
36
|
-
// ['vendor', 'country'] -> many_to_one
|
|
37
|
-
var _a;
|
|
38
|
-
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.countryModel).filter((country) => !!country).reduce((accumulator, current) => {
|
|
39
|
-
if (!accumulator.some((country) => country.id === current.id)) {
|
|
40
|
-
accumulator.push(current);
|
|
41
|
-
}
|
|
42
|
-
return accumulator;
|
|
43
|
-
}, []);
|
|
44
|
-
}
|
|
45
|
-
get vendorInvoices() {
|
|
46
|
-
// one_to_many -> one_to_many verified
|
|
47
|
-
// {'state->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many'}
|
|
48
|
-
// ['state', 'vendor'] -> one_to_many
|
|
49
|
-
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
50
|
-
var _a;
|
|
51
|
-
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.vendorInvoices).filter((vendorInvoice) => !!vendorInvoice).reduce((accumulator, current) => {
|
|
52
|
-
if (!accumulator.some((vendorInvoice) => vendorInvoice.id === current.id)) {
|
|
53
|
-
accumulator.push(current);
|
|
54
|
-
}
|
|
55
|
-
return accumulator;
|
|
56
|
-
}, []);
|
|
57
|
-
}
|
|
58
|
-
get officeLocations() {
|
|
59
|
-
// many_to_many -> many_to_many verified
|
|
60
|
-
// {'state->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->office_location': 'many_to_one'}
|
|
61
|
-
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
62
|
-
// ['vendor_invoice', 'office_location'] -> many_to_one
|
|
63
|
-
var _a;
|
|
64
|
-
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.officeLocation).filter((officeLocation) => !!officeLocation).reduce((accumulator, current) => {
|
|
65
|
-
if (!accumulator.some((officeLocation) => officeLocation.id === current.id)) {
|
|
66
|
-
accumulator.push(current);
|
|
67
|
-
}
|
|
68
|
-
return accumulator;
|
|
69
|
-
}, []);
|
|
70
|
-
}
|
|
71
|
-
get vendorInvoiceItems() {
|
|
72
|
-
// one_to_many -> one_to_many verified
|
|
73
|
-
// {'state->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many'}
|
|
74
|
-
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
75
|
-
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
76
|
-
var _a;
|
|
77
|
-
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoiceItems).filter((vendorInvoiceItem) => !!vendorInvoiceItem).reduce((accumulator, current) => {
|
|
78
|
-
if (!accumulator.some((vendorInvoiceItem) => vendorInvoiceItem.id === current.id)) {
|
|
79
|
-
accumulator.push(current);
|
|
80
|
-
}
|
|
81
|
-
return accumulator;
|
|
82
|
-
}, []);
|
|
83
|
-
}
|
|
84
|
-
get voucherTypes() {
|
|
85
|
-
// many_to_many -> many_to_many verified
|
|
86
|
-
// {'state->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one'}
|
|
87
|
-
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
88
|
-
// ['vendor_invoice_item', 'voucher_type'] -> many_to_one
|
|
89
|
-
var _a;
|
|
90
|
-
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.voucherType).filter((voucherType) => !!voucherType).reduce((accumulator, current) => {
|
|
91
|
-
if (!accumulator.some((voucherType) => voucherType.id === current.id)) {
|
|
92
|
-
accumulator.push(current);
|
|
93
|
-
}
|
|
94
|
-
return accumulator;
|
|
95
|
-
}, []);
|
|
96
|
-
}
|
|
97
|
-
get tdsRates() {
|
|
98
|
-
// many_to_many -> many_to_many verified
|
|
99
|
-
// {'state->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->tds_rate': 'many_to_one'}
|
|
100
|
-
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
101
|
-
// ['vendor_invoice_item', 'tds_rate'] -> many_to_one
|
|
102
|
-
var _a;
|
|
103
|
-
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.tdsRate).filter((tdsRate) => !!tdsRate).reduce((accumulator, current) => {
|
|
104
|
-
if (!accumulator.some((tdsRate) => tdsRate.id === current.id)) {
|
|
105
|
-
accumulator.push(current);
|
|
106
|
-
}
|
|
107
|
-
return accumulator;
|
|
108
|
-
}, []);
|
|
109
|
-
}
|
|
110
|
-
get organizationTypes() {
|
|
111
|
-
// many_to_many -> many_to_many verified
|
|
112
|
-
// {'state->vendor': 'one_to_many', 'vendor->organization_type': 'many_to_one'}
|
|
113
|
-
// ['state', 'vendor'] -> one_to_many
|
|
114
|
-
// ['vendor', 'organization_type'] -> many_to_one
|
|
115
|
-
var _a;
|
|
116
|
-
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.organizationType).filter((organizationType) => !!organizationType).reduce((accumulator, current) => {
|
|
117
|
-
if (!accumulator.some((organizationType) => organizationType.id === current.id)) {
|
|
118
|
-
accumulator.push(current);
|
|
119
|
-
}
|
|
120
|
-
return accumulator;
|
|
121
|
-
}, []);
|
|
122
|
-
}
|
|
123
|
-
get expenseHeads() {
|
|
124
|
-
// many_to_many -> many_to_many verified
|
|
125
|
-
// {'state->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->expense_head': 'many_to_one'}
|
|
126
|
-
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
127
|
-
// ['vendor_invoice_item', 'expense_head'] -> many_to_one
|
|
128
|
-
var _a;
|
|
129
|
-
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.expenseHead).filter((expenseHead) => !!expenseHead).reduce((accumulator, current) => {
|
|
130
|
-
if (!accumulator.some((expenseHead) => expenseHead.id === current.id)) {
|
|
131
|
-
accumulator.push(current);
|
|
132
|
-
}
|
|
133
|
-
return accumulator;
|
|
134
|
-
}, []);
|
|
135
|
-
}
|
|
136
|
-
get gstRates() {
|
|
137
|
-
// many_to_many -> many_to_many verified
|
|
138
|
-
// {'state->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->gst_rate': 'many_to_one'}
|
|
139
|
-
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
140
|
-
// ['vendor_invoice_item', 'gst_rate'] -> many_to_one
|
|
141
|
-
var _a;
|
|
142
|
-
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.gstRate).filter((gstRate) => !!gstRate).reduce((accumulator, current) => {
|
|
143
|
-
if (!accumulator.some((gstRate) => gstRate.id === current.id)) {
|
|
144
|
-
accumulator.push(current);
|
|
145
|
-
}
|
|
146
|
-
return accumulator;
|
|
147
|
-
}, []);
|
|
148
|
-
}
|
|
149
|
-
getNextStatus(currentUser, action, stateFlowConfigContextData) {
|
|
150
|
-
if (!this.status) {
|
|
151
|
-
throw new exceptions_1.AppBadRequestException({
|
|
152
|
-
key: error_key_enum_1.ErrorKeyEnum.STATUS,
|
|
153
|
-
message: [`Status not found: ${this.status}`],
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
const flowForStatus = state_flow_config_1.stateFlowConfig[this.status];
|
|
157
|
-
if (!flowForStatus) {
|
|
158
|
-
throw new exceptions_1.AppBadRequestException({
|
|
159
|
-
key: error_key_enum_1.ErrorKeyEnum.STATUS,
|
|
160
|
-
message: [`No flow configuration found for status: ${this.status}`],
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
if (!action) {
|
|
164
|
-
throw new exceptions_1.AppBadRequestException({
|
|
165
|
-
key: error_key_enum_1.ErrorKeyEnum.ACTION_DATA,
|
|
166
|
-
message: ["actionData is required"],
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
const matchingPermissionConfig = flowForStatus.actions[action];
|
|
170
|
-
if (!matchingPermissionConfig) {
|
|
171
|
-
throw new exceptions_1.AppBadRequestException({
|
|
172
|
-
key: error_key_enum_1.ErrorKeyEnum.ACTION,
|
|
173
|
-
message: [`Action '${action}' is not valid for the current status.`],
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
if (!currentUser.permissions || currentUser.permissions.length === 0) {
|
|
177
|
-
throw new exceptions_1.AppBadRequestException({
|
|
178
|
-
key: error_key_enum_1.ErrorKeyEnum.PERMISSIONS,
|
|
179
|
-
message: ["Permission not available for currentUser"],
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
const hasPermission = matchingPermissionConfig.permissions.some((permission) => currentUser.permissions.includes(permission));
|
|
183
|
-
if (!hasPermission) {
|
|
184
|
-
throw new exceptions_1.AppBadRequestException({
|
|
185
|
-
key: error_key_enum_1.ErrorKeyEnum.PERMISSION,
|
|
186
|
-
message: [`Current user does not have permission to ${action} state`],
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
const nextStatus = matchingPermissionConfig.next(stateFlowConfigContextData);
|
|
190
|
-
return nextStatus;
|
|
191
|
-
}
|
|
192
|
-
// .getAvailableActions(this.currentUserModel, {
|
|
193
|
-
// combinedActions: {
|
|
194
|
-
// approveOrReject: {
|
|
195
|
-
// combineActions: [VendorActionEnum.APPROVE, VendorActionEnum.REJECT],
|
|
196
|
-
// label: "Approve or Reject",
|
|
197
|
-
// },
|
|
198
|
-
// },
|
|
199
|
-
// customLabels: {
|
|
200
|
-
// [VendorActionEnum.APPROVE]: "Approve",
|
|
201
|
-
// [VendorActionEnum.REJECT]: "Reject",
|
|
202
|
-
// },
|
|
203
|
-
// })
|
|
204
|
-
getAvailableActions(currentUser, config) {
|
|
205
|
-
var _a;
|
|
206
|
-
const params = {
|
|
207
|
-
flowConfig: state_flow_config_1.stateFlowConfig,
|
|
208
|
-
currentStatus: this.status,
|
|
209
|
-
userPermissions: (_a = currentUser.permissions) !== null && _a !== void 0 ? _a : [],
|
|
210
|
-
visibilityData: this.getUpdateActionVisibility.bind(this, currentUser),
|
|
211
|
-
combinedActions: config === null || config === void 0 ? void 0 : config.combinedActions,
|
|
212
|
-
customLabels: config === null || config === void 0 ? void 0 : config.customLabels,
|
|
213
|
-
};
|
|
214
|
-
return utils_1.EntityActionFlowResolverV2.getAvailableActionsData(params);
|
|
215
|
-
}
|
|
216
|
-
getUpdateActionVisibility(currentUser) {
|
|
217
|
-
return {};
|
|
218
|
-
}
|
|
219
27
|
}
|
|
220
28
|
exports.StateEntityModel = StateEntityModel;
|
|
221
|
-
StateEntityModel.relationConfigs = [
|
|
222
|
-
{
|
|
223
|
-
name: entity_utils_interface_1.EntityEnum.VENDOR,
|
|
224
|
-
relation: relation_type_enum_1.RelationType.MANY,
|
|
225
|
-
key: "vendors",
|
|
226
|
-
mapKeyConfig: {
|
|
227
|
-
relationKey: "state",
|
|
228
|
-
key: "name",
|
|
229
|
-
},
|
|
230
|
-
},
|
|
231
|
-
];
|
|
29
|
+
StateEntityModel.relationConfigs = [];
|
package/package.json
CHANGED
|
File without changes
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import { DeepPartialButRequired } from "./api.utils.interface";
|
|
3
|
-
// import { IDeleteDocumentDetails } from "../../misc";
|
|
4
|
-
// import { EntityEnum, EnumEntityType } from "../../entities";
|
|
5
|
-
// import { IStateCreateDto } from "./state.create.dto.interface";
|
|
6
|
-
// export type IStateUpdateDto = DeepPartialButRequired<IStateCreateDto, never> & { actionData: IStateActionDataDto };
|
|
7
|
-
// export interface IStateActionDataDto {
|
|
8
|
-
// action: StateActionEnum;
|
|
9
|
-
// remark?: string;
|
|
10
|
-
// }
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { StateActionEnum } from "../../api";
|
|
2
|
-
import { StateStatusEnum } from "../enums/state_status_enum";
|
|
3
|
-
import { FlowConfig } from "./flow-config.type";
|
|
4
|
-
export interface IStateFlowConfigContextData {
|
|
5
|
-
}
|
|
6
|
-
export declare const stateFlowConfig: FlowConfig<StateStatusEnum, StateActionEnum, IStateFlowConfigContextData>;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stateFlowConfig = void 0;
|
|
4
|
-
const api_1 = require("../../api");
|
|
5
|
-
const state_status_enum_1 = require("../enums/state_status_enum");
|
|
6
|
-
/**
|
|
7
|
-
* State Flow Configuration - Status transition rules for state master.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* // Simple transition (fixed target status)
|
|
11
|
-
* createActionConfig(StateStatusEnum.INACTIVE, StateActionEnum.DELETE)
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* // Function-based transition (choose one of possible statuses via context data)
|
|
15
|
-
* // Note: this example uses an extended context shape for illustration.
|
|
16
|
-
* type IExtendedContext = IStateFlowConfigContextData & { nextStatus?: StateStatusEnum };
|
|
17
|
-
* const transitionWithContext = (context: IExtendedContext) =>
|
|
18
|
-
* context.nextStatus === StateStatusEnum.DEACTIVE ? StateStatusEnum.DEACTIVE : StateStatusEnum.ACTIVE;
|
|
19
|
-
* createActionConfig(transitionWithContext, StateActionEnum.EDIT)
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* // Subset transition — restricts the valid next statuses for a specific (currentStatus, action) pair.
|
|
23
|
-
* //
|
|
24
|
-
* // StateActionStatusMap says EDIT can go to: ACTIVE | DEACTIVE | INACTIVE (globally).
|
|
25
|
-
* // But from ACTIVE status, EDIT should only allow ACTIVE or DEACTIVE (not INACTIVE).
|
|
26
|
-
* // The Subset type parameter enforces this narrowing at compile time.
|
|
27
|
-
* //
|
|
28
|
-
* // TypeScript will reject any value outside the declared Subset:
|
|
29
|
-
* // createActionConfig<StateActionEnum.EDIT, StateStatusEnum.ACTIVE | StateStatusEnum.DEACTIVE>(
|
|
30
|
-
* // StateStatusEnum.INACTIVE, // ❌ compile error — INACTIVE not in Subset
|
|
31
|
-
* // StateActionEnum.EDIT
|
|
32
|
-
* // )
|
|
33
|
-
* //
|
|
34
|
-
* // Correct usage with a fixed subset value:
|
|
35
|
-
* createActionConfig<StateActionEnum.EDIT, StateStatusEnum.ACTIVE | StateStatusEnum.DEACTIVE>(
|
|
36
|
-
* StateStatusEnum.ACTIVE,
|
|
37
|
-
* StateActionEnum.EDIT
|
|
38
|
-
* )
|
|
39
|
-
* //
|
|
40
|
-
* // Correct usage with a context-driven subset function:
|
|
41
|
-
* type IExtendedContext2 = IStateFlowConfigContextData & { deactivate?: boolean };
|
|
42
|
-
* createActionConfig<StateActionEnum.EDIT, StateStatusEnum.ACTIVE | StateStatusEnum.DEACTIVE>(
|
|
43
|
-
* (context: IExtendedContext2) =>
|
|
44
|
-
* context.deactivate ? StateStatusEnum.DEACTIVE : StateStatusEnum.ACTIVE,
|
|
45
|
-
* StateActionEnum.EDIT
|
|
46
|
-
* )
|
|
47
|
-
*/
|
|
48
|
-
const STATE_CREATE_PERMISSION = ["STATE_CREATE"];
|
|
49
|
-
const STATE_UPDATE_PERMISSION = ["STATE_UPDATE"];
|
|
50
|
-
const STATE_DELETE_PERMISSION = ["STATE_DELETE"];
|
|
51
|
-
const STATE_VIEW_PERMISSION = ["STATE_VIEW"];
|
|
52
|
-
const createTransition = (transition) => (context) => {
|
|
53
|
-
if (typeof transition === "function") {
|
|
54
|
-
return transition(context);
|
|
55
|
-
}
|
|
56
|
-
return transition;
|
|
57
|
-
};
|
|
58
|
-
const actionPermissionMap = {
|
|
59
|
-
[api_1.StateActionEnum.CREATE]: STATE_CREATE_PERMISSION,
|
|
60
|
-
[api_1.StateActionEnum.EDIT]: STATE_UPDATE_PERMISSION,
|
|
61
|
-
[api_1.StateActionEnum.DELETE]: STATE_DELETE_PERMISSION,
|
|
62
|
-
[api_1.StateActionEnum.VIEW]: STATE_VIEW_PERMISSION,
|
|
63
|
-
};
|
|
64
|
-
const createActionConfig = (nextStatus, action, overridePermissions) => ({
|
|
65
|
-
permissions: overridePermissions !== null && overridePermissions !== void 0 ? overridePermissions : actionPermissionMap[action],
|
|
66
|
-
next: createTransition(nextStatus),
|
|
67
|
-
});
|
|
68
|
-
const transitionActiveStatusEditAction = (context) => state_status_enum_1.StateStatusEnum.DEACTIVE;
|
|
69
|
-
exports.stateFlowConfig = {
|
|
70
|
-
[state_status_enum_1.StateStatusEnum.ACTIVE]: {
|
|
71
|
-
actions: {
|
|
72
|
-
[api_1.StateActionEnum.VIEW]: createActionConfig(state_status_enum_1.StateStatusEnum.ACTIVE, api_1.StateActionEnum.VIEW),
|
|
73
|
-
[api_1.StateActionEnum.EDIT]: createActionConfig(transitionActiveStatusEditAction, api_1.StateActionEnum.EDIT),
|
|
74
|
-
[api_1.StateActionEnum.DELETE]: createActionConfig(state_status_enum_1.StateStatusEnum.INACTIVE, api_1.StateActionEnum.DELETE),
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
[state_status_enum_1.StateStatusEnum.DEACTIVE]: {
|
|
78
|
-
actions: {
|
|
79
|
-
[api_1.StateActionEnum.VIEW]: createActionConfig(state_status_enum_1.StateStatusEnum.DEACTIVE, api_1.StateActionEnum.VIEW),
|
|
80
|
-
[api_1.StateActionEnum.EDIT]: createActionConfig(state_status_enum_1.StateStatusEnum.ACTIVE, api_1.StateActionEnum.EDIT),
|
|
81
|
-
[api_1.StateActionEnum.DELETE]: createActionConfig(state_status_enum_1.StateStatusEnum.INACTIVE, api_1.StateActionEnum.DELETE),
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
[state_status_enum_1.StateStatusEnum.INACTIVE]: {
|
|
85
|
-
actions: {
|
|
86
|
-
[api_1.StateActionEnum.VIEW]: createActionConfig(state_status_enum_1.StateStatusEnum.INACTIVE, api_1.StateActionEnum.VIEW),
|
|
87
|
-
[api_1.StateActionEnum.CREATE]: createActionConfig(state_status_enum_1.StateStatusEnum.ACTIVE, api_1.StateActionEnum.CREATE),
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
};
|