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
|
@@ -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, {
|