@pksep/zod-shared 0.0.531 → 0.0.533

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.
Files changed (79) hide show
  1. package/dist/action/enums/enums.d.ts +1 -0
  2. package/dist/action/enums/enums.js +1 -0
  3. package/dist/action/schemas/actions.schema.d.ts +2 -2
  4. package/dist/assemble/dto/assembly-paginate.dto.d.ts +7 -1
  5. package/dist/assemble/dto/assembly-paginate.dto.js +3 -1
  6. package/dist/assemble/dto/create-assemble-kit.dto.d.ts +14 -8
  7. package/dist/assemble/dto/create-assemble-kit.dto.js +7 -3
  8. package/dist/assemble/dto/get-assemble-operation-count.dto.d.ts +22 -6
  9. package/dist/assemble/dto/get-assemble-pagination-sclad.dto.d.ts +7 -1
  10. package/dist/assemble/dto/get-assemble-pagination-sclad.dto.js +3 -1
  11. package/dist/assemble/dto/get-assemble-pagination.dto.d.ts +7 -1
  12. package/dist/assemble/dto/get-assemble-pagination.dto.js +3 -1
  13. package/dist/assemble/interfaces/interfaces.d.ts +12 -0
  14. package/dist/assemble/schemas/assemble-coming.schema.d.ts +16 -4
  15. package/dist/assemble/schemas/assemble.schema.d.ts +16 -4
  16. package/dist/assemble-kit/interfaces/interface.d.ts +7 -0
  17. package/dist/assemble-kit/schemas/assemble-kit.schema.d.ts +7 -2
  18. package/dist/cbed/dto/get-deficit.dto.d.ts +7 -1
  19. package/dist/cbed/dto/get-deficit.dto.js +3 -1
  20. package/dist/deliveries/schemas/deliveries.schema.d.ts +2 -2
  21. package/dist/detal/dto/get-deficit.dto.d.ts +7 -1
  22. package/dist/detal/dto/get-deficit.dto.js +3 -1
  23. package/dist/detal/schemas/detal-deficit.schema.d.ts +10 -0
  24. package/dist/detal/schemas/detal.schema.d.ts +5 -0
  25. package/dist/equipment/schemas/equipment.schema.d.ts +8 -8
  26. package/dist/exclusion/dto/create-exclusion.dto.d.ts +16 -0
  27. package/dist/exclusion/dto/create-exclusion.dto.js +13 -0
  28. package/dist/exclusion/dto/get-exclusion-pagination.dto.d.ts +13 -0
  29. package/dist/exclusion/dto/get-exclusion-pagination.dto.js +12 -0
  30. package/dist/exclusion/dto/update-exclusion.dto.d.ts +13 -0
  31. package/dist/exclusion/dto/update-exclusion.dto.js +12 -0
  32. package/dist/exclusion/index.d.ts +5 -0
  33. package/dist/exclusion/index.js +21 -0
  34. package/dist/exclusion/interfaces/interface.d.ts +8 -0
  35. package/dist/exclusion/interfaces/interface.js +2 -0
  36. package/dist/exclusion/schemas/exclusion.schema.d.ts +28 -0
  37. package/dist/exclusion/schemas/exclusion.schema.js +17 -0
  38. package/dist/expenditure/schema/expenditure-consumption.schema.d.ts +2 -2
  39. package/dist/expenditure/schema/expenditure.schema.d.ts +2 -2
  40. package/dist/material/dto/get-deficit.dto.d.ts +7 -1
  41. package/dist/material/dto/get-deficit.dto.js +3 -1
  42. package/dist/metaloworking/dto/get-metallworking-pagination.dto.d.ts +7 -0
  43. package/dist/metaloworking/dto/get-metallworking-pagination.dto.js +4 -1
  44. package/dist/metaloworking/schemas/metaloworking-by-operation.schema.d.ts +2 -2
  45. package/dist/moving/schemas/moving.schema.d.ts +11 -6
  46. package/dist/product/dto/get-deficit.dto.d.ts +7 -1
  47. package/dist/product/dto/get-deficit.dto.js +3 -1
  48. package/dist/product/schemas/product-deficit.schema.d.ts +5 -0
  49. package/dist/production-tasks/dto/get-deficits-detal-by-production-task.dto.d.ts +7 -0
  50. package/dist/production-tasks/dto/get-deficits-detal-by-production-task.dto.js +4 -1
  51. package/dist/production-tasks/dto/online-board-working.dto.d.ts +7 -1
  52. package/dist/production-tasks/dto/online-board-working.dto.js +3 -1
  53. package/dist/production-tasks/interfaces/production-tasks.d.ts +2 -0
  54. package/dist/production-tasks/schemas/production-operation-pos.schema.d.ts +2 -2
  55. package/dist/role/schemas/role.schema.d.ts +11 -6
  56. package/dist/sclad/schemas/remain.schema.d.ts +2 -2
  57. package/dist/shipments/dto/set-warehouse-readiness-date.dto.d.ts +12 -0
  58. package/dist/shipments/dto/set-warehouse-readiness-date.dto.js +8 -0
  59. package/dist/shipments/dto/shipments-list-pagination-response.dto.d.ts +5 -0
  60. package/dist/shipments/dto/shipments-paginate.dto.d.ts +7 -1
  61. package/dist/shipments/dto/shipments-paginate.dto.js +3 -1
  62. package/dist/shipments/index.d.ts +1 -0
  63. package/dist/shipments/index.js +1 -0
  64. package/dist/shipments/schemas/shipment-list-item.schema.d.ts +3 -0
  65. package/dist/shipments/schemas/shipment-list-item.schema.js +4 -0
  66. package/dist/shipments/schemas/shipments.schema.d.ts +3 -0
  67. package/dist/shipments/schemas/shipments.schema.js +1 -0
  68. package/dist/specification/schema/attributes.schema.d.ts +7 -0
  69. package/dist/user/dto/update-user-table-config.dto.d.ts +5 -0
  70. package/dist/user/schemas/user-table-config.schema.d.ts +43 -0
  71. package/dist/user/schemas/user-table-config.schema.js +2 -1
  72. package/dist/user/schemas/user.schema.d.ts +7 -4
  73. package/dist/user/schemas/user.schema.js +1 -0
  74. package/dist/utils/index.d.ts +1 -0
  75. package/dist/utils/index.js +1 -0
  76. package/dist/utils/sorting.d.ts +10 -0
  77. package/dist/utils/sorting.js +40 -0
  78. package/dist/utils/tables-config/methods.js +28 -11
  79. package/package.json +1 -1
