law-common 14.0.10-beta.2 → 14.0.10-beta.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/dist/src/api/index.d.ts +4 -0
- package/dist/src/api/index.js +21 -7
- 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/{v1/interface → interface}/office_location.create.dto.interface.d.ts +1 -1
- package/dist/src/api/{v1/interface → interface}/office_location.update.dto.interface.d.ts +1 -1
- package/dist/src/api/v1/index.d.ts +0 -4
- package/dist/src/api/v1/index.js +0 -4
- package/dist/src/api/v2/index.d.ts +0 -4
- package/dist/src/api/v2/index.js +0 -4
- package/dist/src/entities/enums/permission_group_enum.d.ts +24 -0
- package/dist/src/entities/enums/permission_group_enum.js +49 -0
- package/dist/src/entities/flow-configs/base-flow-config.factory.d.ts +8 -0
- package/dist/src/entities/flow-configs/base-flow-config.factory.js +1 -75
- 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 +11 -0
- package/dist/src/entities/flow-configs/work_from_home_flow.config.js +9 -0
- package/dist/src/entities/index.d.ts +2 -2
- package/dist/src/entities/index.js +2 -2
- package/dist/src/entities/interface/expense_type.entity.interface.d.ts +2 -3
- package/dist/src/entities/interface/field-constraint/expense_type_field_constraints.interface.d.ts +8 -0
- package/dist/src/entities/interface/field-constraint/office_location_field_constraints.interface.d.ts +9 -0
- package/dist/src/entities/interface/field-constraint/office_location_field_constraints.interface.js +13 -4
- package/dist/src/entities/interface/field-constraint/permission_field_constraints.interface.js +8 -0
- package/dist/src/entities/interface/permission.entity.interface.d.ts +8 -0
- package/dist/src/entities/model/base.entity.model.js +17 -7
- 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/office_location.entity.model.d.ts +8 -64
- package/dist/src/entities/model/office_location.entity.model.js +6 -393
- package/dist/src/entities/model/permission.entity.model.d.ts +12 -0
- package/dist/src/entities/model/permission.entity.model.js +48 -0
- package/dist/src/enums/error.key.enum.d.ts +3 -1
- package/dist/src/enums/error.key.enum.js +2 -0
- package/dist/src/index.js +17 -7
- package/dist/src/utils/helper.fn.util.d.ts +2 -2
- package/package.json +1 -1
- 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/office_location.create.dto.interface.d.ts +0 -15
- package/dist/src/api/v2/interface/office_location.create.dto.interface.js +0 -2
- package/dist/src/api/v2/interface/office_location.update.dto.interface.d.ts +0 -13
- package/dist/src/api/v2/interface/office_location.update.dto.interface.js +0 -2
- package/dist/src/entities/interface/field-constraint/office_location_address_field_constraints.interface.d.ts +0 -13
- package/dist/src/entities/interface/field-constraint/office_location_address_field_constraints.interface.js +0 -17
- /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}/office_location.create.dto.interface.js +0 -0
- /package/dist/src/api/{v1/interface → interface}/office_location.update.dto.interface.js +0 -0
- /package/dist/src/entities/enums/{expense_type_enum.d.ts → expense_type_entity_enum.d.ts} +0 -0
- /package/dist/src/entities/enums/{expense_type_enum.js → expense_type_entity_enum.js} +0 -0
package/dist/src/api/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export * from "./interface/reimbursement_expense.update.dto.interface";
|
|
|
20
20
|
export * from "./interface/billing_reimbursement_expense.create.dto.interface";
|
|
21
21
|
export * from "./interface/billing_reimbursement_expense.filter.dto.interface";
|
|
22
22
|
export * from "./interface/billing_reimbursement_expense.update.dto.interface";
|
|
23
|
+
export * from "./interface/expense_type.create.dto.interface";
|
|
24
|
+
export * from "./interface/expense_type.update.dto.interface";
|
|
23
25
|
export * from "./interface/expense_type.entity.response";
|
|
24
26
|
export * from "./interface/billing.create.dto.interface";
|
|
25
27
|
export * from "./interface/billing_particular_line_item.create.dto.interface";
|
|
@@ -35,8 +37,10 @@ export * from "./interface/billing_timesheet.details.dto.interface";
|
|
|
35
37
|
export * from "./interface/billing_timesheet.filter.dto.interface";
|
|
36
38
|
export * from "./interface/billing_timesheet.update.dto.interface";
|
|
37
39
|
export * from "./interface/billing.entity.response";
|
|
40
|
+
export * from "./interface/office_location.create.dto.interface";
|
|
38
41
|
export * from "./interface/office_location.entity.response";
|
|
39
42
|
export * from "./interface/office_location.filter.dto.interface";
|
|
43
|
+
export * from "./interface/office_location.update.dto.interface";
|
|
40
44
|
export * from "./interface/organization.filter.dto.interface";
|
|
41
45
|
export * from "./interface/billing.update.dto.interface";
|
|
42
46
|
export * from "./interface/moving_timesheet.create.dto.interface";
|
package/dist/src/api/index.js
CHANGED
|
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
20
|
};
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
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
|
+
})();
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
39
|
exports.v2 = exports.v1 = void 0;
|
|
30
40
|
__exportStar(require("./interface/base.response.interface"), exports);
|
|
@@ -49,6 +59,8 @@ __exportStar(require("./interface/reimbursement_expense.update.dto.interface"),
|
|
|
49
59
|
__exportStar(require("./interface/billing_reimbursement_expense.create.dto.interface"), exports);
|
|
50
60
|
__exportStar(require("./interface/billing_reimbursement_expense.filter.dto.interface"), exports);
|
|
51
61
|
__exportStar(require("./interface/billing_reimbursement_expense.update.dto.interface"), exports);
|
|
62
|
+
__exportStar(require("./interface/expense_type.create.dto.interface"), exports);
|
|
63
|
+
__exportStar(require("./interface/expense_type.update.dto.interface"), exports);
|
|
52
64
|
__exportStar(require("./interface/expense_type.entity.response"), exports);
|
|
53
65
|
__exportStar(require("./interface/billing.create.dto.interface"), exports);
|
|
54
66
|
__exportStar(require("./interface/billing_particular_line_item.create.dto.interface"), exports);
|
|
@@ -64,8 +76,10 @@ __exportStar(require("./interface/billing_timesheet.details.dto.interface"), exp
|
|
|
64
76
|
__exportStar(require("./interface/billing_timesheet.filter.dto.interface"), exports);
|
|
65
77
|
__exportStar(require("./interface/billing_timesheet.update.dto.interface"), exports);
|
|
66
78
|
__exportStar(require("./interface/billing.entity.response"), exports);
|
|
79
|
+
__exportStar(require("./interface/office_location.create.dto.interface"), exports);
|
|
67
80
|
__exportStar(require("./interface/office_location.entity.response"), exports);
|
|
68
81
|
__exportStar(require("./interface/office_location.filter.dto.interface"), exports);
|
|
82
|
+
__exportStar(require("./interface/office_location.update.dto.interface"), exports);
|
|
69
83
|
__exportStar(require("./interface/organization.filter.dto.interface"), exports);
|
|
70
84
|
__exportStar(require("./interface/billing.update.dto.interface"), exports);
|
|
71
85
|
__exportStar(require("./interface/moving_timesheet.create.dto.interface"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IEntityCreateDto, IOfficeLocationEntity } from "
|
|
1
|
+
import { IEntityCreateDto, IOfficeLocationEntity } from "../../entities";
|
|
2
2
|
/** status is set by the entity flow, never by the client */
|
|
3
3
|
export type IOfficeLocationCreateExclude = "status";
|
|
4
4
|
export interface IOfficeLocationCreateDto extends Omit<IEntityCreateDto<IOfficeLocationEntity>, IOfficeLocationCreateExclude> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IEntityUpdateDto, IOfficeLocationEntity } from "
|
|
1
|
+
import { IEntityUpdateDto, IOfficeLocationEntity } from "../../entities";
|
|
2
2
|
import { IOfficeLocationCreateExclude } from "./office_location.create.dto.interface";
|
|
3
3
|
export interface IOfficeLocationUpdateDto extends Omit<IEntityUpdateDto<IOfficeLocationEntity>, IOfficeLocationCreateExclude> {
|
|
4
4
|
}
|
|
@@ -5,9 +5,5 @@
|
|
|
5
5
|
* generator never writes to this directory (checklist 12.4). An entity appears either in
|
|
6
6
|
* api/interface/ or in v1 + v2 - never both.
|
|
7
7
|
*/
|
|
8
|
-
export * from "./interface/expense_type.create.dto.interface";
|
|
9
|
-
export * from "./interface/expense_type.update.dto.interface";
|
|
10
|
-
export * from "./interface/office_location.create.dto.interface";
|
|
11
|
-
export * from "./interface/office_location.update.dto.interface";
|
|
12
8
|
export * from "./interface/to_do_list.create.dto.interface";
|
|
13
9
|
export * from "./interface/to_do_list.update.dto.interface";
|
package/dist/src/api/v1/index.js
CHANGED
|
@@ -21,9 +21,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
* generator never writes to this directory (checklist 12.4). An entity appears either in
|
|
22
22
|
* api/interface/ or in v1 + v2 - never both.
|
|
23
23
|
*/
|
|
24
|
-
__exportStar(require("./interface/expense_type.create.dto.interface"), exports);
|
|
25
|
-
__exportStar(require("./interface/expense_type.update.dto.interface"), exports);
|
|
26
|
-
__exportStar(require("./interface/office_location.create.dto.interface"), exports);
|
|
27
|
-
__exportStar(require("./interface/office_location.update.dto.interface"), exports);
|
|
28
24
|
__exportStar(require("./interface/to_do_list.create.dto.interface"), exports);
|
|
29
25
|
__exportStar(require("./interface/to_do_list.update.dto.interface"), exports);
|
|
@@ -9,7 +9,3 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export * from "./interface/to_do_list.create.dto.interface";
|
|
11
11
|
export * from "./interface/to_do_list.update.dto.interface";
|
|
12
|
-
export * from "./interface/expense_type.create.dto.interface";
|
|
13
|
-
export * from "./interface/expense_type.update.dto.interface";
|
|
14
|
-
export * from "./interface/office_location.create.dto.interface";
|
|
15
|
-
export * from "./interface/office_location.update.dto.interface";
|
package/dist/src/api/v2/index.js
CHANGED
|
@@ -27,7 +27,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
27
27
|
// };
|
|
28
28
|
__exportStar(require("./interface/to_do_list.create.dto.interface"), exports);
|
|
29
29
|
__exportStar(require("./interface/to_do_list.update.dto.interface"), exports);
|
|
30
|
-
__exportStar(require("./interface/expense_type.create.dto.interface"), exports);
|
|
31
|
-
__exportStar(require("./interface/expense_type.update.dto.interface"), exports);
|
|
32
|
-
__exportStar(require("./interface/office_location.create.dto.interface"), exports);
|
|
33
|
-
__exportStar(require("./interface/office_location.update.dto.interface"), exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare enum PermissionGroupEnum {
|
|
2
|
+
CREATE = "CREATE",
|
|
3
|
+
READ = "READ",
|
|
4
|
+
UPDATE = "UPDATE",
|
|
5
|
+
DELETE = "DELETE",
|
|
6
|
+
APPROVAL_FLOW = "APPROVAL_FLOW",
|
|
7
|
+
NAV = "NAV",
|
|
8
|
+
EXPORT = "EXPORT"
|
|
9
|
+
}
|
|
10
|
+
export declare namespace PermissionGroupEnum {
|
|
11
|
+
/**
|
|
12
|
+
* Permission-name token -> group.
|
|
13
|
+
*
|
|
14
|
+
* Order is significant. PermissionEntityModel.derivePermissionGroup resolves the *first*
|
|
15
|
+
* token that matches, so a token listed earlier wins when a name contains two of them
|
|
16
|
+
* (e.g. VENDOR_INVOICE_PAYMENT_PROCESSOR resolves via PROCESSOR, not PAYMENT - both map to
|
|
17
|
+
* UPDATE today, but that is a coincidence rather than a guarantee).
|
|
18
|
+
*
|
|
19
|
+
* Tokens are matched as `_TOKEN_` (interior) or `_TOKEN` (trailing) unless the name starts
|
|
20
|
+
* with them, which derivePermissionGroup checks separately - the `_TOKEN_` matcher cannot
|
|
21
|
+
* see a leading token.
|
|
22
|
+
*/
|
|
23
|
+
const MAPPING: Record<string, PermissionGroupEnum>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PermissionGroupEnum = void 0;
|
|
4
|
+
var PermissionGroupEnum;
|
|
5
|
+
(function (PermissionGroupEnum) {
|
|
6
|
+
PermissionGroupEnum["CREATE"] = "CREATE";
|
|
7
|
+
PermissionGroupEnum["READ"] = "READ";
|
|
8
|
+
PermissionGroupEnum["UPDATE"] = "UPDATE";
|
|
9
|
+
PermissionGroupEnum["DELETE"] = "DELETE";
|
|
10
|
+
PermissionGroupEnum["APPROVAL_FLOW"] = "APPROVAL_FLOW";
|
|
11
|
+
PermissionGroupEnum["NAV"] = "NAV";
|
|
12
|
+
PermissionGroupEnum["EXPORT"] = "EXPORT";
|
|
13
|
+
})(PermissionGroupEnum || (exports.PermissionGroupEnum = PermissionGroupEnum = {}));
|
|
14
|
+
(function (PermissionGroupEnum) {
|
|
15
|
+
/**
|
|
16
|
+
* Permission-name token -> group.
|
|
17
|
+
*
|
|
18
|
+
* Order is significant. PermissionEntityModel.derivePermissionGroup resolves the *first*
|
|
19
|
+
* token that matches, so a token listed earlier wins when a name contains two of them
|
|
20
|
+
* (e.g. VENDOR_INVOICE_PAYMENT_PROCESSOR resolves via PROCESSOR, not PAYMENT - both map to
|
|
21
|
+
* UPDATE today, but that is a coincidence rather than a guarantee).
|
|
22
|
+
*
|
|
23
|
+
* Tokens are matched as `_TOKEN_` (interior) or `_TOKEN` (trailing) unless the name starts
|
|
24
|
+
* with them, which derivePermissionGroup checks separately - the `_TOKEN_` matcher cannot
|
|
25
|
+
* see a leading token.
|
|
26
|
+
*/
|
|
27
|
+
PermissionGroupEnum.MAPPING = {
|
|
28
|
+
CREATE: PermissionGroupEnum.CREATE,
|
|
29
|
+
READ: PermissionGroupEnum.READ,
|
|
30
|
+
UPDATE: PermissionGroupEnum.UPDATE,
|
|
31
|
+
DELETE: PermissionGroupEnum.DELETE,
|
|
32
|
+
APPROVER: PermissionGroupEnum.APPROVAL_FLOW,
|
|
33
|
+
APPROVAL_FLOW: PermissionGroupEnum.APPROVAL_FLOW,
|
|
34
|
+
NAV: PermissionGroupEnum.NAV,
|
|
35
|
+
VIEW: PermissionGroupEnum.READ,
|
|
36
|
+
AMENDMENT: PermissionGroupEnum.UPDATE,
|
|
37
|
+
APPROVE: PermissionGroupEnum.APPROVAL_FLOW,
|
|
38
|
+
ACTIVATE: PermissionGroupEnum.UPDATE,
|
|
39
|
+
DEACTIVATE: PermissionGroupEnum.UPDATE,
|
|
40
|
+
RESTORE: PermissionGroupEnum.UPDATE,
|
|
41
|
+
CREATOR: PermissionGroupEnum.CREATE,
|
|
42
|
+
SEARCH: PermissionGroupEnum.READ,
|
|
43
|
+
PROCESSOR: PermissionGroupEnum.UPDATE,
|
|
44
|
+
PAYMENT: PermissionGroupEnum.UPDATE,
|
|
45
|
+
ESCALATION: PermissionGroupEnum.UPDATE,
|
|
46
|
+
MOVE_PROJECT: PermissionGroupEnum.UPDATE,
|
|
47
|
+
EXPORT: PermissionGroupEnum.EXPORT,
|
|
48
|
+
};
|
|
49
|
+
})(PermissionGroupEnum || (exports.PermissionGroupEnum = PermissionGroupEnum = {}));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PermissionGroupEnum } from "../enums/permission_group_enum";
|
|
1
2
|
/**
|
|
2
3
|
* Generic flow-config factory.
|
|
3
4
|
*
|
|
@@ -80,6 +81,12 @@
|
|
|
80
81
|
export type ActionMapEntry<S extends string> = {
|
|
81
82
|
readonly reachableStatues: readonly S[];
|
|
82
83
|
readonly permissions: string[];
|
|
84
|
+
/**
|
|
85
|
+
* Permission group shared by every permission in `permissions`. Declared once here rather
|
|
86
|
+
* than per call so `createActionConfig` can stamp it onto each (status, action) transition
|
|
87
|
+
* without every call site having to pass it. See `IFlowConfigActionConfig.group`.
|
|
88
|
+
*/
|
|
89
|
+
readonly group?: PermissionGroupEnum;
|
|
83
90
|
};
|
|
84
91
|
/**
|
|
85
92
|
* Full action map: one entry per action value.
|
|
@@ -125,6 +132,7 @@ export declare function createFlowConfigFactory<CTX = never>(): <A extends strin
|
|
|
125
132
|
createActionConfig: <Act extends A, Subset extends { [key in A]: AM[key]["reachableStatues"]; }[Act][number] = { [key in A]: AM[key]["reachableStatues"]; }[Act][number]>(action: Act, nextStatus: Subset | ((context: CTX) => Subset), overridePermissions?: string[], options?: ActionConfigOptions<CTX>) => {
|
|
126
133
|
description?: string | undefined;
|
|
127
134
|
isApplicable?: ((context: CTX) => boolean) | undefined;
|
|
135
|
+
group?: PermissionGroupEnum | undefined;
|
|
128
136
|
permissions: string[];
|
|
129
137
|
next: (context: CTX) => Subset;
|
|
130
138
|
};
|
|
@@ -1,78 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Generic flow-config factory.
|
|
4
|
-
*
|
|
5
|
-
* Provides a reusable, type-safe `createActionConfig` helper for any entity
|
|
6
|
-
* flow configuration. Eliminates boilerplate type plumbing (ActionStatusMap,
|
|
7
|
-
* StateStatusForAction, createTransition) that would otherwise be duplicated
|
|
8
|
-
* in every flow config file.
|
|
9
|
-
*
|
|
10
|
-
* ---
|
|
11
|
-
* **Usage — basic**
|
|
12
|
-
* ```typescript
|
|
13
|
-
* import { createFlowConfigFactory } from "./base-flow-config.factory";
|
|
14
|
-
*
|
|
15
|
-
* const ACTION_MAP = {
|
|
16
|
-
* [MyActionEnum.APPROVE]: { statuses: [MyStatusEnum.APPROVED] as const, permissions: ["MY_APPROVE"] },
|
|
17
|
-
* [MyActionEnum.REJECT]: { statuses: [MyStatusEnum.REJECTED] as const, permissions: ["MY_REJECT"] },
|
|
18
|
-
* } satisfies ActionMap<MyActionEnum, MyStatusEnum>;
|
|
19
|
-
*
|
|
20
|
-
* const { createActionConfig } = createFlowConfigFactory<IMyContextData>()(ACTION_MAP);
|
|
21
|
-
*
|
|
22
|
-
* const transition = createActionConfig(MyStatusEnum.APPROVED, MyActionEnum.APPROVE);
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* ---
|
|
26
|
-
* **Usage — overriding a transition permission**
|
|
27
|
-
* ```typescript
|
|
28
|
-
* createActionConfig(MyStatusEnum.APPROVED, MyActionEnum.APPROVE, ["CUSTOM_APPROVE_PERM"]);
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* ---
|
|
32
|
-
* **Usage — context-driven (multi-outcome) transition**
|
|
33
|
-
* ```typescript
|
|
34
|
-
* createActionConfig(
|
|
35
|
-
* (ctx: IMyContextData) => ctx.fast ? MyStatusEnum.APPROVED : MyStatusEnum.PENDING,
|
|
36
|
-
* MyActionEnum.APPROVE,
|
|
37
|
-
* );
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* ---
|
|
41
|
-
* **Usage — subset narrowing**
|
|
42
|
-
* Restrict the compiler to a subset of the action's possible target statuses:
|
|
43
|
-
* ```typescript
|
|
44
|
-
* createActionConfig<MyActionEnum.APPROVE, MyStatusEnum.APPROVED>(
|
|
45
|
-
* MyStatusEnum.APPROVED,
|
|
46
|
-
* MyActionEnum.APPROVE,
|
|
47
|
-
* );
|
|
48
|
-
* ```
|
|
49
|
-
*
|
|
50
|
-
* ---
|
|
51
|
-
* **Extending base enums**
|
|
52
|
-
* TypeScript enums cannot be inherited, but entity-specific enums can
|
|
53
|
-
* re-declare base values and add new ones:
|
|
54
|
-
* ```typescript
|
|
55
|
-
* import { BaseFlowActionEnum, BaseFlowStatusEnum } from "./base-flow-config.enums";
|
|
56
|
-
*
|
|
57
|
-
* export enum VendorActionEnum {
|
|
58
|
-
* VIEW = BaseFlowActionEnum.VIEW,
|
|
59
|
-
* CREATE = BaseFlowActionEnum.CREATE,
|
|
60
|
-
* UPDATE = BaseFlowActionEnum.UPDATE,
|
|
61
|
-
* DELETE = BaseFlowActionEnum.DELETE,
|
|
62
|
-
* APPROVE = BaseFlowActionEnum.APPROVE,
|
|
63
|
-
* REJECT = BaseFlowActionEnum.REJECT,
|
|
64
|
-
* RECALL = BaseFlowActionEnum.RECALL,
|
|
65
|
-
* DEACTIVATE = BaseFlowActionEnum.DEACTIVATE,
|
|
66
|
-
* SUBMIT = "submit", // ← extension
|
|
67
|
-
* }
|
|
68
|
-
*
|
|
69
|
-
* export enum VendorStatusEnum {
|
|
70
|
-
* ACTIVE = BaseFlowStatusEnum.ACTIVE,
|
|
71
|
-
* // ... all base statuses ...
|
|
72
|
-
* SUBMITTED = "SUBMITTED", // ← extension
|
|
73
|
-
* }
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
3
|
exports.createFlowConfigFactory = createFlowConfigFactory;
|
|
78
4
|
function createFlowConfigFactory() {
|
|
@@ -99,7 +25,7 @@ function createFlowConfigFactory() {
|
|
|
99
25
|
* (currentStatus, action) pair. Must be a subtype of
|
|
100
26
|
* `StatusForAction<Act>`.
|
|
101
27
|
*/
|
|
102
|
-
const createActionConfig = (action, nextStatus, overridePermissions, options) => (Object.assign(Object.assign({ permissions: overridePermissions !== null && overridePermissions !== void 0 ? overridePermissions : actionMap[action].permissions, next: createTransition(nextStatus) }, ((options === null || options === void 0 ? void 0 : options.isApplicable) !== undefined ? { isApplicable: options.isApplicable } : {})), ((options === null || options === void 0 ? void 0 : options.description) !== undefined ? { description: options.description } : {})));
|
|
28
|
+
const createActionConfig = (action, nextStatus, overridePermissions, options) => (Object.assign(Object.assign(Object.assign({ permissions: overridePermissions !== null && overridePermissions !== void 0 ? overridePermissions : actionMap[action].permissions, next: createTransition(nextStatus) }, (actionMap[action].group !== undefined ? { group: actionMap[action].group } : {})), ((options === null || options === void 0 ? void 0 : options.isApplicable) !== undefined ? { isApplicable: options.isApplicable } : {})), ((options === null || options === void 0 ? void 0 : options.description) !== undefined ? { description: options.description } : {})));
|
|
103
29
|
return { createActionConfig, createTransition };
|
|
104
30
|
};
|
|
105
31
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FlowConfig } from "./flow-config.type";
|
|
2
|
-
import { ExpenseTypeActionEnum } from "
|
|
2
|
+
import { ExpenseTypeActionEnum } from "../enums/expense_type_action_enum";
|
|
3
3
|
import { ExpenseTypeStatusEnum } from "../enums/expense_type_status_enum";
|
|
4
4
|
export interface IExpenseTypeFlowConfigContextData {
|
|
5
5
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.expenseTypeFlowConfig = void 0;
|
|
4
4
|
const base_flow_config_factory_1 = require("./base-flow-config.factory");
|
|
5
|
-
const
|
|
5
|
+
const expense_type_action_enum_1 = require("../enums/expense_type_action_enum");
|
|
6
6
|
const expense_type_status_enum_1 = require("../enums/expense_type_status_enum");
|
|
7
7
|
const EXPENSE_TYPE_CREATE_PERMISSION = ["EXPENSE_TYPE_CREATE"];
|
|
8
8
|
const EXPENSE_TYPE_UPDATE_PERMISSION = ["EXPENSE_TYPE_UPDATE"];
|
|
@@ -11,60 +11,60 @@ const EXPENSE_TYPE_DEACTIVATE_PERMISSION = ["EXPENSE_TYPE_DEACTIVATE"];
|
|
|
11
11
|
const EXPENSE_TYPE_ACTIVATE_PERMISSION = ["EXPENSE_TYPE_ACTIVATE"];
|
|
12
12
|
const EXPENSE_TYPE_RESTORE_PERMISSION = ["EXPENSE_TYPE_RESTORE"];
|
|
13
13
|
const ACTION_MAP = {
|
|
14
|
-
[
|
|
14
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.CREATE]: {
|
|
15
15
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED],
|
|
16
16
|
permissions: EXPENSE_TYPE_CREATE_PERMISSION,
|
|
17
17
|
},
|
|
18
|
-
[
|
|
18
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.UPDATE]: {
|
|
19
19
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED],
|
|
20
20
|
permissions: EXPENSE_TYPE_UPDATE_PERMISSION,
|
|
21
21
|
},
|
|
22
|
-
[
|
|
22
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.DELETE]: {
|
|
23
23
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.DELETED],
|
|
24
24
|
permissions: EXPENSE_TYPE_DELETE_PERMISSION,
|
|
25
25
|
},
|
|
26
|
-
[
|
|
26
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.DEACTIVATE]: {
|
|
27
27
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.DEACTIVATED],
|
|
28
28
|
permissions: EXPENSE_TYPE_DEACTIVATE_PERMISSION,
|
|
29
29
|
},
|
|
30
|
-
[
|
|
30
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.ACTIVATE]: {
|
|
31
31
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED],
|
|
32
32
|
permissions: EXPENSE_TYPE_ACTIVATE_PERMISSION,
|
|
33
33
|
},
|
|
34
|
-
[
|
|
34
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.RESTORE]: {
|
|
35
35
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED],
|
|
36
36
|
permissions: EXPENSE_TYPE_RESTORE_PERMISSION,
|
|
37
37
|
},
|
|
38
38
|
};
|
|
39
39
|
const { createActionConfig } = (0, base_flow_config_factory_1.createFlowConfigFactory)()(ACTION_MAP);
|
|
40
40
|
// APPROVED status transitions
|
|
41
|
-
const transitionApprovedStatusUpdateAction = createActionConfig(
|
|
42
|
-
const transitionApprovedStatusDeleteAction = createActionConfig(
|
|
43
|
-
const transitionApprovedStatusDeactivateAction = createActionConfig(
|
|
41
|
+
const transitionApprovedStatusUpdateAction = createActionConfig(expense_type_action_enum_1.ExpenseTypeActionEnum.UPDATE, expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED);
|
|
42
|
+
const transitionApprovedStatusDeleteAction = createActionConfig(expense_type_action_enum_1.ExpenseTypeActionEnum.DELETE, expense_type_status_enum_1.ExpenseTypeStatusEnum.DELETED);
|
|
43
|
+
const transitionApprovedStatusDeactivateAction = createActionConfig(expense_type_action_enum_1.ExpenseTypeActionEnum.DEACTIVATE, expense_type_status_enum_1.ExpenseTypeStatusEnum.DEACTIVATED);
|
|
44
44
|
// DEACTIVATED status transitions
|
|
45
|
-
const transitionDeactivatedStatusDeleteAction = createActionConfig(
|
|
46
|
-
const transitionDeactivatedStatusActivateAction = createActionConfig(
|
|
45
|
+
const transitionDeactivatedStatusDeleteAction = createActionConfig(expense_type_action_enum_1.ExpenseTypeActionEnum.DELETE, expense_type_status_enum_1.ExpenseTypeStatusEnum.DELETED);
|
|
46
|
+
const transitionDeactivatedStatusActivateAction = createActionConfig(expense_type_action_enum_1.ExpenseTypeActionEnum.ACTIVATE, expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED);
|
|
47
47
|
// DELETED status transitions
|
|
48
|
-
const transitionDeletedStatusUpdateAction = createActionConfig(
|
|
49
|
-
const transitionDeletedStatusRestoreAction = createActionConfig(
|
|
48
|
+
const transitionDeletedStatusUpdateAction = createActionConfig(expense_type_action_enum_1.ExpenseTypeActionEnum.UPDATE, expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED);
|
|
49
|
+
const transitionDeletedStatusRestoreAction = createActionConfig(expense_type_action_enum_1.ExpenseTypeActionEnum.RESTORE, expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED);
|
|
50
50
|
exports.expenseTypeFlowConfig = {
|
|
51
51
|
[expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED]: {
|
|
52
52
|
actions: {
|
|
53
|
-
[
|
|
54
|
-
[
|
|
55
|
-
[
|
|
53
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.UPDATE]: transitionApprovedStatusUpdateAction,
|
|
54
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.DELETE]: transitionApprovedStatusDeleteAction,
|
|
55
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.DEACTIVATE]: transitionApprovedStatusDeactivateAction,
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
[expense_type_status_enum_1.ExpenseTypeStatusEnum.DEACTIVATED]: {
|
|
59
59
|
actions: {
|
|
60
|
-
[
|
|
61
|
-
[
|
|
60
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.DELETE]: transitionDeactivatedStatusDeleteAction,
|
|
61
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.ACTIVATE]: transitionDeactivatedStatusActivateAction,
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
64
|
[expense_type_status_enum_1.ExpenseTypeStatusEnum.DELETED]: {
|
|
65
65
|
actions: {
|
|
66
|
-
[
|
|
67
|
-
[
|
|
66
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.UPDATE]: transitionDeletedStatusUpdateAction,
|
|
67
|
+
[expense_type_action_enum_1.ExpenseTypeActionEnum.RESTORE]: transitionDeletedStatusRestoreAction,
|
|
68
68
|
},
|
|
69
69
|
},
|
|
70
70
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PermissionGroupEnum } from "../enums/permission_group_enum";
|
|
1
2
|
/**
|
|
2
3
|
* Defines the complete state machine configuration for a domain entity.
|
|
3
4
|
* Maps each status to its available actions and their metadata.
|
|
@@ -69,4 +70,14 @@ export interface IFlowConfigActionConfig<STATUS_ENUM_TYPE extends string, CONTEX
|
|
|
69
70
|
* to the row in its current state.
|
|
70
71
|
*/
|
|
71
72
|
isApplicable?: (data: CONTEXT_DATA_TYPE) => boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Permission group this action's permissions belong to, as stored on `permission.group`.
|
|
75
|
+
*
|
|
76
|
+
* Consumers that authorise against a single (entity, group) pair - rather than against the
|
|
77
|
+
* union of every permission in a filter map - read this to pick which permission applies.
|
|
78
|
+
* Optional so flow configs that do not participate in that path stay unchanged; a consumer
|
|
79
|
+
* that requires it should treat an absent value as an error rather than defaulting, since a
|
|
80
|
+
* silent default would authorise the action under the wrong group.
|
|
81
|
+
*/
|
|
82
|
+
group?: PermissionGroupEnum;
|
|
72
83
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.workFromHomeFlowConfig = void 0;
|
|
4
4
|
const base_flow_config_factory_1 = require("./base-flow-config.factory");
|
|
5
|
+
const permission_group_enum_1 = require("../enums/permission_group_enum");
|
|
5
6
|
const work_from_home_action_enum_1 = require("../enums/work_from_home_action_enum");
|
|
6
7
|
const work_from_home_status_enum_1 = require("../enums/work_from_home_status_enum");
|
|
7
8
|
// ORG/SELF permissions — matching legacy pattern from work_from_home.flow.config.ts
|
|
@@ -11,10 +12,13 @@ const WORK_FROM_HOME_DELETE_PERMISSION = ["WORK_FROM_HOME_DELETE_SELF"];
|
|
|
11
12
|
const WORK_FROM_HOME_APPROVE_PERMISSION = ["WORK_FROM_HOME_APPROVER_ORG"];
|
|
12
13
|
const WORK_FROM_HOME_REJECT_PERMISSION = ["WORK_FROM_HOME_APPROVER_ORG"];
|
|
13
14
|
const WORK_FROM_HOME_RECALL_PERMISSION = ["WORK_FROM_HOME_UPDATE_ORG", "WORK_FROM_HOME_UPDATE_SELF"];
|
|
15
|
+
// Every action declares its group. work_from_home_bulk_update.transaction.ts refuses to
|
|
16
|
+
// default an absent group, so all six must be annotated for any transition to keep working.
|
|
14
17
|
const ACTION_MAP = {
|
|
15
18
|
[work_from_home_action_enum_1.WorkFromHomeActionEnum.CREATE]: {
|
|
16
19
|
reachableStatues: [work_from_home_status_enum_1.WorkFromHomeStatusEnum.CREATE_APPROVAL_PENDING],
|
|
17
20
|
permissions: WORK_FROM_HOME_CREATE_PERMISSION,
|
|
21
|
+
group: permission_group_enum_1.PermissionGroupEnum.CREATE,
|
|
18
22
|
},
|
|
19
23
|
[work_from_home_action_enum_1.WorkFromHomeActionEnum.UPDATE]: {
|
|
20
24
|
reachableStatues: [
|
|
@@ -23,22 +27,27 @@ const ACTION_MAP = {
|
|
|
23
27
|
// WorkFromHomeStatusEnum.CHANGE_REQUESTED,
|
|
24
28
|
],
|
|
25
29
|
permissions: WORK_FROM_HOME_UPDATE_PERMISSION,
|
|
30
|
+
group: permission_group_enum_1.PermissionGroupEnum.UPDATE,
|
|
26
31
|
},
|
|
27
32
|
[work_from_home_action_enum_1.WorkFromHomeActionEnum.DELETE]: {
|
|
28
33
|
reachableStatues: [work_from_home_status_enum_1.WorkFromHomeStatusEnum.DELETE_APPROVAL_PENDING, work_from_home_status_enum_1.WorkFromHomeStatusEnum.DELETED],
|
|
29
34
|
permissions: WORK_FROM_HOME_DELETE_PERMISSION,
|
|
35
|
+
group: permission_group_enum_1.PermissionGroupEnum.DELETE,
|
|
30
36
|
},
|
|
31
37
|
[work_from_home_action_enum_1.WorkFromHomeActionEnum.APPROVE]: {
|
|
32
38
|
reachableStatues: [work_from_home_status_enum_1.WorkFromHomeStatusEnum.APPROVED, work_from_home_status_enum_1.WorkFromHomeStatusEnum.DELETED],
|
|
33
39
|
permissions: WORK_FROM_HOME_APPROVE_PERMISSION,
|
|
40
|
+
group: permission_group_enum_1.PermissionGroupEnum.APPROVAL_FLOW,
|
|
34
41
|
},
|
|
35
42
|
[work_from_home_action_enum_1.WorkFromHomeActionEnum.REJECT]: {
|
|
36
43
|
reachableStatues: [work_from_home_status_enum_1.WorkFromHomeStatusEnum.REJECTED, work_from_home_status_enum_1.WorkFromHomeStatusEnum.RESOLVED_REJECTED],
|
|
37
44
|
permissions: WORK_FROM_HOME_REJECT_PERMISSION,
|
|
45
|
+
group: permission_group_enum_1.PermissionGroupEnum.APPROVAL_FLOW,
|
|
38
46
|
},
|
|
39
47
|
[work_from_home_action_enum_1.WorkFromHomeActionEnum.RECALL]: {
|
|
40
48
|
reachableStatues: [work_from_home_status_enum_1.WorkFromHomeStatusEnum.APPROVED],
|
|
41
49
|
permissions: WORK_FROM_HOME_RECALL_PERMISSION,
|
|
50
|
+
group: permission_group_enum_1.PermissionGroupEnum.UPDATE,
|
|
42
51
|
},
|
|
43
52
|
};
|
|
44
53
|
const { createActionConfig } = (0, base_flow_config_factory_1.createFlowConfigFactory)()(ACTION_MAP);
|
|
@@ -47,7 +47,7 @@ export * from "./flow-configs/reimbursement_flow.config";
|
|
|
47
47
|
export * from "./flow-configs/reimbursement_expense_flow.config";
|
|
48
48
|
export * from "./interface/reimbursement.entity.interface";
|
|
49
49
|
export * from "./interface/field-constraint/reimbursement_field_constraints.interface";
|
|
50
|
-
export * from "./enums/
|
|
50
|
+
export * from "./enums/expense_type_entity_enum";
|
|
51
51
|
export * from "./enums/expense_type_action_enum";
|
|
52
52
|
export * from "./enums/expense_type_status_enum";
|
|
53
53
|
export * from "./flow-configs/expense_type_flow.config";
|
|
@@ -72,6 +72,7 @@ export * from "./enums/client_affiliate_status_enum";
|
|
|
72
72
|
export * from "./flow-configs/client_affiliate_flow.config";
|
|
73
73
|
export * from "./interface/client_affiliate.entity.interface";
|
|
74
74
|
export * from "./interface/field-constraint/client_affiliate_field_constraints.interface";
|
|
75
|
+
export * from "./enums/permission_group_enum";
|
|
75
76
|
export * from "./interface/permission.entity.interface";
|
|
76
77
|
export * from "./interface/field-constraint/permission_field_constraints.interface";
|
|
77
78
|
export * from "./interface/role.entity.interface";
|
|
@@ -409,4 +410,3 @@ export * from "./model/work_from_home.entity.model";
|
|
|
409
410
|
export * from "./enums/user_gender_enum";
|
|
410
411
|
export * from "./enums/user_role_enum";
|
|
411
412
|
export * from "./enums/user_status_enum";
|
|
412
|
-
export * from "./interface/field-constraint/office_location_address_field_constraints.interface";
|
|
@@ -63,7 +63,7 @@ __exportStar(require("./flow-configs/reimbursement_flow.config"), exports);
|
|
|
63
63
|
__exportStar(require("./flow-configs/reimbursement_expense_flow.config"), exports);
|
|
64
64
|
__exportStar(require("./interface/reimbursement.entity.interface"), exports);
|
|
65
65
|
__exportStar(require("./interface/field-constraint/reimbursement_field_constraints.interface"), exports);
|
|
66
|
-
__exportStar(require("./enums/
|
|
66
|
+
__exportStar(require("./enums/expense_type_entity_enum"), exports);
|
|
67
67
|
__exportStar(require("./enums/expense_type_action_enum"), exports);
|
|
68
68
|
__exportStar(require("./enums/expense_type_status_enum"), exports);
|
|
69
69
|
__exportStar(require("./flow-configs/expense_type_flow.config"), exports);
|
|
@@ -88,6 +88,7 @@ __exportStar(require("./enums/client_affiliate_status_enum"), exports);
|
|
|
88
88
|
__exportStar(require("./flow-configs/client_affiliate_flow.config"), exports);
|
|
89
89
|
__exportStar(require("./interface/client_affiliate.entity.interface"), exports);
|
|
90
90
|
__exportStar(require("./interface/field-constraint/client_affiliate_field_constraints.interface"), exports);
|
|
91
|
+
__exportStar(require("./enums/permission_group_enum"), exports);
|
|
91
92
|
__exportStar(require("./interface/permission.entity.interface"), exports);
|
|
92
93
|
__exportStar(require("./interface/field-constraint/permission_field_constraints.interface"), exports);
|
|
93
94
|
__exportStar(require("./interface/role.entity.interface"), exports);
|
|
@@ -426,4 +427,3 @@ __exportStar(require("./model/work_from_home.entity.model"), exports);
|
|
|
426
427
|
__exportStar(require("./enums/user_gender_enum"), exports);
|
|
427
428
|
__exportStar(require("./enums/user_role_enum"), exports);
|
|
428
429
|
__exportStar(require("./enums/user_status_enum"), exports);
|
|
429
|
-
__exportStar(require("./interface/field-constraint/office_location_address_field_constraints.interface"), exports);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { ExpenseTypeEnum } from "../enums/
|
|
1
|
+
import { ExpenseTypeEnum } from "../enums/expense_type_entity_enum";
|
|
2
2
|
import { ExpenseTypeStatusEnum } from "../enums/expense_type_status_enum";
|
|
3
3
|
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
4
|
-
import { Nullable } from "./entity.utils.interface";
|
|
5
4
|
export interface IExpenseTypeEntity extends IEntityAuditColumn {
|
|
6
5
|
id: number;
|
|
7
6
|
name: string;
|
|
8
|
-
description?:
|
|
7
|
+
description?: string;
|
|
9
8
|
type: ExpenseTypeEnum;
|
|
10
9
|
status: ExpenseTypeStatusEnum;
|
|
11
10
|
}
|
package/dist/src/entities/interface/field-constraint/expense_type_field_constraints.interface.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { IEntityAuditColumn } from "../entity-audit-columns.interface";
|
|
2
2
|
import { IExpenseTypeEntity } from "../expense_type.entity.interface";
|
|
3
3
|
import { IFieldMinMaxConstraint } from "./utils";
|
|
4
|
+
/**
|
|
5
|
+
* excluded, and why:
|
|
6
|
+
* - "type", "status" enum columns, enums carry no min/max
|
|
7
|
+
* - "id", keyof IEntityAuditColumn generated columns
|
|
8
|
+
*
|
|
9
|
+
* this entity has a create DTO only — there is no ExpenseTypeUpdateDto, so no
|
|
10
|
+
* create/update disagreement is possible
|
|
11
|
+
*/
|
|
4
12
|
export type IExpenseTypeFieldLengthConstraintsExclude = "status" | "type" | "id" | keyof IEntityAuditColumn;
|
|
5
13
|
/**
|
|
6
14
|
* since some fields are optional, but we still need their
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { IEntityAuditColumn } from "../entity-audit-columns.interface";
|
|
2
2
|
import { IOfficeLocationEntity } from "../office_location.entity.interface";
|
|
3
3
|
import { IFieldMinMaxConstraint } from "./utils";
|
|
4
|
+
/**
|
|
5
|
+
* excluded, and why:
|
|
6
|
+
* - "id", keyof IEntityAuditColumn generated columns
|
|
7
|
+
* - "status" enum column driven by the entity flow — bounded by its allowed
|
|
8
|
+
* values, not by a character length
|
|
9
|
+
*
|
|
10
|
+
* OfficeLocationUpdateDto is a standalone class rather than a PartialType of the create DTO, so the
|
|
11
|
+
* two can and do disagree — see the note on `address` below
|
|
12
|
+
*/
|
|
4
13
|
export type IOfficeLocationFieldLengthConstraintsExclude = "status" | "id" | keyof IEntityAuditColumn;
|
|
5
14
|
/**
|
|
6
15
|
* since some fields are optional, but we still need their
|
package/dist/src/entities/interface/field-constraint/office_location_field_constraints.interface.js
CHANGED
|
@@ -6,14 +6,23 @@ exports.officeLocationFieldMinMaxConstraints = {
|
|
|
6
6
|
min: 3,
|
|
7
7
|
max: 128,
|
|
8
8
|
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
/**
|
|
10
|
+
* the column is varchar(1024) and the update DTO agrees, but the create DTO caps it at
|
|
11
|
+
* @MaxLength(255) — the create bound stays as a literal, reconciling the two is step-4 material
|
|
12
|
+
*/
|
|
12
13
|
address: {
|
|
13
14
|
max: 1024,
|
|
14
15
|
},
|
|
16
|
+
/**
|
|
17
|
+
* NOT a numeric bound: the property is typed `number` but the column is varchar(64), so 64 is the
|
|
18
|
+
* stored string length. Neither DTO bounds it, and it is deliberately left unwired there —
|
|
19
|
+
* the number/varchar mismatch is step-4 material
|
|
20
|
+
*/
|
|
15
21
|
zipCode: {
|
|
16
|
-
max:
|
|
22
|
+
max: 64,
|
|
23
|
+
},
|
|
24
|
+
country: {
|
|
25
|
+
max: 128,
|
|
17
26
|
},
|
|
18
27
|
organizationId: {
|
|
19
28
|
max: 9999999,
|