law-common 12.8.1-beta.21 → 12.8.1-beta.22
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/constants/constants.js +1 -1
- package/dist/src/entities/interface/entity.utils.interface.d.ts +5 -2
- package/dist/src/entities/model/entity_history.entity.model.d.ts +7 -4
- package/dist/src/entities/model/entity_history.entity.model.js +117 -3
- package/dist/src/entities/model/timesheet.entity.model.d.ts +8 -1
- package/dist/src/entities/model/timesheet.entity.model.js +20 -3
- package/package.json +1 -1
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDefaultHistoryKeysToExclude = getDefaultHistoryKeysToExclude;
|
|
4
4
|
function getDefaultHistoryKeysToExclude() {
|
|
5
|
-
return ["createdOn", "updatedOn", "createdBy", "updatedBy"];
|
|
5
|
+
return ["id", "createdOn", "updatedOn", "createdBy", "updatedBy"];
|
|
6
6
|
}
|
|
@@ -81,6 +81,7 @@ import { WebsiteLeadEntityModel } from "../model/website_lead.entity.model";
|
|
|
81
81
|
import { WebsiteNewsletterSubscriptionEntityModel } from "../model/website_newsletter_subscription.entity.model";
|
|
82
82
|
import { WorkFromHomeHistoryEntityModel } from "../model/work_from_home_history.entity.model";
|
|
83
83
|
import { BillingParticularLineItemEntityModel } from "../model/billing-particular-line-item.entity.model";
|
|
84
|
+
import { WorkFromHomeEntityModel } from "../model/work_from_home.entity.model";
|
|
84
85
|
import { IAddressBookEntity } from "./address-book.entity.interface";
|
|
85
86
|
import { AggregationFields, IEntityAggregationConfig } from "./aggregation.utils";
|
|
86
87
|
import { IBankEntity } from "./bank.entity.interface";
|
|
@@ -90,6 +91,7 @@ import { IBillingReimbursementExpenseEntity } from "./billing-reimbursement-expe
|
|
|
90
91
|
import { IBillingTransactionHistoryEntity } from "./billing-transaction-history.entity";
|
|
91
92
|
import { IBillingEntity } from "./billing.entity.interface";
|
|
92
93
|
import { IBillingHistoryEntity } from "./billing_history.entity.interface";
|
|
94
|
+
import { IBillingParticularLineItemEntity } from "./billing_particular_line_item.entity.interface";
|
|
93
95
|
import { IBillingProfileEntity } from "./billing_profile.entity.interface";
|
|
94
96
|
import { IBillingTimesheetEntity } from "./billing_timesheet.entity.interface";
|
|
95
97
|
import { IBillingTimesheetHistoryEntity } from "./billing_timesheet_history.entity.interface";
|
|
@@ -156,8 +158,6 @@ import { IWebsiteLeadEntity } from "./website_lead.entity.interface";
|
|
|
156
158
|
import { IWebsiteNewsletterSubscriptionEntity } from "./website_newsletter_subscription.entity.interface";
|
|
157
159
|
import { IWorkFromHomeEntity } from "./work_from_home.entity.interface";
|
|
158
160
|
import { IWorkFromHomeHistoryEntity } from "./work_from_home_history.entity.interface";
|
|
159
|
-
import { IBillingParticularLineItemEntity } from "./billing_particular_line_item.entity.interface";
|
|
160
|
-
import { WorkFromHomeEntityModel } from "../model/work_from_home.entity.model";
|
|
161
161
|
export type IApiEntity<T> = Modify<T, {
|
|
162
162
|
createdOn: string;
|
|
163
163
|
updatedOn: string;
|
|
@@ -458,3 +458,6 @@ export type IPremissionFilterConfig<T extends EntityEnum | VirtualEntityEnum> =
|
|
|
458
458
|
* @template T - The underlying value type.
|
|
459
459
|
*/
|
|
460
460
|
export type Nullable<T> = T | null;
|
|
461
|
+
export type HistoryExcludedColumns = {
|
|
462
|
+
[K in EntityEnum]?: (keyof EnumEntityType<K>)[];
|
|
463
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
2
|
-
import { BaseEntityModel } from "./base.entity.model";
|
|
3
2
|
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
4
3
|
import { IUserEntity } from "../interface/user.entity.interface";
|
|
5
|
-
import {
|
|
4
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
6
5
|
import { IRowActions } from "./interface/row-actions.interface";
|
|
7
|
-
import {
|
|
6
|
+
import { UserEntityModel } from "./user.entity.model";
|
|
7
|
+
import { EntityHistoryActionEnum } from "../enums/entity_history_action.enum";
|
|
8
8
|
import { EntityHistoryOperationEnum } from "../enums/entity_history_operation_enum";
|
|
9
9
|
import { EntityHistoryStatusEnum } from "../enums/entity_history_status_enum";
|
|
10
|
-
import { EntityHistoryActionEnum } from "../enums/entity_history_action.enum";
|
|
11
10
|
import { IEntityHistoryFlowConfigContextData } from "../flow-configs/entity_history_flow.config";
|
|
11
|
+
import { IEntityHistoryEntity } from "../interface/entity_history.entity.interface";
|
|
12
12
|
export declare class EntityHistoryEntityModel extends BaseEntityModel<EntityEnum.ENTITY_HISTORY> implements IEntityHistoryEntity {
|
|
13
13
|
id: number;
|
|
14
14
|
entity: string;
|
|
@@ -22,6 +22,7 @@ export declare class EntityHistoryEntityModel extends BaseEntityModel<EntityEnum
|
|
|
22
22
|
updatedBy: number;
|
|
23
23
|
static relationConfigs: RelationConfigs<[], EntityEnum.ENTITY_HISTORY>;
|
|
24
24
|
static fromEntity(entity: IEntityHistoryEntity): EntityHistoryEntityModel;
|
|
25
|
+
static operationToStatus(operation: EntityHistoryOperationEnum): EntityHistoryStatusEnum;
|
|
25
26
|
getRelationConfigs(): any[];
|
|
26
27
|
getNextStatus(currentUser: IUserEntity, action: EntityHistoryActionEnum, entityHistoryFlowConfigContextData: IEntityHistoryFlowConfigContextData): EntityHistoryStatusEnum;
|
|
27
28
|
getAvailableActions(currentUser: UserEntityModel, config?: {
|
|
@@ -34,4 +35,6 @@ export declare class EntityHistoryEntityModel extends BaseEntityModel<EntityEnum
|
|
|
34
35
|
getUpdateActionVisibility(currentUser: UserEntityModel): {
|
|
35
36
|
[key: string]: () => boolean;
|
|
36
37
|
};
|
|
38
|
+
get entityStatus(): any;
|
|
39
|
+
static getExcludedColumnsForHistory(entityName: EntityEnum): string[];
|
|
37
40
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EntityHistoryEntityModel = void 0;
|
|
4
|
-
const
|
|
5
|
-
const base_entity_model_1 = require("./base.entity.model");
|
|
6
|
-
const exceptions_1 = require("../../exceptions");
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
7
5
|
const error_key_enum_1 = require("../../enums/error.key.enum");
|
|
6
|
+
const exceptions_1 = require("../../exceptions");
|
|
8
7
|
const utils_1 = require("../../utils");
|
|
8
|
+
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
9
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
9
10
|
const entity_history_operation_enum_1 = require("../enums/entity_history_operation_enum");
|
|
10
11
|
const entity_history_status_enum_1 = require("../enums/entity_history_status_enum");
|
|
11
12
|
const entity_history_flow_config_1 = require("../flow-configs/entity_history_flow.config");
|
|
@@ -28,6 +29,15 @@ class EntityHistoryEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
28
29
|
Object.assign(result, entity);
|
|
29
30
|
return result;
|
|
30
31
|
}
|
|
32
|
+
static operationToStatus(operation) {
|
|
33
|
+
const map = {
|
|
34
|
+
[entity_history_operation_enum_1.EntityHistoryOperationEnum.CREATE]: entity_history_status_enum_1.EntityHistoryStatusEnum.CREATED,
|
|
35
|
+
// only CREATED status set as operation will only be for create
|
|
36
|
+
[entity_history_operation_enum_1.EntityHistoryOperationEnum.UPDATE]: entity_history_status_enum_1.EntityHistoryStatusEnum.CREATED,
|
|
37
|
+
[entity_history_operation_enum_1.EntityHistoryOperationEnum.DELETE]: entity_history_status_enum_1.EntityHistoryStatusEnum.CREATED,
|
|
38
|
+
};
|
|
39
|
+
return map[operation];
|
|
40
|
+
}
|
|
31
41
|
getRelationConfigs() {
|
|
32
42
|
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
33
43
|
}
|
|
@@ -89,6 +99,110 @@ class EntityHistoryEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
89
99
|
getUpdateActionVisibility(currentUser) {
|
|
90
100
|
return {};
|
|
91
101
|
}
|
|
102
|
+
get entityStatus() {
|
|
103
|
+
try {
|
|
104
|
+
const parsedData = JSON.parse(this.data);
|
|
105
|
+
return parsedData === null || parsedData === void 0 ? void 0 : parsedData.status;
|
|
106
|
+
}
|
|
107
|
+
catch (_a) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
static getExcludedColumnsForHistory(entityName) {
|
|
112
|
+
var _a;
|
|
113
|
+
const exclusions = {
|
|
114
|
+
// Billing
|
|
115
|
+
[entity_utils_interface_1.EntityEnum.BILLING]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
116
|
+
[entity_utils_interface_1.EntityEnum.BILLING_TIMESHEET]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
117
|
+
[entity_utils_interface_1.EntityEnum.BILLING_REIMBURSEMENT_EXPENSE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
118
|
+
[entity_utils_interface_1.EntityEnum.BILLING_TRANSACTION]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
119
|
+
[entity_utils_interface_1.EntityEnum.BILLING_PARTICULAR_LINE_ITEM]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
120
|
+
[entity_utils_interface_1.EntityEnum.BILLING_PROFILE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
121
|
+
// Client
|
|
122
|
+
[entity_utils_interface_1.EntityEnum.CLIENT_DEBIT_NOTE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
123
|
+
[entity_utils_interface_1.EntityEnum.CLIENT_DEBIT_NOTE_PARTICULARS]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
124
|
+
[entity_utils_interface_1.EntityEnum.CLIENT_QUOTE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
125
|
+
[entity_utils_interface_1.EntityEnum.CLIENT_QUOTE_RATE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
126
|
+
// Timesheet
|
|
127
|
+
[entity_utils_interface_1.EntityEnum.TIMESHEET]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
128
|
+
[entity_utils_interface_1.EntityEnum.MOVING_TIMESHEET]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
129
|
+
[entity_utils_interface_1.EntityEnum.TASK]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
130
|
+
[entity_utils_interface_1.EntityEnum.RATE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
131
|
+
[entity_utils_interface_1.EntityEnum.DESIGNATION]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
132
|
+
[entity_utils_interface_1.EntityEnum.PROJECT_REVENUE_SPLIT_MAPPING]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
133
|
+
// Leave
|
|
134
|
+
[entity_utils_interface_1.EntityEnum.LEAVE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
135
|
+
[entity_utils_interface_1.EntityEnum.LEAVE_APPROVAL]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
136
|
+
// Reimbursement
|
|
137
|
+
[entity_utils_interface_1.EntityEnum.REIMBURSEMENT]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
138
|
+
[entity_utils_interface_1.EntityEnum.REIMBURSEMENT_EXPENSE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
139
|
+
[entity_utils_interface_1.EntityEnum.WORK_FROM_HOME]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
140
|
+
// Bank
|
|
141
|
+
[entity_utils_interface_1.EntityEnum.BANK]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
142
|
+
[entity_utils_interface_1.EntityEnum.INTERMEDIARY_BANK]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
143
|
+
// Vendor
|
|
144
|
+
[entity_utils_interface_1.EntityEnum.VENDOR]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
145
|
+
[entity_utils_interface_1.EntityEnum.VENDOR_INVOICE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
146
|
+
[entity_utils_interface_1.EntityEnum.VENDOR_INVOICE_ITEM]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
147
|
+
[entity_utils_interface_1.EntityEnum.VENDOR_TDS_LIABILITY]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
148
|
+
[entity_utils_interface_1.EntityEnum.VENDOR_TDS_CHALLAN]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
149
|
+
[entity_utils_interface_1.EntityEnum.VENDOR_ADVANCE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
150
|
+
[entity_utils_interface_1.EntityEnum.VENDOR_INVOICE_ADVANCE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
151
|
+
[entity_utils_interface_1.EntityEnum.VENDOR_INVOICE_PAYMENT]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
152
|
+
// Core entities
|
|
153
|
+
[entity_utils_interface_1.EntityEnum.USER]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
154
|
+
[entity_utils_interface_1.EntityEnum.PROJECT]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
155
|
+
[entity_utils_interface_1.EntityEnum.CLIENT]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
156
|
+
[entity_utils_interface_1.EntityEnum.ORGANIZATION]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
157
|
+
[entity_utils_interface_1.EntityEnum.ADDRESS_BOOK]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
158
|
+
// Lookup / config entities
|
|
159
|
+
[entity_utils_interface_1.EntityEnum.COUNTRY]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
160
|
+
[entity_utils_interface_1.EntityEnum.STATE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
161
|
+
[entity_utils_interface_1.EntityEnum.INDUSTRY]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
162
|
+
[entity_utils_interface_1.EntityEnum.EXPENSE_TYPE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
163
|
+
[entity_utils_interface_1.EntityEnum.HOLIDAY]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
164
|
+
[entity_utils_interface_1.EntityEnum.HOLIDAY_LIST]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
165
|
+
[entity_utils_interface_1.EntityEnum.GST_RATE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
166
|
+
[entity_utils_interface_1.EntityEnum.ORGANIZATION_TYPE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
167
|
+
[entity_utils_interface_1.EntityEnum.TDS_RATE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
168
|
+
[entity_utils_interface_1.EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
169
|
+
[entity_utils_interface_1.EntityEnum.VOUCHER_TYPE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
170
|
+
[entity_utils_interface_1.EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
171
|
+
[entity_utils_interface_1.EntityEnum.EXPENSE_HEAD]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
172
|
+
[entity_utils_interface_1.EntityEnum.DOCUMENT_UPLOAD]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
173
|
+
// Mapping entities
|
|
174
|
+
[entity_utils_interface_1.EntityEnum.PROJECT_USER_MAPPING]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
175
|
+
[entity_utils_interface_1.EntityEnum.CLIENT_USER_MAPPING]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
176
|
+
[entity_utils_interface_1.EntityEnum.CLIENT_INTRODUCING_MAPPING]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
177
|
+
[entity_utils_interface_1.EntityEnum.ROLE_PERMISSION_MAPPING]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
178
|
+
[entity_utils_interface_1.EntityEnum.CLIENT_AFFILIATE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
179
|
+
// System entities
|
|
180
|
+
[entity_utils_interface_1.EntityEnum.CONFIGURATION]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
181
|
+
[entity_utils_interface_1.EntityEnum.PERMISSION]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
182
|
+
[entity_utils_interface_1.EntityEnum.ROLE]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
183
|
+
[entity_utils_interface_1.EntityEnum.OFFICE_LOCATION]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
184
|
+
[entity_utils_interface_1.EntityEnum.CRON_JOBS]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
185
|
+
[entity_utils_interface_1.EntityEnum.TO_DO_LIST]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
186
|
+
// Website
|
|
187
|
+
[entity_utils_interface_1.EntityEnum.WEBSITE_LEAD]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
188
|
+
[entity_utils_interface_1.EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION]: (0, constants_1.getDefaultHistoryKeysToExclude)(),
|
|
189
|
+
// Individual history entities — excluded because history is never created for history records.
|
|
190
|
+
// These are legacy tables being deprecated in favor of the unified entity_history table.
|
|
191
|
+
// [EntityEnum.BILLING_HISTORY]: getDefaultHistoryKeysToExclude(),
|
|
192
|
+
// [EntityEnum.BILLING_TIMESHEET_HISTORY]: getDefaultHistoryKeysToExclude(),
|
|
193
|
+
// [EntityEnum.BILLING_REIMBURESMENT_EXPENSE_HISTORY]: getDefaultHistoryKeysToExclude(),
|
|
194
|
+
// [EntityEnum.TIMESHEET_HISTORY]: getDefaultHistoryKeysToExclude(),
|
|
195
|
+
// [EntityEnum.REIMBURSEMENT_HISTORY]: getDefaultHistoryKeysToExclude(),
|
|
196
|
+
// [EntityEnum.WORK_FROM_HOME_HISTORY]: getDefaultHistoryKeysToExclude(),
|
|
197
|
+
// [EntityEnum.LEAVE_HISTORY]: getDefaultHistoryKeysToExclude(),
|
|
198
|
+
// [EntityEnum.BANK_HISTORY]: getDefaultHistoryKeysToExclude(),
|
|
199
|
+
// [EntityEnum.BILLING_TRANSACTION_HISTORY]: getDefaultHistoryKeysToExclude(),
|
|
200
|
+
// [EntityEnum.VENDOR_INVOICE_HISTORY]: getDefaultHistoryKeysToExclude(),
|
|
201
|
+
// [EntityEnum.VENDOR_INVOICE_ITEM_HISTORY]: getDefaultHistoryKeysToExclude(),
|
|
202
|
+
// [EntityEnum.VENDOR_HISTORY]: getDefaultHistoryKeysToExclude(),
|
|
203
|
+
};
|
|
204
|
+
return (_a = exclusions[entityName]) !== null && _a !== void 0 ? _a : (0, constants_1.getDefaultHistoryKeysToExclude)();
|
|
205
|
+
}
|
|
92
206
|
}
|
|
93
207
|
exports.EntityHistoryEntityModel = EntityHistoryEntityModel;
|
|
94
208
|
EntityHistoryEntityModel.relationConfigs = [];
|
|
@@ -6,6 +6,7 @@ import { EntityEnum, Nullable } from "../interface/entity.utils.interface";
|
|
|
6
6
|
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
7
7
|
import { ITimesheetEntity } from "../interface/timesheet.entity.interface";
|
|
8
8
|
import { BaseEntityModel } from "./base.entity.model";
|
|
9
|
+
import { EntityHistoryEntityModel } from "./entity_history.entity.model";
|
|
9
10
|
import { ProjectEntityModel } from "./project.entity.model";
|
|
10
11
|
import { TimesheetHistoryEntityModel } from "./timesheet_history.entity.model";
|
|
11
12
|
import { UserEntityModel } from "./user.entity.model";
|
|
@@ -45,9 +46,15 @@ export declare class TimesheetEntityModel extends BaseEntityModel<EntityEnum.TIM
|
|
|
45
46
|
user?: UserEntityModel;
|
|
46
47
|
history?: TimesheetHistoryEntityModel[];
|
|
47
48
|
project?: ProjectEntityModel;
|
|
49
|
+
entityHistory?: EntityHistoryEntityModel[];
|
|
48
50
|
static fromEntity(entity: ITimesheetEntity): TimesheetEntityModel;
|
|
49
51
|
getRelationConfigs(): any[];
|
|
50
|
-
static relationConfigs: RelationConfigs<[
|
|
52
|
+
static relationConfigs: RelationConfigs<[
|
|
53
|
+
EntityEnum.USER,
|
|
54
|
+
EntityEnum.TIMESHEET_HISTORY,
|
|
55
|
+
EntityEnum.ENTITY_HISTORY,
|
|
56
|
+
EntityEnum.PROJECT
|
|
57
|
+
], EntityEnum.TIMESHEET>;
|
|
51
58
|
getTimesheetAmount(projectCurrency: CurrencyEnum): number;
|
|
52
59
|
get formattedDate(): string;
|
|
53
60
|
get userName(): string | undefined;
|
|
@@ -50,9 +50,17 @@ class TimesheetEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
50
50
|
return (_c = (_b = (_a = this.project) === null || _a === void 0 ? void 0 : _a.partnersOwnerUsersOfProject) === null || _b === void 0 ? void 0 : _b.filter((u) => u.email)) !== null && _c !== void 0 ? _c : [];
|
|
51
51
|
}
|
|
52
52
|
get latestStatusFromHistory() {
|
|
53
|
-
|
|
54
|
-
const sorted = [...(this.
|
|
55
|
-
return
|
|
53
|
+
// const sorted = [...(this.history || [])].sort((a, b) => b.id - a.id);
|
|
54
|
+
// const sorted = [...(this.entityHistory || [])].sort((a, b) => b.id - a.id);
|
|
55
|
+
// return sorted[1]?.entityStatus;
|
|
56
|
+
const sorted = [...(this.entityHistory || [])].sort((a, b) => b.id - a.id);
|
|
57
|
+
for (const historyModel of sorted) {
|
|
58
|
+
const status = historyModel.entityStatus;
|
|
59
|
+
if (status && status !== timesheet_status_enum_1.TimesheetStatusEnum.MOVING_TIMESHEET_PENDING_APPROVAL) {
|
|
60
|
+
return status;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
56
64
|
}
|
|
57
65
|
// get latestStatusFromHistory(): TimesheetStatusEnum | undefined {
|
|
58
66
|
// const allHistoryModelSortedByIdInDesc = [...(this.history || [])].sort((a, b) => b.id - a.id);
|
|
@@ -195,6 +203,15 @@ TimesheetEntityModel.relationConfigs = [
|
|
|
195
203
|
key: "id",
|
|
196
204
|
},
|
|
197
205
|
},
|
|
206
|
+
{
|
|
207
|
+
name: entity_utils_interface_1.EntityEnum.ENTITY_HISTORY,
|
|
208
|
+
relation: relation_type_enum_1.RelationType.MANY,
|
|
209
|
+
key: "entityHistory",
|
|
210
|
+
mapKeyConfig: {
|
|
211
|
+
relationKey: "entityId",
|
|
212
|
+
key: "id",
|
|
213
|
+
},
|
|
214
|
+
},
|
|
198
215
|
{
|
|
199
216
|
name: entity_utils_interface_1.EntityEnum.PROJECT,
|
|
200
217
|
relation: relation_type_enum_1.RelationType.ONE,
|