@@ -16,5 +16,7 @@ exports.ShipmentsPaginateSchema = zod_1.z.object({
16
16
  ]),
17
17
  companyId: zod_1.z.number().int().nullish(),
18
18
  searchStr: zod_1.z.string().optional(),
19
- attributes: zod_1.z.array(zod_1.z.string()).optional()
19
+ attributes: zod_1.z.array(zod_1.z.string()).optional(),
20
+ sortField: zod_1.z.nativeEnum(utils_1.ProductionPlanSortField).nullable().optional(),
21
+ sortDesc: zod_1.z.boolean().optional().default(false)
20
22
  });
@@ -20,3 +20,4 @@ export * from './interface/interface';
20
20
  export * from './dto/entity-filtering-by-shipment.dto';
21
21
  export * from './schemas/shipments-sh-complit.schema';
22
22
  export * from './dto/sh-complit-update.dto';
23
+ export * from './dto/set-warehouse-readiness-date.dto';
@@ -36,3 +36,4 @@ __exportStar(require("./interface/interface"), exports);
36
36
  __exportStar(require("./dto/entity-filtering-by-shipment.dto"), exports);
37
37
  __exportStar(require("./schemas/shipments-sh-complit.schema"), exports);
38
38
  __exportStar(require("./dto/sh-complit-update.dto"), exports);
39
+ __exportStar(require("./dto/set-warehouse-readiness-date.dto"), exports);
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  export declare const ShipmentListItem: z.ZodObject<{
3
3
  date_shipments: z.ZodUnion<[z.ZodString, z.ZodDate]>;
4
+ warehouse_readiness_date: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodDate]>>>;
4
5
  id: z.ZodNumber;
5
6
  number_order: z.ZodString;
6
7
  product: z.ZodOptional<z.ZodObject<{
@@ -117,6 +118,7 @@ export declare const ShipmentListItem: z.ZodObject<{
117
118
  shipmentsId: number;
118
119
  };
119
120
  }[] | undefined;
