law-common 14.0.3-beta.8 → 14.0.4
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/README.md +1 -1
- package/dist/src/api/index.d.ts +4 -2
- package/dist/src/api/index.js +4 -28
- package/dist/src/api/{v1/interface → interface}/expense_type.create.dto.interface.d.ts +1 -1
- package/dist/src/api/{v1/interface → interface}/expense_type.update.dto.interface.d.ts +1 -1
- package/dist/src/api/interface/reimbursement.entity.response.d.ts +1 -9
- package/dist/src/api/{v1/interface → interface}/to_do_list.create.dto.interface.d.ts +1 -1
- package/dist/src/api/{v1/interface → interface}/to_do_list.update.dto.interface.d.ts +1 -1
- package/dist/src/entities/flow-configs/expense_type_flow.config.d.ts +1 -1
- package/dist/src/entities/flow-configs/expense_type_flow.config.js +21 -21
- package/dist/src/entities/flow-configs/flow-config.type.d.ts +0 -14
- package/dist/src/entities/flow-configs/reimbursement_expense_flow.config.js +2 -2
- package/dist/src/entities/flow-configs/reimbursement_flow.config.d.ts +1 -9
- package/dist/src/entities/flow-configs/reimbursement_flow.config.js +3 -13
- package/dist/src/entities/index.d.ts +1 -1
- package/dist/src/entities/index.js +1 -1
- package/dist/src/entities/interface/expense_type.entity.interface.d.ts +1 -1
- package/dist/src/entities/interface/field-constraint/expense_type_field_constraints.interface.d.ts +8 -0
- package/dist/src/entities/interface/field-constraint/to_do_list_field_constraints.interface.d.ts +7 -0
- package/dist/src/entities/interface/field-constraint/to_do_list_field_constraints.interface.js +16 -10
- package/dist/src/entities/interface/timesheet.entity.interface.d.ts +2 -1
- package/dist/src/entities/interface/to_do_list.entity.interface.d.ts +2 -2
- package/dist/src/entities/model/expense_type.entity.model.d.ts +7 -7
- package/dist/src/entities/model/expense_type.entity.model.js +6 -6
- package/dist/src/entities/model/timesheet.entity.model.d.ts +31 -2
- package/dist/src/entities/model/timesheet.entity.model.js +77 -30
- package/dist/src/entities/model/to_do_list.entity.model.d.ts +9 -63
- package/dist/src/entities/model/to_do_list.entity.model.js +11 -367
- package/dist/src/utils/date.util.d.ts +19 -0
- package/dist/src/utils/date.util.js +29 -0
- package/package.json +1 -1
- package/dist/src/api/v1/index.d.ts +0 -11
- package/dist/src/api/v1/index.js +0 -27
- package/dist/src/api/v2/index.d.ts +0 -13
- package/dist/src/api/v2/index.js +0 -31
- package/dist/src/api/v2/interface/expense_type.create.dto.interface.d.ts +0 -5
- package/dist/src/api/v2/interface/expense_type.create.dto.interface.js +0 -2
- package/dist/src/api/v2/interface/expense_type.update.dto.interface.d.ts +0 -12
- package/dist/src/api/v2/interface/expense_type.update.dto.interface.js +0 -2
- package/dist/src/api/v2/interface/to_do_list.create.dto.interface.d.ts +0 -5
- package/dist/src/api/v2/interface/to_do_list.create.dto.interface.js +0 -2
- package/dist/src/api/v2/interface/to_do_list.update.dto.interface.d.ts +0 -12
- package/dist/src/api/v2/interface/to_do_list.update.dto.interface.js +0 -2
- /package/dist/src/api/{v1/interface → interface}/expense_type.create.dto.interface.js +0 -0
- /package/dist/src/api/{v1/interface → interface}/expense_type.update.dto.interface.js +0 -0
- /package/dist/src/api/{v1/interface → interface}/to_do_list.create.dto.interface.js +0 -0
- /package/dist/src/api/{v1/interface → interface}/to_do_list.update.dto.interface.js +0 -0
- /package/dist/src/entities/enums/{expense_type_enum.d.ts → expense_type_entity_enum.d.ts} +0 -0
- /package/dist/src/entities/enums/{expense_type_enum.js → expense_type_entity_enum.js} +0 -0
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# law-common
|
|
1
|
+
# law-common
|
package/dist/src/api/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export * from "./interface/reimbursement_expense.update.dto.interface";
|
|
|
20
20
|
export * from "./interface/billing_reimbursement_expense.create.dto.interface";
|
|
21
21
|
export * from "./interface/billing_reimbursement_expense.filter.dto.interface";
|
|
22
22
|
export * from "./interface/billing_reimbursement_expense.update.dto.interface";
|
|
23
|
+
export * from "./interface/expense_type.create.dto.interface";
|
|
24
|
+
export * from "./interface/expense_type.update.dto.interface";
|
|
23
25
|
export * from "./interface/expense_type.entity.response";
|
|
24
26
|
export * from "./interface/billing.create.dto.interface";
|
|
25
27
|
export * from "./interface/billing_particular_line_item.create.dto.interface";
|
|
@@ -78,7 +80,9 @@ export * from "./interface/leave.create.dto.interface";
|
|
|
78
80
|
export * from "./interface/leave.update.dto.interface";
|
|
79
81
|
export * from "./interface/cron_jobs.entity.response";
|
|
80
82
|
export * from "./interface/cron_jobs_manual_trigger.dto.interface";
|
|
83
|
+
export * from "./interface/to_do_list.create.dto.interface";
|
|
81
84
|
export * from "./interface/to_do_list.filter.dto.interface";
|
|
85
|
+
export * from "./interface/to_do_list.update.dto.interface";
|
|
82
86
|
export * from "./interface/project_user_mapping.create.dto.interface";
|
|
83
87
|
export * from "./interface/project_user_mapping.filter.dto.interface";
|
|
84
88
|
export * from "./interface/project_user_mapping.update.dto.interface";
|
|
@@ -173,5 +177,3 @@ export * from "./interface/bank.filter.dto.interface";
|
|
|
173
177
|
export * from "./interface/intermediary_bank.create.dto.interface";
|
|
174
178
|
export * from "./interface/intermediary_bank.filter.dto.interface";
|
|
175
179
|
export * from "./interface/intermediary_bank.update.dto.interface";
|
|
176
|
-
export * as v1 from "./v1";
|
|
177
|
-
export * as v2 from "./v2";
|
package/dist/src/api/index.js
CHANGED
|
@@ -10,33 +10,10 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
15
|
};
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.v2 = exports.v1 = void 0;
|
|
40
17
|
__exportStar(require("./interface/base.response.interface"), exports);
|
|
41
18
|
__exportStar(require("./interface/jwt.payload.interface"), exports);
|
|
42
19
|
__exportStar(require("./interface/login.response.interface"), exports);
|
|
@@ -59,6 +36,8 @@ __exportStar(require("./interface/reimbursement_expense.update.dto.interface"),
|
|
|
59
36
|
__exportStar(require("./interface/billing_reimbursement_expense.create.dto.interface"), exports);
|
|
60
37
|
__exportStar(require("./interface/billing_reimbursement_expense.filter.dto.interface"), exports);
|
|
61
38
|
__exportStar(require("./interface/billing_reimbursement_expense.update.dto.interface"), exports);
|
|
39
|
+
__exportStar(require("./interface/expense_type.create.dto.interface"), exports);
|
|
40
|
+
__exportStar(require("./interface/expense_type.update.dto.interface"), exports);
|
|
62
41
|
__exportStar(require("./interface/expense_type.entity.response"), exports);
|
|
63
42
|
__exportStar(require("./interface/billing.create.dto.interface"), exports);
|
|
64
43
|
__exportStar(require("./interface/billing_particular_line_item.create.dto.interface"), exports);
|
|
@@ -117,7 +96,9 @@ __exportStar(require("./interface/leave.create.dto.interface"), exports);
|
|
|
117
96
|
__exportStar(require("./interface/leave.update.dto.interface"), exports);
|
|
118
97
|
__exportStar(require("./interface/cron_jobs.entity.response"), exports);
|
|
119
98
|
__exportStar(require("./interface/cron_jobs_manual_trigger.dto.interface"), exports);
|
|
99
|
+
__exportStar(require("./interface/to_do_list.create.dto.interface"), exports);
|
|
120
100
|
__exportStar(require("./interface/to_do_list.filter.dto.interface"), exports);
|
|
101
|
+
__exportStar(require("./interface/to_do_list.update.dto.interface"), exports);
|
|
121
102
|
// export * from "./interface/billing-reimbursement-expense.api";
|
|
122
103
|
// export * from "./interface/billing-reimbursement-expense-history.api";
|
|
123
104
|
__exportStar(require("./interface/project_user_mapping.create.dto.interface"), exports);
|
|
@@ -214,8 +195,3 @@ __exportStar(require("./interface/bank.filter.dto.interface"), exports);
|
|
|
214
195
|
__exportStar(require("./interface/intermediary_bank.create.dto.interface"), exports);
|
|
215
196
|
__exportStar(require("./interface/intermediary_bank.filter.dto.interface"), exports);
|
|
216
197
|
__exportStar(require("./interface/intermediary_bank.update.dto.interface"), exports);
|
|
217
|
-
// Versioned contracts (checklist 12.4). Namespace re-exports only - never `export *` flat from
|
|
218
|
-
// v1 or v2: flat-exporting both is a duplicate-export error, and flat-exporting one reintroduces
|
|
219
|
-
// the ambiguity the fork exists to remove.
|
|
220
|
-
exports.v1 = __importStar(require("./v1"));
|
|
221
|
-
exports.v2 = __importStar(require("./v2"));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IReimbursementEntity, IReimbursementExpenseEntity, IUserEntity
|
|
1
|
+
import { IReimbursementEntity, IReimbursementExpenseEntity, IUserEntity } from "../../entities";
|
|
2
2
|
import { IProjectEntityGet } from "./project.entity.response";
|
|
3
3
|
export type IReimbursementEntityGet = {
|
|
4
4
|
reimbursements: IReimbursementResponse[];
|
|
@@ -7,14 +7,6 @@ export type IReimbursementEntityGet = {
|
|
|
7
7
|
};
|
|
8
8
|
projects: IProjectEntityGet;
|
|
9
9
|
};
|
|
10
|
-
/**
|
|
11
|
-
* LW-828: this used to re-declare the parent/child flow-config shape by hand. It is now an alias of the
|
|
12
|
-
* shared `ParentChildFlowConfig`, instantiated with `IReimbursementFlowContextData` for the parent and
|
|
13
|
-
* `void` for the child — the child's `next` is called with no argument in
|
|
14
|
-
* `ReimbursementExpenseService.getReimbursementNextStatusForChild`. Kept as a named type so every
|
|
15
|
-
* existing consumer keeps compiling unchanged.
|
|
16
|
-
*/
|
|
17
|
-
export type IReimbursementFlowConfig = ParentChildFlowConfig<ReimbursementStatusEnum, ReimbursementActionEnum, ReimbursementExpenseState, ReimbursementExpenseActionEnum, IReimbursementFlowContextData, void>;
|
|
18
10
|
export type IReimbursementFlowContextData = {
|
|
19
11
|
expenseDetails: IReimbursementExpenseEntity[];
|
|
20
12
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IEntityCreateDto, IToDoListEntity } from "
|
|
1
|
+
import { IEntityCreateDto, IToDoListEntity } from "../../entities";
|
|
2
2
|
/** status is set by the entity flow, never by the client */
|
|
3
3
|
export type IToDoListCreateExclude = "status";
|
|
4
4
|
export interface IToDoListCreateDto extends Omit<IEntityCreateDto<IToDoListEntity>, IToDoListCreateExclude> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IEntityUpdateDto, IToDoListEntity } from "
|
|
1
|
+
import { IEntityUpdateDto, IToDoListEntity } from "../../entities";
|
|
2
2
|
import { IToDoListCreateExclude } from "./to_do_list.create.dto.interface";
|
|
3
3
|
export interface IToDoListUpdateDto extends Omit<IEntityUpdateDto<IToDoListEntity>, IToDoListCreateExclude> {
|
|
4
4
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FlowConfig } from "./flow-config.type";
|
|
2
|
-
import { ExpenseTypeActionEnum } from "
|
|
2
|
+
import { ExpenseTypeActionEnum } from "../enums/expense_type_action_enum";
|
|
3
3
|
import { ExpenseTypeStatusEnum } from "../enums/expense_type_status_enum";
|
|
4
4
|
export interface IExpenseTypeFlowConfigContextData {
|
|
5
5
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.expenseTypeFlowConfig = void 0;
|
|
4
4
|
const base_flow_config_factory_1 = require("./base-flow-config.factory");
|
|
5
|
-
const
|
|
5
|
+
const expense_type_action_enum_1 = require("../enums/expense_type_action_enum");
|
|
6
6
|
const expense_type_status_enum_1 = require("../enums/expense_type_status_enum");
|
|
7
7
|
const EXPENSE_TYPE_CREATE_PERMISSION = ["EXPENSE_TYPE_CREATE"];
|
|
8
8
|
const EXPENSE_TYPE_UPDATE_PERMISSION = ["EXPENSE_TYPE_UPDATE"];
|
|
@@ -11,60 +11,60 @@ const EXPENSE_TYPE_DEACTIVATE_PERMISSION = ["EXPENSE_TYPE_DEACTIVATE"];
|
|
|
11
11
|
const EXPENSE_TYPE_ACTIVATE_PERMISSION = ["EXPENSE_TYPE_ACTIVATE"];
|
|
12
12
|
const EXPENSE_TYPE_RESTORE_PERMISSION = ["EXPENSE_TYPE_RESTORE"];
|
|
13
13
|
const ACTION_MAP = {
|
|
14
|
-
[
|
|
14
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.CREATE]: {
|
|
15
15
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED],
|
|
16
16
|
permissions: EXPENSE_TYPE_CREATE_PERMISSION,
|
|
17
17
|
},
|
|
18
|
-
[
|
|
18
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.UPDATE]: {
|
|
19
19
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED],
|
|
20
20
|
permissions: EXPENSE_TYPE_UPDATE_PERMISSION,
|
|
21
21
|
},
|
|
22
|
-
[
|
|
22
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.DELETE]: {
|
|
23
23
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.DELETED],
|
|
24
24
|
permissions: EXPENSE_TYPE_DELETE_PERMISSION,
|
|
25
25
|
},
|
|
26
|
-
[
|
|
26
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.DEACTIVATE]: {
|
|
27
27
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.DEACTIVATED],
|
|
28
28
|
permissions: EXPENSE_TYPE_DEACTIVATE_PERMISSION,
|
|
29
29
|
},
|
|
30
|
-
[
|
|
30
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.ACTIVATE]: {
|
|
31
31
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED],
|
|
32
32
|
permissions: EXPENSE_TYPE_ACTIVATE_PERMISSION,
|
|
33
33
|
},
|
|
34
|
-
[
|
|
34
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.RESTORE]: {
|
|
35
35
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED],
|
|
36
36
|
permissions: EXPENSE_TYPE_RESTORE_PERMISSION,
|
|
37
37
|
},
|
|
38
38
|
};
|
|
39
39
|
const { createActionConfig } = (0, base_flow_config_factory_1.createFlowConfigFactory)()(ACTION_MAP);
|
|
40
40
|
// APPROVED status transitions
|
|
41
|
-
const transitionApprovedStatusUpdateAction = createActionConfig(
|
|
42
|
-
const transitionApprovedStatusDeleteAction = createActionConfig(
|
|
43
|
-
const transitionApprovedStatusDeactivateAction = createActionConfig(
|
|
41
|
+
const transitionApprovedStatusUpdateAction = createActionConfig(expense_type_action_enum_1.ExpenseTypeActionEnum.UPDATE, expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED);
|
|
42
|
+
const transitionApprovedStatusDeleteAction = createActionConfig(expense_type_action_enum_1.ExpenseTypeActionEnum.DELETE, expense_type_status_enum_1.ExpenseTypeStatusEnum.DELETED);
|
|
43
|
+
const transitionApprovedStatusDeactivateAction = createActionConfig(expense_type_action_enum_1.ExpenseTypeActionEnum.DEACTIVATE, expense_type_status_enum_1.ExpenseTypeStatusEnum.DEACTIVATED);
|
|
44
44
|
// DEACTIVATED status transitions
|
|
45
|
-
const transitionDeactivatedStatusDeleteAction = createActionConfig(
|
|
46
|
-
const transitionDeactivatedStatusActivateAction = createActionConfig(
|
|
45
|
+
const transitionDeactivatedStatusDeleteAction = createActionConfig(expense_type_action_enum_1.ExpenseTypeActionEnum.DELETE, expense_type_status_enum_1.ExpenseTypeStatusEnum.DELETED);
|
|
46
|
+
const transitionDeactivatedStatusActivateAction = createActionConfig(expense_type_action_enum_1.ExpenseTypeActionEnum.ACTIVATE, expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED);
|
|
47
47
|
// DELETED status transitions
|
|
48
|
-
const transitionDeletedStatusUpdateAction = createActionConfig(
|
|
49
|
-
const transitionDeletedStatusRestoreAction = createActionConfig(
|
|
48
|
+
const transitionDeletedStatusUpdateAction = createActionConfig(expense_type_action_enum_1.ExpenseTypeActionEnum.UPDATE, expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED);
|
|
49
|
+
const transitionDeletedStatusRestoreAction = createActionConfig(expense_type_action_enum_1.ExpenseTypeActionEnum.RESTORE, expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED);
|
|
50
50
|
exports.expenseTypeFlowConfig = {
|
|
51
51
|
[expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED]: {
|
|
52
52
|
actions: {
|
|
53
|
-
[
|
|
54
|
-
[
|
|
55
|
-
[
|
|
53
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.UPDATE]: transitionApprovedStatusUpdateAction,
|
|
54
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.DELETE]: transitionApprovedStatusDeleteAction,
|
|
55
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.DEACTIVATE]: transitionApprovedStatusDeactivateAction,
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
[expense_type_status_enum_1.ExpenseTypeStatusEnum.DEACTIVATED]: {
|
|
59
59
|
actions: {
|
|
60
|
-
[
|
|
61
|
-
[
|
|
60
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.DELETE]: transitionDeactivatedStatusDeleteAction,
|
|
61
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.ACTIVATE]: transitionDeactivatedStatusActivateAction,
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
64
|
[expense_type_status_enum_1.ExpenseTypeStatusEnum.DELETED]: {
|
|
65
65
|
actions: {
|
|
66
|
-
[
|
|
67
|
-
[
|
|
66
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.UPDATE]: transitionDeletedStatusUpdateAction,
|
|
67
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.RESTORE]: transitionDeletedStatusRestoreAction,
|
|
68
68
|
},
|
|
69
69
|
},
|
|
70
70
|
};
|
|
@@ -70,17 +70,3 @@ export interface IFlowConfigActionConfig<STATUS_ENUM_TYPE extends string, CONTEX
|
|
|
70
70
|
*/
|
|
71
71
|
isApplicable?: (data: CONTEXT_DATA_TYPE) => boolean;
|
|
72
72
|
}
|
|
73
|
-
/**
|
|
74
|
-
* A flow whose parent and child rows each have their own status/action vocabulary.
|
|
75
|
-
*
|
|
76
|
-
* @template T context data passed to the parent's `next()`
|
|
77
|
-
* @template CT context data passed to the child's `next()`. Defaults to `T` for flows where both
|
|
78
|
-
* levels resolve from the same context. Reimbursement is the case that needs them to
|
|
79
|
-
* differ: its parent derives the reimbursement status from the child rows, while its
|
|
80
|
-
* child transitions are all fixed and its `next()` is called with no argument at all —
|
|
81
|
-
* so the child is instantiated with `void`.
|
|
82
|
-
*/
|
|
83
|
-
export type ParentChildFlowConfig<S extends string, A extends string, CS extends string = never, CA extends string = never, T extends Record<any, any> = never, CT = T> = {
|
|
84
|
-
parent: FlowConfig<S, A, T>;
|
|
85
|
-
child: FlowConfig<CS, CA, CT>;
|
|
86
|
-
};
|
|
@@ -8,8 +8,8 @@ const base_flow_config_factory_1 = require("./base-flow-config.factory");
|
|
|
8
8
|
* Reimbursement Expense — the child level of the reimbursement flow.
|
|
9
9
|
*
|
|
10
10
|
* Split out of `reimbursement_flow.config.ts` so each level can be read on its own: this file owns the
|
|
11
|
-
* expense-row state machine, and the parent file owns the reimbursement status derivation
|
|
12
|
-
*
|
|
11
|
+
* expense-row state machine, and the parent file owns the reimbursement status derivation. The two are
|
|
12
|
+
* standalone `FlowConfig`s; each consumer imports the level it uses directly.
|
|
13
13
|
*
|
|
14
14
|
* Every transition here is a fixed target, and `ReimbursementExpenseService.getReimbursementNextStatusForChild`
|
|
15
15
|
* calls `next()` with no argument, so the factory is instantiated with `void` — a `void` parameter may be
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import { IReimbursementFlowContextData } from "../../api";
|
|
2
2
|
import { ReimbursementActionEnum } from "../enums/reimbursement_action_enum";
|
|
3
|
-
import { ReimbursementExpenseActionEnum } from "../enums/reimbursement_expense_action_enum";
|
|
4
|
-
import { ReimbursementExpenseState } from "../enums/reimbursement_expense_state_enum";
|
|
5
3
|
import { ReimbursementStatusEnum } from "../enums/reimbursement_status_enum";
|
|
6
|
-
import { FlowConfig
|
|
4
|
+
import { FlowConfig } from "./flow-config.type";
|
|
7
5
|
/**
|
|
8
6
|
* REJECTED, DELETED and PAYMENT_DISBURSE are reachable targets but have no block of their own — a
|
|
9
7
|
* reimbursement that lands in any of them is final at the parent level.
|
|
10
8
|
*/
|
|
11
9
|
export declare const reimbursementFlowConfig: FlowConfig<ReimbursementStatusEnum, ReimbursementActionEnum, IReimbursementFlowContextData>;
|
|
12
|
-
/**
|
|
13
|
-
* The two levels composed into the shape the services consume — `ReimbursementService` reads
|
|
14
|
-
* `.parent` and `ReimbursementExpenseService` reads `.child`. Kept so splitting the files is invisible
|
|
15
|
-
* to every consumer; each level can now also be imported on its own.
|
|
16
|
-
*/
|
|
17
|
-
export declare const reimbursementConfigFlow: ParentChildFlowConfig<ReimbursementStatusEnum, ReimbursementActionEnum, ReimbursementExpenseState, ReimbursementExpenseActionEnum, IReimbursementFlowContextData, void>;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.reimbursementFlowConfig = void 0;
|
|
4
4
|
const reimbursement_action_enum_1 = require("../enums/reimbursement_action_enum");
|
|
5
5
|
const reimbursement_expense_state_enum_1 = require("../enums/reimbursement_expense_state_enum");
|
|
6
6
|
const reimbursement_status_enum_1 = require("../enums/reimbursement_status_enum");
|
|
7
7
|
const base_flow_config_factory_1 = require("./base-flow-config.factory");
|
|
8
|
-
const reimbursement_expense_flow_config_1 = require("./reimbursement_expense_flow.config");
|
|
9
8
|
/**
|
|
10
9
|
* Reimbursement — the parent level of the reimbursement flow.
|
|
11
10
|
*
|
|
12
|
-
* The child level lives in `reimbursement_expense_flow.config.ts`; the two are
|
|
13
|
-
*
|
|
11
|
+
* The child level lives in `reimbursement_expense_flow.config.ts`; the two are standalone
|
|
12
|
+
* `FlowConfig`s and each consumer imports the level it uses directly.
|
|
14
13
|
*
|
|
15
14
|
* The parent takes `IReimbursementFlowContextData` because its UPDATE derives the reimbursement status
|
|
16
15
|
* from the states of its expense rows — the helpers at the bottom of this file. The child takes `void`,
|
|
@@ -101,15 +100,6 @@ exports.reimbursementFlowConfig = {
|
|
|
101
100
|
},
|
|
102
101
|
},
|
|
103
102
|
};
|
|
104
|
-
/**
|
|
105
|
-
* The two levels composed into the shape the services consume — `ReimbursementService` reads
|
|
106
|
-
* `.parent` and `ReimbursementExpenseService` reads `.child`. Kept so splitting the files is invisible
|
|
107
|
-
* to every consumer; each level can now also be imported on its own.
|
|
108
|
-
*/
|
|
109
|
-
exports.reimbursementConfigFlow = {
|
|
110
|
-
parent: exports.reimbursementFlowConfig,
|
|
111
|
-
child: reimbursement_expense_flow_config_1.reimbursementExpenseFlowConfig,
|
|
112
|
-
};
|
|
113
103
|
function areAllRowApproved(data) {
|
|
114
104
|
const { expenseDetails } = data;
|
|
115
105
|
return expenseDetails.length > 0 ? expenseDetails.every((row) => row.state === reimbursement_expense_state_enum_1.ReimbursementExpenseState.APPROVED) : false;
|
|
@@ -47,7 +47,7 @@ export * from "./flow-configs/reimbursement_flow.config";
|
|
|
47
47
|
export * from "./flow-configs/reimbursement_expense_flow.config";
|
|
48
48
|
export * from "./interface/reimbursement.entity.interface";
|
|
49
49
|
export * from "./interface/field-constraint/reimbursement_field_constraints.interface";
|
|
50
|
-
export * from "./enums/
|
|
50
|
+
export * from "./enums/expense_type_entity_enum";
|
|
51
51
|
export * from "./enums/expense_type_action_enum";
|
|
52
52
|
export * from "./enums/expense_type_status_enum";
|
|
53
53
|
export * from "./flow-configs/expense_type_flow.config";
|
|
@@ -63,7 +63,7 @@ __exportStar(require("./flow-configs/reimbursement_flow.config"), exports);
|
|
|
63
63
|
__exportStar(require("./flow-configs/reimbursement_expense_flow.config"), exports);
|
|
64
64
|
__exportStar(require("./interface/reimbursement.entity.interface"), exports);
|
|
65
65
|
__exportStar(require("./interface/field-constraint/reimbursement_field_constraints.interface"), exports);
|
|
66
|
-
__exportStar(require("./enums/
|
|
66
|
+
__exportStar(require("./enums/expense_type_entity_enum"), exports);
|
|
67
67
|
__exportStar(require("./enums/expense_type_action_enum"), exports);
|
|
68
68
|
__exportStar(require("./enums/expense_type_status_enum"), exports);
|
|
69
69
|
__exportStar(require("./flow-configs/expense_type_flow.config"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExpenseTypeEnum } from "../enums/
|
|
1
|
+
import { ExpenseTypeEnum } from "../enums/expense_type_entity_enum";
|
|
2
2
|
import { ExpenseTypeStatusEnum } from "../enums/expense_type_status_enum";
|
|
3
3
|
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
4
4
|
export interface IExpenseTypeEntity extends IEntityAuditColumn {
|
package/dist/src/entities/interface/field-constraint/expense_type_field_constraints.interface.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { IEntityAuditColumn } from "../entity-audit-columns.interface";
|
|
2
2
|
import { IExpenseTypeEntity } from "../expense_type.entity.interface";
|
|
3
3
|
import { IFieldMinMaxConstraint } from "./utils";
|
|
4
|
+
/**
|
|
5
|
+
* excluded, and why:
|
|
6
|
+
* - "type", "status" enum columns, enums carry no min/max
|
|
7
|
+
* - "id", keyof IEntityAuditColumn generated columns
|
|
8
|
+
*
|
|
9
|
+
* this entity has a create DTO only — there is no ExpenseTypeUpdateDto, so no
|
|
10
|
+
* create/update disagreement is possible
|
|
11
|
+
*/
|
|
4
12
|
export type IExpenseTypeFieldLengthConstraintsExclude = "status" | "type" | "id" | keyof IEntityAuditColumn;
|
|
5
13
|
/**
|
|
6
14
|
* since some fields are optional, but we still need their
|
package/dist/src/entities/interface/field-constraint/to_do_list_field_constraints.interface.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { IEntityAuditColumn } from "../entity-audit-columns.interface";
|
|
2
2
|
import { IToDoListEntity } from "../to_do_list.entity.interface";
|
|
3
3
|
import { IFieldMinMaxConstraint } from "./utils";
|
|
4
|
+
/**
|
|
5
|
+
* excluded, and why:
|
|
6
|
+
* - "id", keyof IEntityAuditColumn generated columns
|
|
7
|
+
*
|
|
8
|
+
* ToDoListUpdateDto extends PartialType(OmitType(ToDoListCreateDto, ...)), so it inherits every
|
|
9
|
+
* create bound — create and update cannot disagree for this entity
|
|
10
|
+
*/
|
|
4
11
|
export type IToDoListFieldLengthConstraintsExclude = "status" | "id" | keyof IEntityAuditColumn;
|
|
5
12
|
/**
|
|
6
13
|
* since some fields are optional, but we still need their
|
package/dist/src/entities/interface/field-constraint/to_do_list_field_constraints.interface.js
CHANGED
|
@@ -2,24 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toDoListFieldMinMaxConstraints = void 0;
|
|
4
4
|
exports.toDoListFieldMinMaxConstraints = {
|
|
5
|
+
/**
|
|
6
|
+
* the DTO carries @MinLength(1) and no upper bound, so only the min is wired — the max here
|
|
7
|
+
* bounds the text column
|
|
8
|
+
*/
|
|
5
9
|
description: {
|
|
6
10
|
min: 1,
|
|
7
|
-
max:
|
|
11
|
+
max: 65535,
|
|
8
12
|
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
/**
|
|
14
|
+
* a YYMMDD datecode held as varchar(32) rather than an int — the format is enforced by
|
|
15
|
+
* DateCodeValidator, not by a length bound, so this max bounds the column only; the column type
|
|
16
|
+
* is step-4 material
|
|
17
|
+
*/
|
|
18
|
+
dateCode: {
|
|
19
|
+
max: 32,
|
|
12
20
|
},
|
|
13
|
-
|
|
14
|
-
|
|
21
|
+
/** minutes, and the DTO bounds this with @IsPositive() plus a multiple-of check, not @Min/@Max */
|
|
22
|
+
estimatedDuration: {
|
|
15
23
|
max: 9999999,
|
|
16
24
|
},
|
|
17
25
|
projectId: {
|
|
18
|
-
min: 0,
|
|
19
26
|
max: 9999999,
|
|
20
27
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
max: 99999999,
|
|
28
|
+
userId: {
|
|
29
|
+
max: 9999999,
|
|
24
30
|
},
|
|
25
31
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TimesheetClassificationStatusEnum } from "../enums/timesheet_classification_status_enum";
|
|
2
2
|
import { TimesheetStatusEnum } from "../enums/timesheet_status_enum";
|
|
3
3
|
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
4
|
+
import { Nullable } from "./entity.utils.interface";
|
|
4
5
|
export interface ITimesheetEntity extends IEntityAuditColumn {
|
|
5
6
|
id: number;
|
|
6
7
|
userId: number;
|
|
@@ -15,6 +16,6 @@ export interface ITimesheetEntity extends IEntityAuditColumn {
|
|
|
15
16
|
billedDuration?: number;
|
|
16
17
|
notBilledDuration?: number;
|
|
17
18
|
classificationStatus: TimesheetClassificationStatusEnum;
|
|
18
|
-
classifiedBy?: number
|
|
19
|
+
classifiedBy?: Nullable<number>;
|
|
19
20
|
}
|
|
20
21
|
export type PendingApprovalStatus = TimesheetStatusEnum.CREATE_APPROVAL_PENDING | TimesheetStatusEnum.UPDATE_APPROVAL_PENDING | TimesheetStatusEnum.DELETE_APPROVAL_PENDING | TimesheetStatusEnum.RESOLVED_REJECTED;
|
|
@@ -3,9 +3,9 @@ import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
|
3
3
|
export interface IToDoListEntity extends IEntityAuditColumn {
|
|
4
4
|
id: number;
|
|
5
5
|
description: string;
|
|
6
|
+
dateCode: string;
|
|
6
7
|
estimatedDuration: number;
|
|
7
|
-
userId: number;
|
|
8
8
|
projectId: number;
|
|
9
|
+
userId: number;
|
|
9
10
|
status: ToDoListStatusEnum;
|
|
10
|
-
date: number;
|
|
11
11
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ExpenseTypeActionEnum } from "../enums/expense_type_action_enum";
|
|
2
|
+
import { IExpenseTypeFlowConfigContextData } from "../flow-configs/expense_type_flow.config";
|
|
3
3
|
import { IUserEntity } from "../interface/user.entity.interface";
|
|
4
|
-
import { BaseEntityModel } from "./base.entity.model";
|
|
5
4
|
import { IRowActions } from "./interface/row-actions.interface";
|
|
6
5
|
import { UserEntityModel } from "./user.entity.model";
|
|
7
|
-
import {
|
|
8
|
-
import { ExpenseTypeEnum } from "../enums/expense_type_enum";
|
|
6
|
+
import { ExpenseTypeEnum } from "../enums/expense_type_entity_enum";
|
|
9
7
|
import { ExpenseTypeStatusEnum } from "../enums/expense_type_status_enum";
|
|
10
|
-
import {
|
|
8
|
+
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
11
9
|
import { IExpenseTypeEntity } from "../interface/expense_type.entity.interface";
|
|
10
|
+
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
11
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
12
12
|
export declare class ExpenseTypeEntityModel extends BaseEntityModel<EntityEnum.EXPENSE_TYPE> implements IExpenseTypeEntity {
|
|
13
13
|
id: number;
|
|
14
14
|
name: string;
|
|
@@ -21,7 +21,7 @@ export declare class ExpenseTypeEntityModel extends BaseEntityModel<EntityEnum.E
|
|
|
21
21
|
updatedBy: number;
|
|
22
22
|
static relationConfigs: RelationConfigs<[], EntityEnum.EXPENSE_TYPE>;
|
|
23
23
|
static fromEntity(entity: IExpenseTypeEntity): ExpenseTypeEntityModel;
|
|
24
|
-
getRelationConfigs():
|
|
24
|
+
getRelationConfigs(): [];
|
|
25
25
|
getNextStatus(currentUser: IUserEntity, action: ExpenseTypeActionEnum, expenseTypeFlowConfigContextData: IExpenseTypeFlowConfigContextData): ExpenseTypeStatusEnum;
|
|
26
26
|
getAvailableActions(currentUser: UserEntityModel, config?: {
|
|
27
27
|
combinedActions?: Record<string, {
|
|
@@ -4,17 +4,17 @@ exports.ExpenseTypeEntityModel = void 0;
|
|
|
4
4
|
const error_key_enum_1 = require("../../enums/error.key.enum");
|
|
5
5
|
const exceptions_1 = require("../../exceptions");
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
|
+
const expense_type_flow_config_1 = require("../flow-configs/expense_type_flow.config");
|
|
8
|
+
const expense_type_entity_enum_1 = require("../enums/expense_type_entity_enum");
|
|
9
|
+
const expense_type_status_enum_1 = require("../enums/expense_type_status_enum");
|
|
7
10
|
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
8
11
|
const base_entity_model_1 = require("./base.entity.model");
|
|
9
|
-
const expense_type_enum_1 = require("../enums/expense_type_enum");
|
|
10
|
-
const expense_type_status_enum_1 = require("../enums/expense_type_status_enum");
|
|
11
|
-
const expense_type_flow_config_1 = require("../flow-configs/expense_type_flow.config");
|
|
12
12
|
class ExpenseTypeEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
15
|
this.id = 0;
|
|
16
16
|
this.name = "";
|
|
17
|
-
this.type =
|
|
17
|
+
this.type = expense_type_entity_enum_1.ExpenseTypeEnum.BILLABLE;
|
|
18
18
|
this.status = expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED;
|
|
19
19
|
this.createdOn = 0;
|
|
20
20
|
this.updatedOn = 0;
|
|
@@ -27,7 +27,7 @@ class ExpenseTypeEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
27
27
|
return result;
|
|
28
28
|
}
|
|
29
29
|
getRelationConfigs() {
|
|
30
|
-
return
|
|
30
|
+
return ExpenseTypeEntityModel.relationConfigs;
|
|
31
31
|
}
|
|
32
32
|
getNextStatus(currentUser, action, expenseTypeFlowConfigContextData) {
|
|
33
33
|
if (!this.status) {
|
|
@@ -66,7 +66,7 @@ class ExpenseTypeEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
66
66
|
if (!hasPermission) {
|
|
67
67
|
throw new exceptions_1.AppBadRequestException({
|
|
68
68
|
key: error_key_enum_1.ErrorKeyEnum.PERMISSION,
|
|
69
|
-
message: [`Current user does not have permission to ${action}
|
|
69
|
+
message: [`Current user does not have permission to ${action} expense type`],
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
const nextStatus = matchingPermissionConfig.next(expenseTypeFlowConfigContextData);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ITimesheetFlowContextData, ITimesheetUpdateDto } from "../../api";
|
|
2
2
|
import { CurrencyEnum } from "../../enums";
|
|
3
3
|
import { IClassificationWindowConfig, ITimesheetActionItem, SortableTimesheet } from "../../model/entities/interface/timesheet.model.interface";
|
|
4
4
|
import { TimesheetClassificationStatusEnum } from "../enums/timesheet_classification_status_enum";
|
|
@@ -51,11 +51,33 @@ export declare class TimesheetEntityModel extends BaseEntityModel<EntityEnum.TIM
|
|
|
51
51
|
get latestStatusFromHistory(): TimesheetStatusEnum | undefined;
|
|
52
52
|
getDateCodeDay(): number;
|
|
53
53
|
getClassificationDeadline(config: IClassificationWindowConfig): Date;
|
|
54
|
+
/**
|
|
55
|
+
* IST point-in-time AUTO-CLASSIFY trigger. Returns the classification window
|
|
56
|
+
* whose `endDay + bufferDays + 1 == today` (IST) — i.e. it fires on a SINGLE day
|
|
57
|
+
* per window (the auto-classify cron runs at 01:00 IST each morning).
|
|
58
|
+
* Trailing window (endDay === null) evaluates against the PREVIOUS month's EOM.
|
|
59
|
+
*
|
|
60
|
+
* "today" is `getTodayInIST()` (IST calendar day). Concrete per getTodayInIST()
|
|
61
|
+
* rollover rule: endDay 13 + buffer 3 -> trigger IST day 17; that 01:00 IST IS
|
|
62
|
+
* UTC 19:30 the PREVIOUS day, so a UTC-default container reads getDate() = 16 ->
|
|
63
|
+
* 17 !== 16 -> returns null -> auto-classification silently no-ops.
|
|
64
|
+
*/
|
|
54
65
|
static getTimesheetAutoClassificationDateCodeRange(config: IClassificationWindowConfig): {
|
|
55
66
|
windowStart: string;
|
|
56
67
|
windowEnd: string;
|
|
57
68
|
} | null;
|
|
58
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Resolves the classification window that contains `now` (used by the reminder).
|
|
71
|
+
* `now` defaults to the IST calendar day (getTodayInIST()).
|
|
72
|
+
*
|
|
73
|
+
* Boundary examples per getTodayInIST() rollover rule (IST < 05:30 -> UTC prev day):
|
|
74
|
+
* IST day 1 00:xx -> UTC last day of the PREVIOUS month
|
|
75
|
+
* (a UTC clock would skip the day-1-3 spillover onto the
|
|
76
|
+
* prev-month 21-EOM window);
|
|
77
|
+
* IST day 21 00:30 -> UTC day 20
|
|
78
|
+
* (a UTC clock would miss the current-month 21-EOM tail).
|
|
79
|
+
*/
|
|
80
|
+
static getActiveClassificationWindowRange(config: IClassificationWindowConfig, now?: Date): {
|
|
59
81
|
windowStart: string;
|
|
60
82
|
windowEnd: string;
|
|
61
83
|
} | null;
|
|
@@ -63,5 +85,12 @@ export declare class TimesheetEntityModel extends BaseEntityModel<EntityEnum.TIM
|
|
|
63
85
|
startDay: number;
|
|
64
86
|
endDay: Nullable<number>;
|
|
65
87
|
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Fields on a timesheet that, when changed via an UPDATE, reset the timesheet's
|
|
90
|
+
* `classificationStatus` back to `PENDING`. Shared by backend (toUpdateDto) and frontend
|
|
91
|
+
* (edit warning). `billingId` intentionally NOT included — a billing change does not reset
|
|
92
|
+
* classification. Anything not listed here is by definition "non-reset".
|
|
93
|
+
*/
|
|
94
|
+
static timesheetClassificationResetFieldsSet(): string[];
|
|
66
95
|
static sortByProjectAndDesignation(data: SortableTimesheet[], designations: IDesignationEntity[]): SortableTimesheet[];
|
|
67
96
|
}
|