law-common 14.0.3-beta.4 → 14.0.3-beta.6
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/interface/reimbursement.entity.response.d.ts +1 -9
- 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/interface/timesheet.entity.interface.d.ts +1 -2
- package/dist/src/entities/model/timesheet.entity.model.d.ts +1 -8
- package/dist/src/entities/model/timesheet.entity.model.js +2 -19
- package/package.json +1 -1
|
@@ -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
|
};
|
|
@@ -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;
|
|
@@ -1,7 +1,6 @@
|
|
|
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";
|
|
5
4
|
export interface ITimesheetEntity extends IEntityAuditColumn {
|
|
6
5
|
id: number;
|
|
7
6
|
userId: number;
|
|
@@ -16,6 +15,6 @@ export interface ITimesheetEntity extends IEntityAuditColumn {
|
|
|
16
15
|
billedDuration?: number;
|
|
17
16
|
notBilledDuration?: number;
|
|
18
17
|
classificationStatus: TimesheetClassificationStatusEnum;
|
|
19
|
-
classifiedBy?:
|
|
18
|
+
classifiedBy?: number;
|
|
20
19
|
}
|
|
21
20
|
export type PendingApprovalStatus = TimesheetStatusEnum.CREATE_APPROVAL_PENDING | TimesheetStatusEnum.UPDATE_APPROVAL_PENDING | TimesheetStatusEnum.DELETE_APPROVAL_PENDING | TimesheetStatusEnum.RESOLVED_REJECTED;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ITimesheetUpdateDto, ITimesheetFlowContextData } 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";
|
|
@@ -63,12 +63,5 @@ export declare class TimesheetEntityModel extends BaseEntityModel<EntityEnum.TIM
|
|
|
63
63
|
startDay: number;
|
|
64
64
|
endDay: Nullable<number>;
|
|
65
65
|
}>;
|
|
66
|
-
/**
|
|
67
|
-
* Fields on a timesheet that, when changed via an UPDATE, reset the timesheet's
|
|
68
|
-
* `classificationStatus` back to `PENDING`. Shared by backend (toUpdateDto) and frontend
|
|
69
|
-
* (edit warning). `billingId` intentionally NOT included — a billing change does not reset
|
|
70
|
-
* classification. Anything not listed here is by definition "non-reset".
|
|
71
|
-
*/
|
|
72
|
-
static timesheetClassificationResetFieldsSet(): string[];
|
|
73
66
|
static sortByProjectAndDesignation(data: SortableTimesheet[], designations: IDesignationEntity[]): SortableTimesheet[];
|
|
74
67
|
}
|
|
@@ -84,10 +84,8 @@ class TimesheetEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
84
84
|
return false;
|
|
85
85
|
if (actionKey === timesheet_action_enum_1.TimesheetActionEnum.CLASSIFY)
|
|
86
86
|
return false;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
// if (actionKey === TimesheetActionEnum.UPDATE && this.classificationStatus && this.classificationStatus !== TimesheetClassificationStatusEnum.PENDING)
|
|
90
|
-
// return false;
|
|
87
|
+
if (actionKey === timesheet_action_enum_1.TimesheetActionEnum.UPDATE && this.classificationStatus && this.classificationStatus !== timesheet_classification_status_enum_1.TimesheetClassificationStatusEnum.PENDING)
|
|
88
|
+
return false;
|
|
91
89
|
return true;
|
|
92
90
|
})
|
|
93
91
|
.map(([actionKey, actionConfig]) => {
|
|
@@ -290,21 +288,6 @@ class TimesheetEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
290
288
|
};
|
|
291
289
|
});
|
|
292
290
|
}
|
|
293
|
-
/**
|
|
294
|
-
* Fields on a timesheet that, when changed via an UPDATE, reset the timesheet's
|
|
295
|
-
* `classificationStatus` back to `PENDING`. Shared by backend (toUpdateDto) and frontend
|
|
296
|
-
* (edit warning). `billingId` intentionally NOT included — a billing change does not reset
|
|
297
|
-
* classification. Anything not listed here is by definition "non-reset".
|
|
298
|
-
*/
|
|
299
|
-
static timesheetClassificationResetFieldsSet() {
|
|
300
|
-
return [
|
|
301
|
-
"userId",
|
|
302
|
-
"projectId",
|
|
303
|
-
"dateCode",
|
|
304
|
-
"totalDuration",
|
|
305
|
-
// "task", "description",
|
|
306
|
-
];
|
|
307
|
-
}
|
|
308
291
|
static sortByProjectAndDesignation(data, designations) {
|
|
309
292
|
const priorityMap = new Map();
|
|
310
293
|
designations.forEach((d) => {
|