121
+ warehouse_readiness_date?: string | Date | null | undefined;
120
122
  detals?: {
121
123
  id: number;
122
124
  ShipmentsDetal: {
@@ -149,6 +151,7 @@ export declare const ShipmentListItem: z.ZodObject<{
149
151
  shipmentsId: number;
150
152
  };
151
153
  }[] | undefined;
154
+ warehouse_readiness_date?: string | Date | null | undefined;
152
155
  detals?: {
153
156
  id: number;
154
157
  ShipmentsDetal: {
@@ -6,6 +6,10 @@ const shipments_detal_schema_1 = require("./shipments-detal.schema");
6
6
  const shipments_cbed_schema_1 = require("./shipments-cbed.schema");
7
7
  exports.ShipmentListItem = zod_1.z.object({
8
8
  date_shipments: zod_1.z.union([zod_1.z.string(), zod_1.z.date()]),
9
+ warehouse_readiness_date: zod_1.z
10
+ .union([zod_1.z.string(), zod_1.z.date()])
11
+ .nullable()
12
+ .optional(),
9
13
  id: zod_1.z.number().int(),
10
14
  number_order: zod_1.z.string(),
11
15
  product: zod_1.z
@@ -16,6 +16,7 @@ export declare const ShipmentsSchema: z.ZodObject<{
16
16
  ban: z.ZodDefault<z.ZodBoolean>;
17
17
  date_order: z.ZodDate;
18
18
  date_shipments: z.ZodDate;
19
+ warehouse_readiness_date: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
19
20
  number_order: z.ZodString;
20
21
  kol: z.ZodNumber;
21
22
  bron: z.ZodDefault<z.ZodBoolean>;
@@ -92,6 +93,7 @@ export declare const ShipmentsSchema: z.ZodObject<{
92
93
  purchasesId?: number | undefined;
93
94
  } | undefined;
94
95
  company_id?: number | undefined;
96
+ warehouse_readiness_date?: Date | null | undefined;
95
97
  parent_id?: number | null | undefined;
96
98
  }, {
97
99
  description: string;
@@ -120,6 +122,7 @@ export declare const ShipmentsSchema: z.ZodObject<{
120
122
  purchasesId?: number | undefined;
121
123
  } | undefined;
122
124
  company_id?: number | undefined;
125
+ warehouse_readiness_date?: Date | null | undefined;
123
126
  bron?: boolean | undefined;
124
127
  is_custom_product?: boolean | undefined;
125
128
  parent_id?: number | null | undefined;
@@ -9,6 +9,7 @@ exports.ShipmentsSchema = zod_1.z.object({
9
9
  ban: zod_1.z.boolean().default(false),
10
10
  date_order: zod_1.z.date(),
11
11
  date_shipments: zod_1.z.date(),
12
+ warehouse_readiness_date: zod_1.z.coerce.date().nullable().optional(),
12
13
  number_order: zod_1.z.string(),
13
14
  kol: zod_1.z.number().int().nonnegative(),
14
15
  bron: zod_1.z.boolean().default(false),
@@ -914,6 +914,7 @@ export declare const SpecificationAttributesSchema: z.ZodObject<{
914
914
  ban: z.ZodDefault<z.ZodBoolean>;
915
915
  date_order: z.ZodDate;
916
916
  date_shipments: z.ZodDate;
917
+ warehouse_readiness_date: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
917
918
  number_order: z.ZodString;
918
919
  kol: z.ZodNumber;
919
920
  bron: z.ZodDefault<z.ZodBoolean>;
@@ -990,6 +991,7 @@ export declare const SpecificationAttributesSchema: z.ZodObject<{
990
991
  purchasesId?: number | undefined;
991
992
  } | undefined;
992
993
  company_id?: number | undefined;
994
+ warehouse_readiness_date?: Date | null | undefined;
993
995
  parent_id?: number | null | undefined;
994
996
  }, {
995
997
  description: string;
@@ -1018,6 +1020,7 @@ export declare const SpecificationAttributesSchema: z.ZodObject<{
1018
1020
  purchasesId?: number | undefined;
1019
1021
  } | undefined;
1020
1022
  company_id?: number | undefined;
1023
+ warehouse_readiness_date?: Date | null | undefined;
1021
1024
  bron?: boolean | undefined;
1022
1025
  is_custom_product?: boolean | undefined;
1023
1026
  parent_id?: number | null | undefined;
@@ -1120,6 +1123,7 @@ export declare const SpecificationAttributesSchema: z.ZodObject<{
1120
1123
  purchasesId?: number | undefined;
1121
1124
  } | undefined;
1122
1125
  company_id?: number | undefined;
1126
+ warehouse_readiness_date?: Date | null | undefined;
1123
1127
  parent_id?: number | null | undefined;
1124
1128
  }[] | undefined;
1125
1129
  calculate_needs_time?: Date | null | undefined;
@@ -1407,6 +1411,7 @@ export declare const SpecificationAttributesSchema: z.ZodObject<{
1407
1411
  purchasesId?: number | undefined;
1408
1412
  } | undefined;
1409
1413
  company_id?: number | undefined;
1414
+ warehouse_readiness_date?: Date | null | undefined;
1410
1415
  bron?: boolean | undefined;
1411
1416
  is_custom_product?: boolean | undefined;
1412
1417
  parent_id?: number | null | undefined;
@@ -2504,6 +2509,7 @@ export declare const SpecificationAttributesSchema: z.ZodObject<{
2504
2509
  purchasesId?: number | undefined;
2505
2510
  } | undefined;
2506
2511
  company_id?: number | undefined;
2512
+ warehouse_readiness_date?: Date | null | undefined;
2507
2513
  parent_id?: number | null | undefined;
2508
2514
  }[] | undefined;
2509
2515
  calculate_needs_time?: Date | null | undefined;
@@ -2940,6 +2946,7 @@ export declare const SpecificationAttributesSchema: z.ZodObject<{
2940
2946
  purchasesId?: number | undefined;
2941
2947
  } | undefined;
2942
2948
  company_id?: number | undefined;
2949
+ warehouse_readiness_date?: Date | null | undefined;
2943
2950
  bron?: boolean | undefined;
2944
2951
  is_custom_product?: boolean | undefined;
2945
2952
  parent_id?: number | null | undefined;
@@ -5,17 +5,21 @@ export declare const UpdateUserTableConfigDtoSchema: z.ZodObject<{
5
5
  newConfigObject: z.ZodDefault<z.ZodArray<z.ZodObject<{
6
6
  columnName: z.ZodNativeEnum<typeof import("../..").tablesEnumConfig>;
7
7
  isShow: z.ZodDefault<z.ZodBoolean>;
8
+ position: z.ZodDefault<z.ZodNumber>;
8
9
  }, "strip", z.ZodTypeAny, {
10
+ position: number;
9
11
  columnName: import("../..").tablesEnumConfig;
10
12
  isShow: boolean;
11
13
  }, {
12
14
  columnName: import("../..").tablesEnumConfig;
15
+ position?: number | undefined;
13
16
  isShow?: boolean | undefined;
14
17
  }>, "many">>;
15
18
  }, "strip", z.ZodTypeAny, {
16
19
  userId: number;
17
20
  configKey: string;
18
21
  newConfigObject: {
22
+ position: number;
19
23
  columnName: import("../..").tablesEnumConfig;
20
24
  isShow: boolean;
21
25
  }[];
@@ -24,6 +28,7 @@ export declare const UpdateUserTableConfigDtoSchema: z.ZodObject<{
24
28
  configKey: string;
25
29
  newConfigObject?: {
26
30
  columnName: import("../..").tablesEnumConfig;
31
+ position?: number | undefined;
27
32
  isShow?: boolean | undefined;
28
33
  }[] | undefined;
29
34
  }>;
@@ -3,11 +3,14 @@ import { tablesEnumConfig } from '../../utils';
3
3
  export declare const UserTableConfigItemSchema: z.ZodObject<{
4
4
  columnName: z.ZodNativeEnum<typeof tablesEnumConfig>;
5
5
  isShow: z.ZodDefault<z.ZodBoolean>;
6
+ position: z.ZodDefault<z.ZodNumber>;
6
7
  }, "strip", z.ZodTypeAny, {
8
+ position: number;
7
9
  columnName: tablesEnumConfig;
8
10
  isShow: boolean;
9
11
  }, {
10
12
  columnName: tablesEnumConfig;
13
+ position?: number | undefined;
11
14
  isShow?: boolean | undefined;
12
15
  }>;
13
16
  export type UserTableConfigItem = z.infer<typeof UserTableConfigItemSchema>;
@@ -17,115 +20,147 @@ export declare const UserTableConfigSchema: z.ZodObject<{
17
20
  metalworking: z.ZodArray<z.ZodObject<{
18
21
  columnName: z.ZodNativeEnum<typeof tablesEnumConfig>;
19
22
  isShow: z.ZodDefault<z.ZodBoolean>;
23
+ position: z.ZodDefault<z.ZodNumber>;
20
24
  }, "strip", z.ZodTypeAny, {
25
+ position: number;
21
26
  columnName: tablesEnumConfig;
22
27
  isShow: boolean;
23
28
  }, {
24
29
  columnName: tablesEnumConfig;
30
+ position?: number | undefined;
25
31
  isShow?: boolean | undefined;
26
32
  }>, "many">;
27
33
  metalworking_deficit_by_assemble: z.ZodArray<z.ZodObject<{
28
34
  columnName: z.ZodNativeEnum<typeof tablesEnumConfig>;
29
35
  isShow: z.ZodDefault<z.ZodBoolean>;
36
+ position: z.ZodDefault<z.ZodNumber>;
30
37
  }, "strip", z.ZodTypeAny, {
38
+ position: number;
31
39
  columnName: tablesEnumConfig;
32
40
  isShow: boolean;
33
41
  }, {
34
42
  columnName: tablesEnumConfig;
43
+ position?: number | undefined;
35
44
  isShow?: boolean | undefined;
36
45
  }>, "many">;
37
46
  online_board_production: z.ZodArray<z.ZodObject<{
38
47
  columnName: z.ZodNativeEnum<typeof tablesEnumConfig>;
39
48
  isShow: z.ZodDefault<z.ZodBoolean>;
49
+ position: z.ZodDefault<z.ZodNumber>;
40
50
  }, "strip", z.ZodTypeAny, {
51
+ position: number;
41
52
  columnName: tablesEnumConfig;
42
53
  isShow: boolean;
43
54
  }, {
44
55
  columnName: tablesEnumConfig;
56
+ position?: number | undefined;
45
57
  isShow?: boolean | undefined;
46
58
  }>, "many">;
47
59
  online_board: z.ZodArray<z.ZodObject<{
48
60
  columnName: z.ZodNativeEnum<typeof tablesEnumConfig>;
49
61
  isShow: z.ZodDefault<z.ZodBoolean>;
62
+ position: z.ZodDefault<z.ZodNumber>;
50
63
  }, "strip", z.ZodTypeAny, {
64
+ position: number;
51
65
  columnName: tablesEnumConfig;
52
66
  isShow: boolean;
53
67
  }, {
54
68
  columnName: tablesEnumConfig;
69
+ position?: number | undefined;
55
70
  isShow?: boolean | undefined;
56
71
  }>, "many">;
57
72
  assemble: z.ZodArray<z.ZodObject<{
58
73
  columnName: z.ZodNativeEnum<typeof tablesEnumConfig>;
59
74
  isShow: z.ZodDefault<z.ZodBoolean>;
75
+ position: z.ZodDefault<z.ZodNumber>;
60
76
  }, "strip", z.ZodTypeAny, {
77
+ position: number;
61
78
  columnName: tablesEnumConfig;
62
79
  isShow: boolean;
63
80
  }, {
64
81
  columnName: tablesEnumConfig;
82
+ position?: number | undefined;
65
83
  isShow?: boolean | undefined;
66
84
  }>, "many">;
67
85
  production_task_by_user: z.ZodArray<z.ZodObject<{
68
86
  columnName: z.ZodNativeEnum<typeof tablesEnumConfig>;
69
87
  isShow: z.ZodDefault<z.ZodBoolean>;
88
+ position: z.ZodDefault<z.ZodNumber>;
70
89
  }, "strip", z.ZodTypeAny, {
90
+ position: number;
71
91
  columnName: tablesEnumConfig;
72
92
  isShow: boolean;
73
93
  }, {
74
94
  columnName: tablesEnumConfig;
95
+ position?: number | undefined;
75
96
  isShow?: boolean | undefined;
76
97
  }>, "many">;
77
98
  production_task_by_equipment: z.ZodArray<z.ZodObject<{
78
99
  columnName: z.ZodNativeEnum<typeof tablesEnumConfig>;
79
100
  isShow: z.ZodDefault<z.ZodBoolean>;
101
+ position: z.ZodDefault<z.ZodNumber>;
80
102
  }, "strip", z.ZodTypeAny, {
103
+ position: number;
81
104
  columnName: tablesEnumConfig;
82
105
  isShow: boolean;
83
106
  }, {
84
107
  columnName: tablesEnumConfig;
108
+ position?: number | undefined;
85
109
  isShow?: boolean | undefined;
86
110
  }>, "many">;
87
111
  production_task_by_operation: z.ZodArray<z.ZodObject<{
88
112
  columnName: z.ZodNativeEnum<typeof tablesEnumConfig>;
89
113
  isShow: z.ZodDefault<z.ZodBoolean>;
114
+ position: z.ZodDefault<z.ZodNumber>;
90
115
  }, "strip", z.ZodTypeAny, {
116
+ position: number;
91
117
  columnName: tablesEnumConfig;
92
118
  isShow: boolean;
93
119
  }, {
94
120
  columnName: tablesEnumConfig;
121
+ position?: number | undefined;
95
122
  isShow?: boolean | undefined;
96
123
  }>, "many">;
97
124
  }, "strip", z.ZodTypeAny, {
98
125
  id: number;
99
126
  assemble: {
127
+ position: number;
100
128
  columnName: tablesEnumConfig;
101
129
  isShow: boolean;
102
130
  }[];
103
131
  user_id: number;
104
132
  metalworking: {
133
+ position: number;
105
134
  columnName: tablesEnumConfig;
106
135
  isShow: boolean;
107
136
  }[];
108
137
  metalworking_deficit_by_assemble: {
138
+ position: number;
109
139
  columnName: tablesEnumConfig;
110
140
  isShow: boolean;
111
141
  }[];
112
142
  online_board_production: {
143
+ position: number;
113
144
  columnName: tablesEnumConfig;
114
145
  isShow: boolean;
115
146
  }[];
116
147
  online_board: {
148
+ position: number;
117
149
  columnName: tablesEnumConfig;
118
150
  isShow: boolean;
119
151
  }[];
120
152
  production_task_by_user: {
153
+ position: number;
121
154
  columnName: tablesEnumConfig;
122
155
  isShow: boolean;
123
156
  }[];
124
157
  production_task_by_equipment: {
158
+ position: number;
125
159
  columnName: tablesEnumConfig;
126
160
  isShow: boolean;
127
161
  }[];
128
162
  production_task_by_operation: {
163
+ position: number;
129
164
  columnName: tablesEnumConfig;
130
165
  isShow: boolean;
131
166
  }[];
@@ -133,35 +168,43 @@ export declare const UserTableConfigSchema: z.ZodObject<{
133
168
  id: number;
134
169
  assemble: {
135
170
  columnName: tablesEnumConfig;
171
+ position?: number | undefined;
136
172
  isShow?: boolean | undefined;
137
173
  }[];
138
174
  user_id: number;
139
175
  metalworking: {
140
176
  columnName: tablesEnumConfig;
177
+ position?: number | undefined;
141
178
  isShow?: boolean | undefined;
142
179
  }[];
143
180
  metalworking_deficit_by_assemble: {
144
181
  columnName: tablesEnumConfig;
182
+ position?: number | undefined;
145
183
  isShow?: boolean | undefined;
146
184
  }[];
147
185
  online_board_production: {
148
186
  columnName: tablesEnumConfig;
187
+ position?: number | undefined;
149
188
  isShow?: boolean | undefined;
150
189
  }[];
151
190
  online_board: {
152
191
  columnName: tablesEnumConfig;
192
+ position?: number | undefined;
153
193
  isShow?: boolean | undefined;
154
194
  }[];
155
195
  production_task_by_user: {
156
196
  columnName: tablesEnumConfig;
197
+ position?: number | undefined;
157
198
  isShow?: boolean | undefined;
158
199
  }[];
159
200
  production_task_by_equipment: {
160
201
  columnName: tablesEnumConfig;
202
+ position?: number | undefined;
161
203
  isShow?: boolean | undefined;
162
204
  }[];
163
205
  production_task_by_operation: {
164
206
  columnName: tablesEnumConfig;
207
+ position?: number | undefined;
165
208
  isShow?: boolean | undefined;
166
209
  }[];
167
210
  }>;
@@ -5,7 +5,8 @@ const zod_1 = require("zod");
5
5
  const utils_1 = require("../../utils");
6
6
  exports.UserTableConfigItemSchema = zod_1.z.object({
7
7
  columnName: zod_1.z.nativeEnum(utils_1.tablesEnumConfig),
8
- isShow: zod_1.z.boolean().default(true)
8
+ isShow: zod_1.z.boolean().default(true),
9
+ position: zod_1.z.number().int().nonnegative().default(0)
9
10
  });
10
11
  exports.UserTableConfigSchema = zod_1.z.object({
11
12
  id: zod_1.z.number().int().positive(),
@@ -32,6 +32,7 @@ export declare const UserSchema: z.ZodObject<{
32
32
  image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
33
  session_id: z.ZodNullable<z.ZodNumber>;
34
34
  last_online: z.ZodNullable<z.ZodNumber>;
35
+ createdAt: z.ZodOptional<z.ZodString>;
35
36
  rolesId: z.ZodNumber;
36
37
  role: z.ZodAny;
37
38
  documents: z.ZodArray<z.ZodObject<{
@@ -309,6 +310,7 @@ export declare const UserSchema: z.ZodObject<{
309
310
  action: import("../..").IActionText[];
310
311
  type_object: string;
311
312
  id?: number | null | undefined;
313
+ createdAt?: string | Date | undefined;
312
314
  responsible_id?: number | null | undefined;
313
315
  equipment_id?: number | null | undefined;
314
316
  user_id?: number | null | undefined;
@@ -338,13 +340,13 @@ export declare const UserSchema: z.ZodObject<{
338
340
  role_id?: number | null | undefined;
339
341
  parent_action_idL?: number | null | undefined;
340
342
  production_task_id?: number | null | undefined;
341
- createdAt?: string | Date | undefined;
342
343
  revision_id?: number | null | undefined;
343
344
  }, {
344
345
  action: import("../..").IActionText[];
345
346
  type_object: string;
346
347
  ban?: boolean | undefined;
347
348
  id?: number | null | undefined;
349
+ createdAt?: string | Date | undefined;
348
350
  responsible_id?: number | null | undefined;
349
351
  equipment_id?: number | null | undefined;
350
352
  user_id?: number | null | undefined;
@@ -374,7 +376,6 @@ export declare const UserSchema: z.ZodObject<{
374
376
  role_id?: number | null | undefined;
375
377
  parent_action_idL?: number | null | undefined;
376
378
  production_task_id?: number | null | undefined;
377
- createdAt?: string | Date | undefined;
378
379
  revision_id?: number | null | undefined;
379
380
  }>, "many">;
380
381
  responsibleForProduct: z.ZodArray<z.ZodObject<{
@@ -658,6 +659,7 @@ export declare const UserSchema: z.ZodObject<{
658
659
  action: import("../..").IActionText[];
659
660
  type_object: string;
660
661
  id?: number | null | undefined;
662
+ createdAt?: string | Date | undefined;
661
663
  responsible_id?: number | null | undefined;
662
664
  equipment_id?: number | null | undefined;
663
665
  user_id?: number | null | undefined;
@@ -687,7 +689,6 @@ export declare const UserSchema: z.ZodObject<{
687
689
  role_id?: number | null | undefined;
688
690
  parent_action_idL?: number | null | undefined;
689
691
  production_task_id?: number | null | undefined;
690
- createdAt?: string | Date | undefined;
691
692
  revision_id?: number | null | undefined;
692
693
  }[];
693
694
  responsibleForProduct: {
@@ -751,6 +752,7 @@ export declare const UserSchema: z.ZodObject<{
751
752
  }[];
752
753
  role?: any;
753
754
  image?: string | null | undefined;
755
+ createdAt?: string | undefined;
754
756
  subdivision?: import("../enums").EnumSubdivision | undefined;
755
757
  }, {
756
758
  banReason: string | null;
@@ -852,6 +854,7 @@ export declare const UserSchema: z.ZodObject<{
852
854
  type_object: string;
853
855
  ban?: boolean | undefined;
854
856
  id?: number | null | undefined;
857
+ createdAt?: string | Date | undefined;
855
858
  responsible_id?: number | null | undefined;
856
859
  equipment_id?: number | null | undefined;
857
860
  user_id?: number | null | undefined;
@@ -881,7 +884,6 @@ export declare const UserSchema: z.ZodObject<{
881
884
  role_id?: number | null | undefined;
882
885
  parent_action_idL?: number | null | undefined;
883
886
  production_task_id?: number | null | undefined;
884
- createdAt?: string | Date | undefined;
885
887
  revision_id?: number | null | undefined;
886
888
  }[];
887
889
  responsibleForProduct: {
@@ -954,6 +956,7 @@ export declare const UserSchema: z.ZodObject<{
954
956
  };
955
957
  }[] | undefined;
956
958
  image?: string | null | undefined;
959
+ createdAt?: string | undefined;
957
960
  subdivision?: import("../enums").EnumSubdivision | undefined;
958
961
  }>;
959
962
  export type ModelUser = z.infer<typeof UserSchema> & {
@@ -29,6 +29,7 @@ exports.UserSchema = zod_1.z.object({
29
29
  image: zod_1.z.string().nullish(),
30
30
  session_id: zod_1.z.number().int().nullable(),
31
31
  last_online: zod_1.z.number().int().nullable(),
32
+ createdAt: zod_1.z.string().optional(),
32
33
  rolesId: zod_1.z.number().int(),
33
34
  role: zod_1.z.any(),
34
35
  documents: zod_1.z.array(document_1.DocumentsSchema),
@@ -27,3 +27,4 @@ export * from './default-value/default-value';
27
27
  export * from './tables-config/enum';
28
28
  export * from './tables-config/methods';
29
29
  export * from './tables-config/tables-array';
30
+ export * from './sorting';
@@ -43,3 +43,4 @@ __exportStar(require("./default-value/default-value"), exports);
43
43
  __exportStar(require("./tables-config/enum"), exports);
44
44
  __exportStar(require("./tables-config/methods"), exports);
45
45
  __exportStar(require("./tables-config/tables-array"), exports);
46
+ __exportStar(require("./sorting"), exports);
@@ -0,0 +1,10 @@
1
+ type SortValue = Date | number | string | boolean | null | undefined;
2
+ type SortSelector<T> = (item: T) => SortValue;
3
+ export declare enum ProductionPlanSortField {
4
+ calculateNeedsTime = "calculateNeedsTime",
5
+ calculatedCreateTime = "calculatedCreateTime",
6
+ warehouseReadinessDate = "warehouseReadinessDate",
7
+ orderedByProduction = "orderedByProduction"
8
+ }
9
+ export declare const sortByDirection: <T>(items: T[], selector: SortSelector<T>, desc?: boolean) => T[];
10
+ export {};
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sortByDirection = exports.ProductionPlanSortField = void 0;
4
+ var ProductionPlanSortField;
5
+ (function (ProductionPlanSortField) {
6
+ ProductionPlanSortField["calculateNeedsTime"] = "calculateNeedsTime";
7
+ ProductionPlanSortField["calculatedCreateTime"] = "calculatedCreateTime";
8
+ ProductionPlanSortField["warehouseReadinessDate"] = "warehouseReadinessDate";
9
+ ProductionPlanSortField["orderedByProduction"] = "orderedByProduction";
10
+ })(ProductionPlanSortField || (exports.ProductionPlanSortField = ProductionPlanSortField = {}));
11
+ const normalizeSortValue = (value) => {
12
+ if (value instanceof Date)
13
+ return value.getTime();
14
+ if (typeof value === 'string') {
15
+ const dateTime = Date.parse(value);
16
+ return Number.isNaN(dateTime) ? value.toLocaleLowerCase() : dateTime;
17
+ }
18
+ return value;
19
+ };
20
+ const sortByDirection = (items, selector, desc = false) => {
21
+ return [...items].sort((firstItem, secondItem) => {
22
+ const firstValue = selector(firstItem);
23
+ const secondValue = selector(secondItem);
24
+ const isFirstNull = firstValue === null || firstValue === undefined;
25
+ const isSecondNull = secondValue === null || secondValue === undefined;
26
+ if (isFirstNull || isSecondNull) {
27
+ if (isFirstNull && isSecondNull)
28
+ return 0;
29
+ return isFirstNull ? (desc ? -1 : 1) : desc ? 1 : -1;
30
+ }
31
+ const normalizedFirstValue = normalizeSortValue(firstValue);
32
+ const normalizedSecondValue = normalizeSortValue(secondValue);
33
+ if (normalizedFirstValue < normalizedSecondValue)
34
+ return desc ? 1 : -1;
35
+ if (normalizedFirstValue > normalizedSecondValue)
36
+ return desc ? -1 : 1;
37
+ return 0;
38
+ });
39
+ };
40
+ exports.sortByDirection = sortByDirection;
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createCorrectColumnConfig = exports.checkMissingColumns = exports.generateDefaultConfigArray = void 0;
4
- const generateDefaultConfigArray = (configArray) => configArray.map(currentConfigitem => {
4
+ /**
5
+ * Нормализует порядок колонок и всегда пересчитывает позицию колонки
6
+ * по фактической позиции элемента в массиве.
7
+ */
8
+ const addPositionForColumns = (columns) => columns.map((currentColumn, index) => (Object.assign(Object.assign({}, currentColumn), { position: index })));
9
+ const generateDefaultConfigArray = (configArray) => addPositionForColumns(configArray.map(currentConfigitem => {
5
10
  return {
6
11
  columnName: currentConfigitem,
7
12
  isShow: true
8
13
  };
9
- });
14
+ }));
10
15
  exports.generateDefaultConfigArray = generateDefaultConfigArray;
11
16
  /**
12
17
  * Возвращает список колонок из `arrayToCheck`, которые отсутствуют в текущей конфигурации `columns`.
@@ -20,16 +25,28 @@ const checkMissingColumns = (columns, arrayToCheck) => {
20
25
  };
21
26
  exports.checkMissingColumns = checkMissingColumns;
22
27
  const createCorrectColumnConfig = (columns, arrayToCheck) => {
23
- const columnMap = new Map();
24
- columns.forEach(currentColumn => {
25
- columnMap.set(currentColumn.columnName, currentColumn);
28
+ const availableColumns = new Set(arrayToCheck);
29
+ const uniqueColumns = new Map();
30
+ columns
31
+ .filter(currentColumn => availableColumns.has(currentColumn.columnName))
32
+ .sort((leftColumn, rightColumn) => leftColumn.position - rightColumn.position)
33
+ .forEach(currentColumn => {
34
+ uniqueColumns.set(currentColumn.columnName, currentColumn);
35
+ });
36
+ const normalizedColumns = Array.from(uniqueColumns.values()).map(currentColumn => {
37
+ return {
38
+ columnName: currentColumn.columnName,
39
+ isShow: currentColumn.isShow
40
+ };
26
41
  });
27
- const newColumnArray = arrayToCheck.map(currentItem => {
28
- const currentItemFromMap = columnMap.get(currentItem);
29
- return currentItemFromMap
30
- ? currentItemFromMap
31
- : { columnName: currentItem, isShow: true };
42
+ arrayToCheck.forEach(currentItem => {
43
+ if (uniqueColumns.has(currentItem))
44
+ return;
45
+ normalizedColumns.push({
46
+ columnName: currentItem,
47
+ isShow: true
48
+ });
32
49
  });
33
- return newColumnArray;
50
+ return addPositionForColumns(normalizedColumns);
34
51
  };
35
52
  exports.createCorrectColumnConfig = createCorrectColumnConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pksep/zod-shared",
3
- "version": "0.0.531",
3
+ "version": "0.0.533",
4
4
  "description": "Zod package for erp project. Contains dto, interfaces, schems, types, enum",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",