law-common 14.0.3-beta.11 → 14.0.3-beta.12
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 -2
- package/dist/src/api/index.js +2 -28
- 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/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/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/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 -9
- package/dist/src/api/v1/index.js +0 -25
- package/dist/src/api/v2/index.d.ts +0 -11
- package/dist/src/api/v2/index.js +0 -29
- 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}/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/api/index.d.ts
CHANGED
|
@@ -80,7 +80,9 @@ export * from "./interface/leave.create.dto.interface";
|
|
|
80
80
|
export * from "./interface/leave.update.dto.interface";
|
|
81
81
|
export * from "./interface/cron_jobs.entity.response";
|
|
82
82
|
export * from "./interface/cron_jobs_manual_trigger.dto.interface";
|
|
83
|
+
export * from "./interface/to_do_list.create.dto.interface";
|
|
83
84
|
export * from "./interface/to_do_list.filter.dto.interface";
|
|
85
|
+
export * from "./interface/to_do_list.update.dto.interface";
|
|
84
86
|
export * from "./interface/project_user_mapping.create.dto.interface";
|
|
85
87
|
export * from "./interface/project_user_mapping.filter.dto.interface";
|
|
86
88
|
export * from "./interface/project_user_mapping.update.dto.interface";
|
|
@@ -175,5 +177,3 @@ export * from "./interface/bank.filter.dto.interface";
|
|
|
175
177
|
export * from "./interface/intermediary_bank.create.dto.interface";
|
|
176
178
|
export * from "./interface/intermediary_bank.filter.dto.interface";
|
|
177
179
|
export * from "./interface/intermediary_bank.update.dto.interface";
|
|
178
|
-
export * as v1 from "./v1";
|
|
179
|
-
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);
|
|
@@ -119,7 +96,9 @@ __exportStar(require("./interface/leave.create.dto.interface"), exports);
|
|
|
119
96
|
__exportStar(require("./interface/leave.update.dto.interface"), exports);
|
|
120
97
|
__exportStar(require("./interface/cron_jobs.entity.response"), exports);
|
|
121
98
|
__exportStar(require("./interface/cron_jobs_manual_trigger.dto.interface"), exports);
|
|
99
|
+
__exportStar(require("./interface/to_do_list.create.dto.interface"), exports);
|
|
122
100
|
__exportStar(require("./interface/to_do_list.filter.dto.interface"), exports);
|
|
101
|
+
__exportStar(require("./interface/to_do_list.update.dto.interface"), exports);
|
|
123
102
|
// export * from "./interface/billing-reimbursement-expense.api";
|
|
124
103
|
// export * from "./interface/billing-reimbursement-expense-history.api";
|
|
125
104
|
__exportStar(require("./interface/project_user_mapping.create.dto.interface"), exports);
|
|
@@ -216,8 +195,3 @@ __exportStar(require("./interface/bank.filter.dto.interface"), exports);
|
|
|
216
195
|
__exportStar(require("./interface/intermediary_bank.create.dto.interface"), exports);
|
|
217
196
|
__exportStar(require("./interface/intermediary_bank.filter.dto.interface"), exports);
|
|
218
197
|
__exportStar(require("./interface/intermediary_bank.update.dto.interface"), exports);
|
|
219
|
-
// Versioned contracts (checklist 12.4). Namespace re-exports only - never `export *` flat from
|
|
220
|
-
// v1 or v2: flat-exporting both is a duplicate-export error, and flat-exporting one reintroduces
|
|
221
|
-
// the ambiguity the fork exists to remove.
|
|
222
|
-
exports.v1 = __importStar(require("./v1"));
|
|
223
|
-
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
|
}
|
|
@@ -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;
|
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,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
|
}
|
|
@@ -84,8 +84,10 @@ 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
|
-
|
|
87
|
+
// LW-842: allow UPDATE regardless of classification status — the backend now resets
|
|
88
|
+
// classificationStatus to PENDING in toUpdateDto when a reset-field changes.
|
|
89
|
+
// if (actionKey === TimesheetActionEnum.UPDATE && this.classificationStatus && this.classificationStatus !== TimesheetClassificationStatusEnum.PENDING)
|
|
90
|
+
// return false;
|
|
89
91
|
return true;
|
|
90
92
|
})
|
|
91
93
|
.map(([actionKey, actionConfig]) => {
|
|
@@ -225,10 +227,21 @@ class TimesheetEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
225
227
|
d.setHours(23, 59, 59, 999);
|
|
226
228
|
return d;
|
|
227
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* IST point-in-time AUTO-CLASSIFY trigger. Returns the classification window
|
|
232
|
+
* whose `endDay + bufferDays + 1 == today` (IST) — i.e. it fires on a SINGLE day
|
|
233
|
+
* per window (the auto-classify cron runs at 01:00 IST each morning).
|
|
234
|
+
* Trailing window (endDay === null) evaluates against the PREVIOUS month's EOM.
|
|
235
|
+
*
|
|
236
|
+
* "today" is `getTodayInIST()` (IST calendar day). Concrete per getTodayInIST()
|
|
237
|
+
* rollover rule: endDay 13 + buffer 3 -> trigger IST day 17; that 01:00 IST IS
|
|
238
|
+
* UTC 19:30 the PREVIOUS day, so a UTC-default container reads getDate() = 16 ->
|
|
239
|
+
* 17 !== 16 -> returns null -> auto-classification silently no-ops.
|
|
240
|
+
*/
|
|
228
241
|
static getTimesheetAutoClassificationDateCodeRange(config) {
|
|
229
242
|
var _a;
|
|
230
243
|
const { bufferDays, windows } = config;
|
|
231
|
-
const today =
|
|
244
|
+
const today = (0, utils_1.getTodayInIST)();
|
|
232
245
|
for (const window of windows) {
|
|
233
246
|
// Last window (endDay === null) belongs to the previous month
|
|
234
247
|
const targetDate = window.endDay === null ? (0, date_fns_1.subMonths)(today, 1) : today;
|
|
@@ -245,35 +258,54 @@ class TimesheetEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
245
258
|
}
|
|
246
259
|
return null;
|
|
247
260
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
261
|
+
/**
|
|
262
|
+
* Resolves the classification window that contains `now` (used by the reminder).
|
|
263
|
+
* `now` defaults to the IST calendar day (getTodayInIST()).
|
|
264
|
+
*
|
|
265
|
+
* Boundary examples per getTodayInIST() rollover rule (IST < 05:30 -> UTC prev day):
|
|
266
|
+
* IST day 1 00:xx -> UTC last day of the PREVIOUS month
|
|
267
|
+
* (a UTC clock would skip the day-1-3 spillover onto the
|
|
268
|
+
* prev-month 21-EOM window);
|
|
269
|
+
* IST day 21 00:30 -> UTC day 20
|
|
270
|
+
* (a UTC clock would miss the current-month 21-EOM tail).
|
|
271
|
+
*/
|
|
272
|
+
static getActiveClassificationWindowRange(config, now = (0, utils_1.getTodayInIST)()) {
|
|
273
|
+
const { bufferDays, windows } = config; // bufferDays = 3
|
|
274
|
+
const year = now.getFullYear(); // now = Oct 1 2026 -> year = 2026
|
|
275
|
+
const month = now.getMonth(); // month = 9 (Oct)
|
|
276
|
+
// Spillover check: does `now` still fall within the PREVIOUS month's trailing
|
|
277
|
+
// window (21-EOM) plus its buffer? If so, that window is still pending
|
|
278
|
+
// classification and takes priority over the current month's own windows.
|
|
279
|
+
const lastWindow = windows[windows.length - 1]; // lastWindow = { startDay: 21, endDay: null }
|
|
280
|
+
if ((lastWindow === null || lastWindow === void 0 ? void 0 : lastWindow.endDay) === null) {
|
|
281
|
+
const prevMonthDate = (0, date_fns_1.subMonths)(new Date(year, month, 1), 1); // prevMonthDate = Sep 1 2026
|
|
282
|
+
const prevYear = prevMonthDate.getFullYear(); // prevYear = 2026
|
|
283
|
+
const prevMonth = prevMonthDate.getMonth(); // prevMonth = 8 (Sep)
|
|
284
|
+
const prevMonthEom = (0, date_fns_1.lastDayOfMonth)(prevMonthDate).getDate(); // prevMonthEom = 30
|
|
285
|
+
const prevWindowStartDate = new Date(prevYear, prevMonth, lastWindow.startDay); // Sep 21 2026
|
|
286
|
+
prevWindowStartDate.setHours(0, 0, 0, 0); // Sep 21 2026 00:00:00.000
|
|
287
|
+
const prevWindowEndDate = new Date(prevYear, prevMonth, prevMonthEom); // Sep 30 2026
|
|
288
|
+
prevWindowEndDate.setHours(23, 59, 59, 999); // Sep 30 2026 23:59:59.999
|
|
289
|
+
const prevWindowEndDateWithBuffer = (0, date_fns_1.addDays)(new Date(prevYear, prevMonth, prevMonthEom), bufferDays); // Sep30 + 3 -> Oct 3 2026
|
|
290
|
+
prevWindowEndDateWithBuffer.setHours(23, 59, 59, 999); // Oct 3 2026 23:59:59.999
|
|
291
|
+
if (now.getTime() >= prevWindowStartDate.getTime() && now.getTime() <= prevWindowEndDateWithBuffer.getTime()) {
|
|
292
|
+
// Oct1 >= Sep21 -> true, Oct1 <= Oct3 -> true, so this branch matches and returns here
|
|
293
|
+
return {
|
|
294
|
+
windowStart: (0, date_fns_1.format)(prevWindowStartDate, "yyyyMMdd"), // "20260921"
|
|
295
|
+
windowEnd: (0, date_fns_1.format)(prevWindowEndDate, "yyyyMMdd"), // "20260930"
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
}
|
|
255
299
|
for (const window of windows) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
const windowEndDay = actualEndDay;
|
|
263
|
-
// check if today falls within this window's active period
|
|
264
|
-
// active period = from windowStart until triggerDate (endDay + bufferDays)
|
|
265
|
-
const triggerDate = (0, date_fns_1.addDays)(new Date(targetYear, targetMonth, actualEndDay), bufferDays);
|
|
266
|
-
const triggerDay = triggerDate.getDate();
|
|
267
|
-
const triggerMonth = triggerDate.getMonth();
|
|
268
|
-
const triggerYear = triggerDate.getFullYear();
|
|
269
|
-
const todayTime = today.getTime();
|
|
270
|
-
const windowOpenDate = new Date(targetYear, targetMonth, windowStartDay);
|
|
271
|
-
const windowCloseDate = new Date(triggerYear, triggerMonth, triggerDay);
|
|
272
|
-
windowCloseDate.setHours(23, 59, 59, 999);
|
|
273
|
-
if (todayTime >= windowOpenDate.getTime() && todayTime <= windowCloseDate.getTime()) {
|
|
300
|
+
const windowStartDate = new Date(year, month, window.startDay);
|
|
301
|
+
windowStartDate.setHours(0, 0, 0, 0);
|
|
302
|
+
const windowEndDate = window.endDay === null ? (0, date_fns_1.lastDayOfMonth)(new Date(year, month, 1)) : new Date(year, month, window.endDay);
|
|
303
|
+
windowEndDate.setHours(23, 59, 59, 999);
|
|
304
|
+
if (now.getTime() >= windowStartDate.getTime() && now.getTime() <= windowEndDate.getTime()) {
|
|
305
|
+
// not reached for Oct 1 -- spillover branch already returned above
|
|
274
306
|
return {
|
|
275
|
-
windowStart: (0, date_fns_1.format)(
|
|
276
|
-
windowEnd: (0, date_fns_1.format)(
|
|
307
|
+
windowStart: (0, date_fns_1.format)(windowStartDate, "yyyyMMdd"),
|
|
308
|
+
windowEnd: (0, date_fns_1.format)(windowEndDate, "yyyyMMdd"),
|
|
277
309
|
};
|
|
278
310
|
}
|
|
279
311
|
}
|
|
@@ -288,6 +320,21 @@ class TimesheetEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
288
320
|
};
|
|
289
321
|
});
|
|
290
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* Fields on a timesheet that, when changed via an UPDATE, reset the timesheet's
|
|
325
|
+
* `classificationStatus` back to `PENDING`. Shared by backend (toUpdateDto) and frontend
|
|
326
|
+
* (edit warning). `billingId` intentionally NOT included — a billing change does not reset
|
|
327
|
+
* classification. Anything not listed here is by definition "non-reset".
|
|
328
|
+
*/
|
|
329
|
+
static timesheetClassificationResetFieldsSet() {
|
|
330
|
+
return [
|
|
331
|
+
"userId",
|
|
332
|
+
"projectId",
|
|
333
|
+
"dateCode",
|
|
334
|
+
"totalDuration",
|
|
335
|
+
// "task", "description",
|
|
336
|
+
];
|
|
337
|
+
}
|
|
291
338
|
static sortByProjectAndDesignation(data, designations) {
|
|
292
339
|
const priorityMap = new Map();
|
|
293
340
|
designations.forEach((d) => {
|
|
@@ -1,48 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ToDoListActionEnum } from "../enums/to_do_list_action_enum";
|
|
2
|
+
import { IToDoListFlowConfigContextData } from "../flow-configs/to_do_list_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
|
-
import { UserEntityModel } from "./user.entity.model";
|
|
7
|
-
import { ToDoListActionEnum } from "../../entities";
|
|
8
5
|
import { ToDoListStatusEnum } from "../enums/to_do_list_status_enum";
|
|
9
|
-
import {
|
|
6
|
+
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
7
|
+
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
10
8
|
import { IToDoListEntity } from "../interface/to_do_list.entity.interface";
|
|
11
|
-
import {
|
|
12
|
-
import { BillingEntityModel } from "./billing.entity.model";
|
|
13
|
-
import { ClientEntityModel } from "./client.entity.model";
|
|
14
|
-
import { ClientAffiliateEntityModel } from "./client_affiliate.entity.model";
|
|
15
|
-
import { ClientDebitNoteEntityModel } from "./client_debit_note.entity.model";
|
|
16
|
-
import { ClientDebitNoteParticularsEntityModel } from "./client_debit_note_particulars.entity.model";
|
|
17
|
-
import { CountryEntityModel } from "./country.entity.model";
|
|
18
|
-
import { ExpenseHeadEntityModel } from "./expense_head.entity.model";
|
|
19
|
-
import { GstRateEntityModel } from "./gst_rate.entity.model";
|
|
20
|
-
import { IntermediaryBankEntityModel } from "./intermediary_bank.entity.model";
|
|
21
|
-
import { LeaveEntityModel } from "./leave.entity.model";
|
|
22
|
-
import { LeaveApprovalEntityModel } from "./leave_approval.entity.model";
|
|
23
|
-
import { OfficeLocationEntityModel } from "./office_location.entity.model";
|
|
24
|
-
import { OrganizationEntityModel } from "./organization.entity.model";
|
|
25
|
-
import { OrganizationTypeEntityModel } from "./organization_type.entity.model";
|
|
9
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
26
10
|
import { ProjectEntityModel } from "./project.entity.model";
|
|
27
|
-
import {
|
|
28
|
-
import { TdsRateEntityModel } from "./tds_rate.entity.model";
|
|
29
|
-
import { VendorEntityModel } from "./vendor.entity.model";
|
|
30
|
-
import { VendorAdvanceEntityModel } from "./vendor_advance.entity.model";
|
|
31
|
-
import { VendorInvoiceEntityModel } from "./vendor_invoice.entity.model";
|
|
32
|
-
import { VendorInvoiceAdvanceEntityModel } from "./vendor_invoice_advance.entity.model";
|
|
33
|
-
import { VendorInvoiceItemEntityModel } from "./vendor_invoice_item.entity.model";
|
|
34
|
-
import { VendorInvoicePaymentEntityModel } from "./vendor_invoice_payment.entity.model";
|
|
35
|
-
import { VendorTdsChallanEntityModel } from "./vendor_tds_challan.entity.model";
|
|
36
|
-
import { VendorTdsLiabilityEntityModel } from "./vendor_tds_liability.entity.model";
|
|
37
|
-
import { VoucherTypeEntityModel } from "./voucher_type.entity.model";
|
|
38
|
-
import { WorkFromHomeEntityModel } from "./work_from_home.entity.model";
|
|
11
|
+
import { UserEntityModel } from "./user.entity.model";
|
|
39
12
|
export declare class ToDoListEntityModel extends BaseEntityModel<EntityEnum.TO_DO_LIST> implements IToDoListEntity {
|
|
40
13
|
id: number;
|
|
41
14
|
description: string;
|
|
15
|
+
dateCode: string;
|
|
42
16
|
estimatedDuration: number;
|
|
43
|
-
userId: number;
|
|
44
17
|
projectId: number;
|
|
45
|
-
|
|
18
|
+
userId: number;
|
|
46
19
|
status: ToDoListStatusEnum;
|
|
47
20
|
createdOn: number;
|
|
48
21
|
updatedOn: number;
|
|
@@ -52,34 +25,7 @@ export declare class ToDoListEntityModel extends BaseEntityModel<EntityEnum.TO_D
|
|
|
52
25
|
user?: UserEntityModel;
|
|
53
26
|
static relationConfigs: RelationConfigs<[EntityEnum.PROJECT, EntityEnum.USER], EntityEnum.TO_DO_LIST>;
|
|
54
27
|
static fromEntity(entity: IToDoListEntity): ToDoListEntityModel;
|
|
55
|
-
getRelationConfigs():
|
|
56
|
-
get leaveApprovals(): LeaveApprovalEntityModel[] | undefined;
|
|
57
|
-
get leaves(): LeaveEntityModel[] | undefined;
|
|
58
|
-
get clients(): ClientEntityModel[] | undefined;
|
|
59
|
-
get clientDebitNotes(): ClientDebitNoteEntityModel[] | undefined;
|
|
60
|
-
get banks(): BankEntityModel[] | undefined;
|
|
61
|
-
get vendorTdsChallans(): VendorTdsChallanEntityModel[] | undefined;
|
|
62
|
-
get tdsRates(): TdsRateEntityModel[] | undefined;
|
|
63
|
-
get organizationTypes(): OrganizationTypeEntityModel[] | undefined;
|
|
64
|
-
get vendors(): VendorEntityModel[] | undefined;
|
|
65
|
-
get states(): StateEntityModel[] | undefined;
|
|
66
|
-
get countrys(): CountryEntityModel[] | undefined;
|
|
67
|
-
get vendorInvoices(): VendorInvoiceEntityModel[] | undefined;
|
|
68
|
-
get officeLocations(): OfficeLocationEntityModel[] | undefined;
|
|
69
|
-
get organizations(): OrganizationEntityModel[] | undefined;
|
|
70
|
-
get vendorInvoiceItems(): VendorInvoiceItemEntityModel[] | undefined;
|
|
71
|
-
get voucherTypes(): VoucherTypeEntityModel[] | undefined;
|
|
72
|
-
get expenseHeads(): ExpenseHeadEntityModel[] | undefined;
|
|
73
|
-
get gstRates(): GstRateEntityModel[] | undefined;
|
|
74
|
-
get vendorAdvances(): VendorAdvanceEntityModel[] | undefined;
|
|
75
|
-
get vendorInvoiceAdvances(): VendorInvoiceAdvanceEntityModel[] | undefined;
|
|
76
|
-
get vendorInvoicePayments(): VendorInvoicePaymentEntityModel[] | undefined;
|
|
77
|
-
get vendorTdsLiabilitys(): VendorTdsLiabilityEntityModel[] | undefined;
|
|
78
|
-
get intermediaryBanks(): IntermediaryBankEntityModel[] | undefined;
|
|
79
|
-
get billings(): BillingEntityModel[] | undefined;
|
|
80
|
-
get clientAffiliates(): ClientAffiliateEntityModel[] | undefined;
|
|
81
|
-
get clientDebitNoteParticularss(): ClientDebitNoteParticularsEntityModel[] | undefined;
|
|
82
|
-
get workFromHomes(): WorkFromHomeEntityModel[] | undefined;
|
|
28
|
+
getRelationConfigs(): [import("../interface/relation-config.interface").IRelationConfig<EntityEnum.PROJECT, EntityEnum.TO_DO_LIST>, import("../interface/relation-config.interface").IRelationConfig<EntityEnum.USER, EntityEnum.TO_DO_LIST>];
|
|
83
29
|
getNextStatus(currentUser: IUserEntity, action: ToDoListActionEnum, toDoListFlowConfigContextData: IToDoListFlowConfigContextData): ToDoListStatusEnum;
|
|
84
30
|
getAvailableActions(currentUser: UserEntityModel, config?: {
|
|
85
31
|
combinedActions?: Record<string, {
|
|
@@ -4,20 +4,20 @@ exports.ToDoListEntityModel = 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 to_do_list_flow_config_1 = require("../flow-configs/to_do_list_flow.config");
|
|
8
|
+
const to_do_list_status_enum_1 = require("../enums/to_do_list_status_enum");
|
|
9
|
+
const relation_type_enum_1 = require("../enums/relation_type_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 entities_1 = require("../../entities");
|
|
10
|
-
const to_do_list_status_enum_1 = require("../enums/to_do_list_status_enum");
|
|
11
|
-
const to_do_list_flow_config_1 = require("../flow-configs/to_do_list_flow.config");
|
|
12
12
|
class ToDoListEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
15
|
this.id = 0;
|
|
16
16
|
this.description = "";
|
|
17
|
+
this.dateCode = "";
|
|
17
18
|
this.estimatedDuration = 0;
|
|
18
|
-
this.userId = 0;
|
|
19
19
|
this.projectId = 0;
|
|
20
|
-
this.
|
|
20
|
+
this.userId = 0;
|
|
21
21
|
this.status = to_do_list_status_enum_1.ToDoListStatusEnum.APPROVED;
|
|
22
22
|
this.createdOn = 0;
|
|
23
23
|
this.updatedOn = 0;
|
|
@@ -30,357 +30,7 @@ class ToDoListEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
30
30
|
return result;
|
|
31
31
|
}
|
|
32
32
|
getRelationConfigs() {
|
|
33
|
-
return
|
|
34
|
-
}
|
|
35
|
-
get leaveApprovals() {
|
|
36
|
-
// many_to_many -> many_to_many verified
|
|
37
|
-
// {'to_do_list->user': 'many_to_one', 'user->leave_approval': 'one_to_many'}
|
|
38
|
-
// ['to_do_list', 'user'] -> many_to_one
|
|
39
|
-
// ['user', 'leave_approval'] -> one_to_many
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
get leaves() {
|
|
43
|
-
// many_to_many -> many_to_many verified
|
|
44
|
-
// {'to_do_list->user': 'many_to_one', 'user->leave_approval': 'one_to_many', 'leave_approval->leave': 'many_to_one'}
|
|
45
|
-
// ['user', 'leave_approval'] -> one_to_many
|
|
46
|
-
// ['leave_approval', 'leave'] -> many_to_one
|
|
47
|
-
var _a;
|
|
48
|
-
return (_a = this.leaveApprovals) === null || _a === void 0 ? void 0 : _a.flatMap((leaveApproval) => leaveApproval.leave).filter((leave) => !!leave).reduce((accumulator, current) => {
|
|
49
|
-
if (!accumulator.some((leave) => leave.id === current.id)) {
|
|
50
|
-
accumulator.push(current);
|
|
51
|
-
}
|
|
52
|
-
return accumulator;
|
|
53
|
-
}, []);
|
|
54
|
-
}
|
|
55
|
-
get clients() {
|
|
56
|
-
// many_to_many -> many_to_many verified
|
|
57
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many'}
|
|
58
|
-
// ['to_do_list', 'user'] -> many_to_one
|
|
59
|
-
// ['user', 'client'] -> many_to_many
|
|
60
|
-
// return this.user?.clients;
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
get clientDebitNotes() {
|
|
64
|
-
// many_to_many -> many_to_many verified
|
|
65
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many'}
|
|
66
|
-
// ['user', 'client'] -> many_to_many
|
|
67
|
-
// ['client', 'client_debit_note'] -> one_to_many
|
|
68
|
-
// return this.clients
|
|
69
|
-
// ?.flatMap((client) => client.clientDebitNotes)
|
|
70
|
-
// .filter((clientDebitNote): clientDebitNote is ClientDebitNoteEntityModel => !!clientDebitNote)
|
|
71
|
-
// .reduce((accumulator: ClientDebitNoteEntityModel[], current) => {
|
|
72
|
-
// if (!accumulator.some((clientDebitNote) => clientDebitNote.id === current.id)) {
|
|
73
|
-
// accumulator.push(current);
|
|
74
|
-
// }
|
|
75
|
-
// return accumulator;
|
|
76
|
-
// }, []);
|
|
77
|
-
return undefined;
|
|
78
|
-
}
|
|
79
|
-
get banks() {
|
|
80
|
-
// many_to_many -> many_to_many verified
|
|
81
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one'}
|
|
82
|
-
// ['client', 'client_debit_note'] -> one_to_many
|
|
83
|
-
// ['client_debit_note', 'bank'] -> many_to_one
|
|
84
|
-
var _a;
|
|
85
|
-
return (_a = this.clientDebitNotes) === null || _a === void 0 ? void 0 : _a.flatMap((clientDebitNote) => clientDebitNote.bank).filter((bank) => !!bank).reduce((accumulator, current) => {
|
|
86
|
-
if (!accumulator.some((bank) => bank.id === current.id)) {
|
|
87
|
-
accumulator.push(current);
|
|
88
|
-
}
|
|
89
|
-
return accumulator;
|
|
90
|
-
}, []);
|
|
91
|
-
}
|
|
92
|
-
get vendorTdsChallans() {
|
|
93
|
-
// many_to_many -> many_to_many verified
|
|
94
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many'}
|
|
95
|
-
// ['client_debit_note', 'bank'] -> many_to_one
|
|
96
|
-
// ['bank', 'vendor_tds_challan'] -> one_to_many
|
|
97
|
-
// return this.banks
|
|
98
|
-
// ?.flatMap((bank) => bank.vendorTdsChallans)
|
|
99
|
-
// .filter((vendorTdsChallan): vendorTdsChallan is VendorTdsChallanEntityModel => !!vendorTdsChallan)
|
|
100
|
-
// .reduce((accumulator: VendorTdsChallanEntityModel[], current) => {
|
|
101
|
-
// if (!accumulator.some((vendorTdsChallan) => vendorTdsChallan.id === current.id)) {
|
|
102
|
-
// accumulator.push(current);
|
|
103
|
-
// }
|
|
104
|
-
// return accumulator;
|
|
105
|
-
// }, []);
|
|
106
|
-
return undefined;
|
|
107
|
-
}
|
|
108
|
-
get tdsRates() {
|
|
109
|
-
// many_to_many -> many_to_many verified
|
|
110
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one'}
|
|
111
|
-
// ['bank', 'vendor_tds_challan'] -> one_to_many
|
|
112
|
-
// ['vendor_tds_challan', 'tds_rate'] -> many_to_one
|
|
113
|
-
var _a;
|
|
114
|
-
return (_a = this.vendorTdsChallans) === null || _a === void 0 ? void 0 : _a.flatMap((vendorTdsChallan) => vendorTdsChallan.tdsRate).filter((tdsRate) => !!tdsRate).reduce((accumulator, current) => {
|
|
115
|
-
if (!accumulator.some((tdsRate) => tdsRate.id === current.id)) {
|
|
116
|
-
accumulator.push(current);
|
|
117
|
-
}
|
|
118
|
-
return accumulator;
|
|
119
|
-
}, []);
|
|
120
|
-
}
|
|
121
|
-
get organizationTypes() {
|
|
122
|
-
// many_to_many -> many_to_many verified
|
|
123
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->organization_type': 'many_to_many'}
|
|
124
|
-
// ['vendor_tds_challan', 'tds_rate'] -> many_to_one
|
|
125
|
-
// ['tds_rate', 'organization_type'] -> many_to_many
|
|
126
|
-
var _a;
|
|
127
|
-
return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.organizationTypes).filter((organizationType) => !!organizationType).reduce((accumulator, current) => {
|
|
128
|
-
if (!accumulator.some((organizationType) => organizationType.id === current.id)) {
|
|
129
|
-
accumulator.push(current);
|
|
130
|
-
}
|
|
131
|
-
return accumulator;
|
|
132
|
-
}, []);
|
|
133
|
-
}
|
|
134
|
-
get vendors() {
|
|
135
|
-
// many_to_many -> many_to_many verified
|
|
136
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many'}
|
|
137
|
-
// ['tds_rate', 'organization_type'] -> many_to_many
|
|
138
|
-
// ['organization_type', 'vendor'] -> one_to_many
|
|
139
|
-
var _a;
|
|
140
|
-
return (_a = this.organizationTypes) === null || _a === void 0 ? void 0 : _a.flatMap((organizationType) => organizationType.vendors).filter((vendor) => !!vendor).reduce((accumulator, current) => {
|
|
141
|
-
if (!accumulator.some((vendor) => vendor.id === current.id)) {
|
|
142
|
-
accumulator.push(current);
|
|
143
|
-
}
|
|
144
|
-
return accumulator;
|
|
145
|
-
}, []);
|
|
146
|
-
}
|
|
147
|
-
get states() {
|
|
148
|
-
// many_to_many -> many_to_many verified
|
|
149
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->state': 'many_to_one'}
|
|
150
|
-
// ['organization_type', 'vendor'] -> one_to_many
|
|
151
|
-
// ['vendor', 'state'] -> many_to_one
|
|
152
|
-
var _a;
|
|
153
|
-
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.stateModel).filter((state) => !!state).reduce((accumulator, current) => {
|
|
154
|
-
if (!accumulator.some((state) => state.id === current.id)) {
|
|
155
|
-
accumulator.push(current);
|
|
156
|
-
}
|
|
157
|
-
return accumulator;
|
|
158
|
-
}, []);
|
|
159
|
-
}
|
|
160
|
-
get countrys() {
|
|
161
|
-
// many_to_many -> many_to_many verified
|
|
162
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->country': 'many_to_one'}
|
|
163
|
-
// ['organization_type', 'vendor'] -> one_to_many
|
|
164
|
-
// ['vendor', 'country'] -> many_to_one
|
|
165
|
-
var _a;
|
|
166
|
-
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.countryModel).filter((country) => !!country).reduce((accumulator, current) => {
|
|
167
|
-
if (!accumulator.some((country) => country.id === current.id)) {
|
|
168
|
-
accumulator.push(current);
|
|
169
|
-
}
|
|
170
|
-
return accumulator;
|
|
171
|
-
}, []);
|
|
172
|
-
}
|
|
173
|
-
get vendorInvoices() {
|
|
174
|
-
// one_to_many -> many_to_many mismatch
|
|
175
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many'}
|
|
176
|
-
// ['organization_type', 'vendor'] -> one_to_many
|
|
177
|
-
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
178
|
-
var _a;
|
|
179
|
-
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.vendorInvoices).filter((vendorInvoice) => !!vendorInvoice).reduce((accumulator, current) => {
|
|
180
|
-
if (!accumulator.some((vendorInvoice) => vendorInvoice.id === current.id)) {
|
|
181
|
-
accumulator.push(current);
|
|
182
|
-
}
|
|
183
|
-
return accumulator;
|
|
184
|
-
}, []);
|
|
185
|
-
}
|
|
186
|
-
get officeLocations() {
|
|
187
|
-
// many_to_many -> many_to_many verified
|
|
188
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->office_location': 'many_to_one'}
|
|
189
|
-
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
190
|
-
// ['vendor_invoice', 'office_location'] -> many_to_one
|
|
191
|
-
var _a;
|
|
192
|
-
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.officeLocation).filter((officeLocation) => !!officeLocation).reduce((accumulator, current) => {
|
|
193
|
-
if (!accumulator.some((officeLocation) => officeLocation.id === current.id)) {
|
|
194
|
-
accumulator.push(current);
|
|
195
|
-
}
|
|
196
|
-
return accumulator;
|
|
197
|
-
}, []);
|
|
198
|
-
}
|
|
199
|
-
get organizations() {
|
|
200
|
-
// many_to_one -> many_to_many mismatch
|
|
201
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->office_location': 'many_to_one', 'office_location->organization': 'many_to_one'}
|
|
202
|
-
// ['vendor_invoice', 'office_location'] -> many_to_one
|
|
203
|
-
// ['office_location', 'organization'] -> many_to_one
|
|
204
|
-
// return this.officeLocations
|
|
205
|
-
// ?.flatMap((officeLocation) => officeLocation.organizations)
|
|
206
|
-
// .filter((organization): organization is OrganizationEntityModel => !!organization)
|
|
207
|
-
// .reduce((accumulator: OrganizationEntityModel[], current) => {
|
|
208
|
-
// if (!accumulator.some((organization) => organization.id === current.id)) {
|
|
209
|
-
// accumulator.push(current);
|
|
210
|
-
// }
|
|
211
|
-
// return accumulator;
|
|
212
|
-
// }, []);
|
|
213
|
-
return undefined;
|
|
214
|
-
}
|
|
215
|
-
get vendorInvoiceItems() {
|
|
216
|
-
// one_to_many -> many_to_many mismatch
|
|
217
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many'}
|
|
218
|
-
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
219
|
-
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
220
|
-
var _a;
|
|
221
|
-
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoiceItems).filter((vendorInvoiceItem) => !!vendorInvoiceItem).reduce((accumulator, current) => {
|
|
222
|
-
if (!accumulator.some((vendorInvoiceItem) => vendorInvoiceItem.id === current.id)) {
|
|
223
|
-
accumulator.push(current);
|
|
224
|
-
}
|
|
225
|
-
return accumulator;
|
|
226
|
-
}, []);
|
|
227
|
-
}
|
|
228
|
-
get voucherTypes() {
|
|
229
|
-
// many_to_many -> many_to_many verified
|
|
230
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->voucher_type': 'many_to_many'}
|
|
231
|
-
// ['vendor_tds_challan', 'tds_rate'] -> many_to_one
|
|
232
|
-
// ['tds_rate', 'voucher_type'] -> many_to_many
|
|
233
|
-
var _a;
|
|
234
|
-
return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.voucherTypes).filter((voucherType) => !!voucherType).reduce((accumulator, current) => {
|
|
235
|
-
if (!accumulator.some((voucherType) => voucherType.id === current.id)) {
|
|
236
|
-
accumulator.push(current);
|
|
237
|
-
}
|
|
238
|
-
return accumulator;
|
|
239
|
-
}, []);
|
|
240
|
-
}
|
|
241
|
-
get expenseHeads() {
|
|
242
|
-
// many_to_many -> many_to_many verified
|
|
243
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->voucher_type': 'many_to_many', 'voucher_type->expense_head': 'one_to_many'}
|
|
244
|
-
// ['tds_rate', 'voucher_type'] -> many_to_many
|
|
245
|
-
// ['voucher_type', 'expense_head'] -> one_to_many
|
|
246
|
-
var _a;
|
|
247
|
-
return (_a = this.voucherTypes) === null || _a === void 0 ? void 0 : _a.flatMap((voucherType) => voucherType.expenseHeads).filter((expenseHead) => !!expenseHead).reduce((accumulator, current) => {
|
|
248
|
-
if (!accumulator.some((expenseHead) => expenseHead.id === current.id)) {
|
|
249
|
-
accumulator.push(current);
|
|
250
|
-
}
|
|
251
|
-
return accumulator;
|
|
252
|
-
}, []);
|
|
253
|
-
}
|
|
254
|
-
get gstRates() {
|
|
255
|
-
// many_to_many -> many_to_many verified
|
|
256
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->organization_type': 'many_to_many', 'organization_type->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'}
|
|
257
|
-
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
258
|
-
// ['vendor_invoice_item', 'gst_rate'] -> many_to_one
|
|
259
|
-
var _a;
|
|
260
|
-
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.gstRate).filter((gstRate) => !!gstRate).reduce((accumulator, current) => {
|
|
261
|
-
if (!accumulator.some((gstRate) => gstRate.id === current.id)) {
|
|
262
|
-
accumulator.push(current);
|
|
263
|
-
}
|
|
264
|
-
return accumulator;
|
|
265
|
-
}, []);
|
|
266
|
-
}
|
|
267
|
-
get vendorAdvances() {
|
|
268
|
-
// one_to_many -> many_to_many mismatch
|
|
269
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->vendor_advance': 'one_to_many'}
|
|
270
|
-
// ['organization_type', 'vendor'] -> one_to_many
|
|
271
|
-
// ['vendor', 'vendor_advance'] -> one_to_many
|
|
272
|
-
var _a;
|
|
273
|
-
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.vendorAdvances).filter((vendorAdvance) => !!vendorAdvance).reduce((accumulator, current) => {
|
|
274
|
-
if (!accumulator.some((vendorAdvance) => vendorAdvance.id === current.id)) {
|
|
275
|
-
accumulator.push(current);
|
|
276
|
-
}
|
|
277
|
-
return accumulator;
|
|
278
|
-
}, []);
|
|
279
|
-
}
|
|
280
|
-
get vendorInvoiceAdvances() {
|
|
281
|
-
// one_to_many -> many_to_many mismatch
|
|
282
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->vendor_advance': 'one_to_many', 'vendor_advance->vendor_invoice_advance': 'one_to_many'}
|
|
283
|
-
// ['vendor', 'vendor_advance'] -> one_to_many
|
|
284
|
-
// ['vendor_advance', 'vendor_invoice_advance'] -> one_to_many
|
|
285
|
-
// return this.vendorAdvances
|
|
286
|
-
// ?.flatMap((vendorAdvance) => vendorAdvance.vendorInvoiceAdvances)
|
|
287
|
-
// .filter((vendorInvoiceAdvance): vendorInvoiceAdvance is VendorInvoiceAdvanceEntityModel => !!vendorInvoiceAdvance)
|
|
288
|
-
// .reduce((accumulator: VendorInvoiceAdvanceEntityModel[], current) => {
|
|
289
|
-
// if (!accumulator.some((vendorInvoiceAdvance) => vendorInvoiceAdvance.id === current.id)) {
|
|
290
|
-
// accumulator.push(current);
|
|
291
|
-
// }
|
|
292
|
-
// return accumulator;
|
|
293
|
-
// }, []);
|
|
294
|
-
return undefined;
|
|
295
|
-
}
|
|
296
|
-
get vendorInvoicePayments() {
|
|
297
|
-
// one_to_many -> many_to_many mismatch
|
|
298
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_payment': 'one_to_many'}
|
|
299
|
-
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
300
|
-
// ['vendor_invoice', 'vendor_invoice_payment'] -> one_to_many
|
|
301
|
-
var _a;
|
|
302
|
-
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoicePayments).filter((vendorInvoicePayment) => !!vendorInvoicePayment).reduce((accumulator, current) => {
|
|
303
|
-
if (!accumulator.some((vendorInvoicePayment) => vendorInvoicePayment.id === current.id)) {
|
|
304
|
-
accumulator.push(current);
|
|
305
|
-
}
|
|
306
|
-
return accumulator;
|
|
307
|
-
}, []);
|
|
308
|
-
}
|
|
309
|
-
get vendorTdsLiabilitys() {
|
|
310
|
-
// many_to_many -> many_to_many verified
|
|
311
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->tds_rate': 'many_to_one', 'tds_rate->vendor_tds_liability': 'one_to_many'}
|
|
312
|
-
// ['vendor_tds_challan', 'tds_rate'] -> many_to_one
|
|
313
|
-
// ['tds_rate', 'vendor_tds_liability'] -> one_to_many
|
|
314
|
-
var _a;
|
|
315
|
-
return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.vendorTdsLiabilitys).filter((vendorTdsLiability) => !!vendorTdsLiability).reduce((accumulator, current) => {
|
|
316
|
-
if (!accumulator.some((vendorTdsLiability) => vendorTdsLiability.id === current.id)) {
|
|
317
|
-
accumulator.push(current);
|
|
318
|
-
}
|
|
319
|
-
return accumulator;
|
|
320
|
-
}, []);
|
|
321
|
-
}
|
|
322
|
-
get intermediaryBanks() {
|
|
323
|
-
// many_to_many -> many_to_many verified
|
|
324
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->intermediary_bank': 'one_to_many'}
|
|
325
|
-
// ['client_debit_note', 'bank'] -> many_to_one
|
|
326
|
-
// ['bank', 'intermediary_bank'] -> one_to_many
|
|
327
|
-
var _a;
|
|
328
|
-
return (_a = this.banks) === null || _a === void 0 ? void 0 : _a.flatMap((bank) => bank.intermediaryBanks).filter((intermediaryBank) => !!intermediaryBank).reduce((accumulator, current) => {
|
|
329
|
-
if (!accumulator.some((intermediaryBank) => intermediaryBank.id === current.id)) {
|
|
330
|
-
accumulator.push(current);
|
|
331
|
-
}
|
|
332
|
-
return accumulator;
|
|
333
|
-
}, []);
|
|
334
|
-
}
|
|
335
|
-
get billings() {
|
|
336
|
-
// many_to_many -> many_to_many verified
|
|
337
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->bank': 'many_to_one', 'bank->billing': 'one_to_many'}
|
|
338
|
-
// ['client_debit_note', 'bank'] -> many_to_one
|
|
339
|
-
// ['bank', 'billing'] -> one_to_many
|
|
340
|
-
// return this.banks
|
|
341
|
-
// ?.flatMap((bank) => bank.billings)
|
|
342
|
-
// .filter((billing): billing is BillingEntityModel => !!billing)
|
|
343
|
-
// .reduce((accumulator: BillingEntityModel[], current) => {
|
|
344
|
-
// if (!accumulator.some((billing) => billing.id === current.id)) {
|
|
345
|
-
// accumulator.push(current);
|
|
346
|
-
// }
|
|
347
|
-
// return accumulator;
|
|
348
|
-
// }, []);
|
|
349
|
-
return undefined;
|
|
350
|
-
}
|
|
351
|
-
get clientAffiliates() {
|
|
352
|
-
// many_to_many -> many_to_many verified
|
|
353
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->client_affiliate': 'many_to_one'}
|
|
354
|
-
// ['client', 'client_debit_note'] -> one_to_many
|
|
355
|
-
// ['client_debit_note', 'client_affiliate'] -> many_to_one
|
|
356
|
-
var _a;
|
|
357
|
-
return (_a = this.clientDebitNotes) === null || _a === void 0 ? void 0 : _a.flatMap((clientDebitNote) => clientDebitNote.clientAffiliate).filter((clientAffiliate) => !!clientAffiliate).reduce((accumulator, current) => {
|
|
358
|
-
if (!accumulator.some((clientAffiliate) => clientAffiliate.id === current.id)) {
|
|
359
|
-
accumulator.push(current);
|
|
360
|
-
}
|
|
361
|
-
return accumulator;
|
|
362
|
-
}, []);
|
|
363
|
-
}
|
|
364
|
-
get clientDebitNoteParticularss() {
|
|
365
|
-
// one_to_many -> many_to_many mismatch
|
|
366
|
-
// {'to_do_list->user': 'many_to_one', 'user->client': 'many_to_many', 'client->client_debit_note': 'one_to_many', 'client_debit_note->client_debit_note_particulars': 'one_to_many'}
|
|
367
|
-
// ['client', 'client_debit_note'] -> one_to_many
|
|
368
|
-
// ['client_debit_note', 'client_debit_note_particulars'] -> one_to_many
|
|
369
|
-
var _a;
|
|
370
|
-
return (_a = this.clientDebitNotes) === null || _a === void 0 ? void 0 : _a.flatMap((clientDebitNote) => clientDebitNote.clientDebitNoteParticularss).filter((clientDebitNoteParticulars) => !!clientDebitNoteParticulars).reduce((accumulator, current) => {
|
|
371
|
-
if (!accumulator.some((clientDebitNoteParticulars) => clientDebitNoteParticulars.id === current.id)) {
|
|
372
|
-
accumulator.push(current);
|
|
373
|
-
}
|
|
374
|
-
return accumulator;
|
|
375
|
-
}, []);
|
|
376
|
-
}
|
|
377
|
-
get workFromHomes() {
|
|
378
|
-
// many_to_many -> many_to_many verified
|
|
379
|
-
// {'to_do_list->user': 'many_to_one', 'user->work_from_home': 'one_to_many'}
|
|
380
|
-
// ['to_do_list', 'user'] -> many_to_one
|
|
381
|
-
// ['user', 'work_from_home'] -> one_to_many
|
|
382
|
-
// return this.user?.workFromHomes;
|
|
383
|
-
return undefined;
|
|
33
|
+
return ToDoListEntityModel.relationConfigs;
|
|
384
34
|
}
|
|
385
35
|
getNextStatus(currentUser, action, toDoListFlowConfigContextData) {
|
|
386
36
|
if (!this.status) {
|
|
@@ -419,7 +69,7 @@ class ToDoListEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
419
69
|
if (!hasPermission) {
|
|
420
70
|
throw new exceptions_1.AppBadRequestException({
|
|
421
71
|
key: error_key_enum_1.ErrorKeyEnum.PERMISSION,
|
|
422
|
-
message: [`Current user does not have permission to ${action}
|
|
72
|
+
message: [`Current user does not have permission to ${action} to do list`],
|
|
423
73
|
});
|
|
424
74
|
}
|
|
425
75
|
const nextStatus = matchingPermissionConfig.next(toDoListFlowConfigContextData);
|
|
@@ -445,20 +95,14 @@ exports.ToDoListEntityModel = ToDoListEntityModel;
|
|
|
445
95
|
ToDoListEntityModel.relationConfigs = [
|
|
446
96
|
{
|
|
447
97
|
name: entity_utils_interface_1.EntityEnum.PROJECT,
|
|
448
|
-
relation:
|
|
98
|
+
relation: relation_type_enum_1.RelationType.ONE,
|
|
449
99
|
key: "project",
|
|
450
|
-
mapKeyConfig: {
|
|
451
|
-
relationKey: "id",
|
|
452
|
-
key: "projectId",
|
|
453
|
-
},
|
|
100
|
+
mapKeyConfig: { relationKey: "id", key: "projectId" },
|
|
454
101
|
},
|
|
455
102
|
{
|
|
456
103
|
name: entity_utils_interface_1.EntityEnum.USER,
|
|
457
|
-
relation:
|
|
104
|
+
relation: relation_type_enum_1.RelationType.ONE,
|
|
458
105
|
key: "user",
|
|
459
|
-
mapKeyConfig: {
|
|
460
|
-
relationKey: "id",
|
|
461
|
-
key: "userId",
|
|
462
|
-
},
|
|
106
|
+
mapKeyConfig: { relationKey: "id", key: "userId" },
|
|
463
107
|
},
|
|
464
108
|
];
|
|
@@ -1,3 +1,22 @@
|
|
|
1
1
|
export declare function compareDates(recordDate: string, buffer: number): boolean;
|
|
2
2
|
export declare function epochToDateStringFormat(epoch: number, format?: string): string;
|
|
3
3
|
export declare function convertDateCodeToFormat(dateString: string, toFormat: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* Current calendar date resolved in Asia/Kolkata (IST).
|
|
6
|
+
*
|
|
7
|
+
* TIMEZONE RULE: IST = UTC + 5:30 (fixed offset, no DST).
|
|
8
|
+
* Converting IST -> UTC: subtract 5:30.
|
|
9
|
+
* - If IST time < 05:30 -> UTC date is the PREVIOUS calendar day.
|
|
10
|
+
* - If IST time >= 05:30 -> UTC date is the SAME calendar day.
|
|
11
|
+
*
|
|
12
|
+
* Example: IST 01:00 -> UTC 19:30 (prev day).
|
|
13
|
+
*
|
|
14
|
+
* Why this matters: the production container (node:20.10-alpine) sets no TZ,
|
|
15
|
+
* so it defaults to UTC. A bare `new Date().getDate()` at 01:00 IST would read
|
|
16
|
+
* UTC's date (still "yesterday"), causing classification jobs to target the
|
|
17
|
+
* wrong day or silently miss their trigger window.
|
|
18
|
+
*
|
|
19
|
+
* This function returns a Date whose local getFullYear()/getMonth()/getDate()
|
|
20
|
+
* always equal the IST calendar date, regardless of container timezone.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getTodayInIST(): Date;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.compareDates = compareDates;
|
|
4
4
|
exports.epochToDateStringFormat = epochToDateStringFormat;
|
|
5
5
|
exports.convertDateCodeToFormat = convertDateCodeToFormat;
|
|
6
|
+
exports.getTodayInIST = getTodayInIST;
|
|
6
7
|
const date_fns_1 = require("date-fns");
|
|
7
8
|
const date_code_model_util_1 = require("./models/date-code.model.util");
|
|
8
9
|
function compareDates(recordDate, buffer) {
|
|
@@ -16,3 +17,31 @@ function convertDateCodeToFormat(dateString, toFormat) {
|
|
|
16
17
|
const dateObj = new date_code_model_util_1.DateCodeModel(dateString);
|
|
17
18
|
return dateObj.toStringFormat(toFormat);
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Current calendar date resolved in Asia/Kolkata (IST).
|
|
22
|
+
*
|
|
23
|
+
* TIMEZONE RULE: IST = UTC + 5:30 (fixed offset, no DST).
|
|
24
|
+
* Converting IST -> UTC: subtract 5:30.
|
|
25
|
+
* - If IST time < 05:30 -> UTC date is the PREVIOUS calendar day.
|
|
26
|
+
* - If IST time >= 05:30 -> UTC date is the SAME calendar day.
|
|
27
|
+
*
|
|
28
|
+
* Example: IST 01:00 -> UTC 19:30 (prev day).
|
|
29
|
+
*
|
|
30
|
+
* Why this matters: the production container (node:20.10-alpine) sets no TZ,
|
|
31
|
+
* so it defaults to UTC. A bare `new Date().getDate()` at 01:00 IST would read
|
|
32
|
+
* UTC's date (still "yesterday"), causing classification jobs to target the
|
|
33
|
+
* wrong day or silently miss their trigger window.
|
|
34
|
+
*
|
|
35
|
+
* This function returns a Date whose local getFullYear()/getMonth()/getDate()
|
|
36
|
+
* always equal the IST calendar date, regardless of container timezone.
|
|
37
|
+
*/
|
|
38
|
+
function getTodayInIST() {
|
|
39
|
+
const parts = new Intl.DateTimeFormat("en-GB", {
|
|
40
|
+
timeZone: "Asia/Kolkata",
|
|
41
|
+
year: "numeric",
|
|
42
|
+
month: "numeric",
|
|
43
|
+
day: "numeric",
|
|
44
|
+
}).formatToParts(new Date());
|
|
45
|
+
const get = (type) => { var _a, _b; return Number((_b = (_a = parts.find((part) => part.type === type)) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0); };
|
|
46
|
+
return new Date(get("year"), get("month") - 1, get("day"));
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* api/v1 - FROZEN legacy contracts.
|
|
3
|
-
*
|
|
4
|
-
* Interfaces here serve routes that outlive the flow migration. They are hand-written and the
|
|
5
|
-
* generator never writes to this directory (checklist 12.4). An entity appears either in
|
|
6
|
-
* api/interface/ or in v1 + v2 - never both.
|
|
7
|
-
*/
|
|
8
|
-
export * from "./interface/to_do_list.create.dto.interface";
|
|
9
|
-
export * from "./interface/to_do_list.update.dto.interface";
|
package/dist/src/api/v1/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
/**
|
|
18
|
-
* api/v1 - FROZEN legacy contracts.
|
|
19
|
-
*
|
|
20
|
-
* Interfaces here serve routes that outlive the flow migration. They are hand-written and the
|
|
21
|
-
* generator never writes to this directory (checklist 12.4). An entity appears either in
|
|
22
|
-
* api/interface/ or in v1 + v2 - never both.
|
|
23
|
-
*/
|
|
24
|
-
__exportStar(require("./interface/to_do_list.create.dto.interface"), exports);
|
|
25
|
-
__exportStar(require("./interface/to_do_list.update.dto.interface"), exports);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* api/v2 - the new flow contracts.
|
|
3
|
-
*
|
|
4
|
-
* Intentionally empty: to_do_list's v2 create/update DTO interfaces are generated, not hand-written,
|
|
5
|
-
* and have not been generated yet. The generator writes them to api/v2/interface/ (checklist 12.4,
|
|
6
|
-
* and 9.1 rows 4 and 7).
|
|
7
|
-
*
|
|
8
|
-
* The empty export keeps this a module so `export * as v2` in api/index.ts resolves.
|
|
9
|
-
*/
|
|
10
|
-
export * from "./interface/to_do_list.create.dto.interface";
|
|
11
|
-
export * from "./interface/to_do_list.update.dto.interface";
|
package/dist/src/api/v2/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* api/v2 - the new flow contracts.
|
|
4
|
-
*
|
|
5
|
-
* Intentionally empty: to_do_list's v2 create/update DTO interfaces are generated, not hand-written,
|
|
6
|
-
* and have not been generated yet. The generator writes them to api/v2/interface/ (checklist 12.4,
|
|
7
|
-
* and 9.1 rows 4 and 7).
|
|
8
|
-
*
|
|
9
|
-
* The empty export keeps this a module so `export * as v2` in api/index.ts resolves.
|
|
10
|
-
*/
|
|
11
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
-
if (k2 === undefined) k2 = k;
|
|
13
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
-
}
|
|
17
|
-
Object.defineProperty(o, k2, desc);
|
|
18
|
-
}) : (function(o, m, k, k2) {
|
|
19
|
-
if (k2 === undefined) k2 = k;
|
|
20
|
-
o[k2] = m[k];
|
|
21
|
-
}));
|
|
22
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
23
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
// export {
|
|
27
|
-
// };
|
|
28
|
-
__exportStar(require("./interface/to_do_list.create.dto.interface"), exports);
|
|
29
|
-
__exportStar(require("./interface/to_do_list.update.dto.interface"), exports);
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { IEntityCreateDto } from "../../../entities";
|
|
2
|
-
import { IToDoListEntity } from "../../../entities/interface/to_do_list.entity.interface";
|
|
3
|
-
export type IToDoListCreateExclude = "status";
|
|
4
|
-
export interface IToDoListCreateDto extends Omit<IEntityCreateDto<IToDoListEntity>, IToDoListCreateExclude> {
|
|
5
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DeepPartialButRequired } from "../../interface/api.utils.interface";
|
|
2
|
-
import { ToDoListActionEnum } from "../../../entities";
|
|
3
|
-
import { IToDoListCreateDto } from "./to_do_list.create.dto.interface";
|
|
4
|
-
export type IToDoListUpdateDto = DeepPartialButRequired<IToDoListCreateDto, never> & {
|
|
5
|
-
actionData: IToDoListActionDataDto;
|
|
6
|
-
} & {
|
|
7
|
-
id?: number;
|
|
8
|
-
};
|
|
9
|
-
export interface IToDoListActionDataDto {
|
|
10
|
-
action: ToDoListActionEnum;
|
|
11
|
-
remark?: string;
|
|
12
|
-
}
|
|
File without changes
|
|
File without changes
|