@pksep/zod-shared 0.0.520 → 0.0.521
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/production-tasks/schemas/operation-positions.schema.d.ts +3 -0
- package/dist/production-tasks/schemas/operation-positions.schema.js +1 -0
- package/dist/user/dto/get-one-user.dto.d.ts +16 -0
- package/dist/user/dto/get-one-user.dto.js +25 -0
- package/dist/user/index.d.ts +1 -0
- package/dist/user/index.js +1 -0
- package/dist/utils/date.methods.d.ts +7 -1
- package/dist/utils/date.methods.js +14 -1
- package/dist/utils/methods.d.ts +17 -11
- package/dist/utils/methods.js +15 -20
- package/dist/utils/operation.d.ts +1 -1
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ export declare const OperationPositionSchema: z.ZodObject<{
|
|
|
14
14
|
equipment_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
15
15
|
production_operation_pos_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
16
16
|
operation_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
17
|
+
count_created: z.ZodDefault<z.ZodNumber>;
|
|
17
18
|
plan_ready_time: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
18
19
|
is_relevance: z.ZodDefault<z.ZodBoolean>;
|
|
19
20
|
createdAt: z.ZodDate;
|
|
@@ -24,6 +25,7 @@ export declare const OperationPositionSchema: z.ZodObject<{
|
|
|
24
25
|
createdAt: Date;
|
|
25
26
|
updatedAt: Date;
|
|
26
27
|
create_time_minutes: number;
|
|
28
|
+
count_created: number;
|
|
27
29
|
is_relevance: boolean;
|
|
28
30
|
user_id?: number | null | undefined;
|
|
29
31
|
idx?: number | undefined;
|
|
@@ -46,6 +48,7 @@ export declare const OperationPositionSchema: z.ZodObject<{
|
|
|
46
48
|
detal_idx?: number | undefined;
|
|
47
49
|
create_time_minutes?: number | undefined;
|
|
48
50
|
production_operation_pos_id?: number | null | undefined;
|
|
51
|
+
count_created?: number | undefined;
|
|
49
52
|
plan_ready_time?: Date | null | undefined;
|
|
50
53
|
is_relevance?: boolean | undefined;
|
|
51
54
|
}>;
|
|
@@ -13,6 +13,7 @@ exports.OperationPositionSchema = zod_1.z.object({
|
|
|
13
13
|
equipment_id: zod_1.z.number().int().nullish(),
|
|
14
14
|
production_operation_pos_id: zod_1.z.number().nullish(),
|
|
15
15
|
operation_id: zod_1.z.number().int().nullish(),
|
|
16
|
+
count_created: zod_1.z.number().int().nonnegative().default(0),
|
|
16
17
|
plan_ready_time: zod_1.z.date().nullish(),
|
|
17
18
|
is_relevance: zod_1.z.boolean().default(true),
|
|
18
19
|
createdAt: zod_1.z.date(),
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const UserIncludeSchema: z.ZodEnum<["role", "documents", "avatars", "detals", "cbeds", "products", "equipments", "actions", "actionsUser", "responsibleForProduct", "responsibleForDocuments", "typeOperations", "tableConfigs"]>;
|
|
3
|
+
export declare const GetOneUserDtoSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodNumber;
|
|
5
|
+
includes: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<["role", "documents", "avatars", "detals", "cbeds", "products", "equipments", "actions", "actionsUser", "responsibleForProduct", "responsibleForDocuments", "typeOperations", "tableConfigs"]>, "many">>>, ("role" | "documents" | "equipments" | "actions" | "products" | "cbeds" | "responsibleForProduct" | "responsibleForDocuments" | "typeOperations" | "detals" | "avatars" | "actionsUser" | "tableConfigs")[], unknown>;
|
|
6
|
+
attributes: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>, string[], unknown>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
includes: ("role" | "documents" | "equipments" | "actions" | "products" | "cbeds" | "responsibleForProduct" | "responsibleForDocuments" | "typeOperations" | "detals" | "avatars" | "actionsUser" | "tableConfigs")[];
|
|
9
|
+
id: number;
|
|
10
|
+
attributes: string[];
|
|
11
|
+
}, {
|
|
12
|
+
id: number;
|
|
13
|
+
includes?: unknown;
|
|
14
|
+
attributes?: unknown;
|
|
15
|
+
}>;
|
|
16
|
+
export type GetOneUserDtoType = z.infer<typeof GetOneUserDtoSchema>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetOneUserDtoSchema = exports.UserIncludeSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
exports.UserIncludeSchema = zod_1.z.enum([
|
|
7
|
+
'role',
|
|
8
|
+
'documents',
|
|
9
|
+
'avatars',
|
|
10
|
+
'detals',
|
|
11
|
+
'cbeds',
|
|
12
|
+
'products',
|
|
13
|
+
'equipments',
|
|
14
|
+
'actions',
|
|
15
|
+
'actionsUser',
|
|
16
|
+
'responsibleForProduct',
|
|
17
|
+
'responsibleForDocuments',
|
|
18
|
+
'typeOperations',
|
|
19
|
+
'tableConfigs'
|
|
20
|
+
]);
|
|
21
|
+
exports.GetOneUserDtoSchema = zod_1.z.object({
|
|
22
|
+
id: zod_1.z.number(),
|
|
23
|
+
includes: zod_1.z.preprocess(value => typeof value === 'string' ? (0, utils_1.parseParamsOrBody)({ value }, []) : value, zod_1.z.array(exports.UserIncludeSchema).optional().default([])),
|
|
24
|
+
attributes: zod_1.z.preprocess(value => typeof value === 'string' ? (0, utils_1.parseParamsOrBody)({ value }, []) : value, zod_1.z.array(zod_1.z.string()).optional().default([]))
|
|
25
|
+
});
|
package/dist/user/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './dto/add-role.dto';
|
|
2
2
|
export * from './dto/ban-user.dto';
|
|
3
3
|
export * from './dto/get-users.dto';
|
|
4
|
+
export * from './dto/get-one-user.dto';
|
|
4
5
|
export * from './dto/create-user.dto';
|
|
5
6
|
export * from './schemas/user.schema';
|
|
6
7
|
export * from './interfaces/create-user.interface';
|
package/dist/user/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./dto/add-role.dto"), exports);
|
|
18
18
|
__exportStar(require("./dto/ban-user.dto"), exports);
|
|
19
19
|
__exportStar(require("./dto/get-users.dto"), exports);
|
|
20
|
+
__exportStar(require("./dto/get-one-user.dto"), exports);
|
|
20
21
|
__exportStar(require("./dto/create-user.dto"), exports);
|
|
21
22
|
__exportStar(require("./schemas/user.schema"), exports);
|
|
22
23
|
__exportStar(require("./interfaces/create-user.interface"), exports);
|
|
@@ -28,7 +28,13 @@ export declare class DateMethods {
|
|
|
28
28
|
* @param planReadyTime
|
|
29
29
|
* @returns
|
|
30
30
|
*/
|
|
31
|
-
calculateDeltaTime: (calculatedCreateTime: Date, planReadyTime: Date
|
|
31
|
+
calculateDeltaTime: (calculatedCreateTime: Date, planReadyTime: Date, config?: {
|
|
32
|
+
holidays?: Array<{
|
|
33
|
+
month: number;
|
|
34
|
+
day: number;
|
|
35
|
+
}>;
|
|
36
|
+
skipDefaultJanuaryHolidays?: boolean;
|
|
37
|
+
}) => number;
|
|
32
38
|
/**
|
|
33
39
|
* Функция возвращает текущее время в UTC формате
|
|
34
40
|
* @param config
|
|
@@ -54,7 +54,7 @@ class DateMethods {
|
|
|
54
54
|
* @param planReadyTime
|
|
55
55
|
* @returns
|
|
56
56
|
*/
|
|
57
|
-
this.calculateDeltaTime = (calculatedCreateTime, planReadyTime) => {
|
|
57
|
+
this.calculateDeltaTime = (calculatedCreateTime, planReadyTime, config) => {
|
|
58
58
|
const calculatedCreateTimeDate = new Date(calculatedCreateTime);
|
|
59
59
|
const planReadyTimeDate = new Date(planReadyTime);
|
|
60
60
|
const sign = calculatedCreateTimeDate <= planReadyTimeDate ? 1 : -1;
|
|
@@ -68,7 +68,20 @@ class DateMethods {
|
|
|
68
68
|
const workDayHours = 8;
|
|
69
69
|
const workDayEndHour = workDayStartHour + workDayHours;
|
|
70
70
|
const isWorkDay = (date) => {
|
|
71
|
+
var _a, _b;
|
|
71
72
|
const dayOfWeek = date.getUTCDay();
|
|
73
|
+
const month = date.getUTCMonth();
|
|
74
|
+
const day = date.getUTCDate();
|
|
75
|
+
const skipJanuary = (_a = config === null || config === void 0 ? void 0 : config.skipDefaultJanuaryHolidays) !== null && _a !== void 0 ? _a : true;
|
|
76
|
+
if (skipJanuary && month === 0 && day >= 1 && day <= 14) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
if ((_b = config === null || config === void 0 ? void 0 : config.holidays) === null || _b === void 0 ? void 0 : _b.length) {
|
|
80
|
+
const isHoliday = config.holidays.some((h) => h.month === month && h.day === day);
|
|
81
|
+
if (isHoliday) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
72
85
|
return dayOfWeek !== 0 && dayOfWeek !== 6;
|
|
73
86
|
};
|
|
74
87
|
let totalMinutes = 0;
|
package/dist/utils/methods.d.ts
CHANGED
|
@@ -40,21 +40,27 @@ export declare const leftToDoByProductionTask: (marks: ModelMarks[], myQuantity:
|
|
|
40
40
|
* @param startDate
|
|
41
41
|
* @param totalMinutes
|
|
42
42
|
* @returns
|
|
43
|
-
* Возвращает время окончания работы над
|
|
44
|
-
* Обратить внимание, что считается только рабочее время.
|
|
45
|
-
* Суббота и воскресенье не считаются за рабочий день.
|
|
46
|
-
*/
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @param startDate
|
|
50
|
-
* @param totalMinutes
|
|
51
|
-
* @returns
|
|
52
|
-
* Возвращает время окончания работы над ТЗ
|
|
43
|
+
* Возвращает время окончания работы над ПЗ
|
|
53
44
|
* Обратить внимание, что считается только рабочее время.
|
|
54
45
|
* Суббота и воскресенье не считаются за рабочий день.
|
|
55
46
|
* Если startDate выходит за пределы рабочего времени, отсчет начинается от ближайшей рабочей даты.
|
|
56
47
|
*/
|
|
57
|
-
export
|
|
48
|
+
export interface HolidayConfig {
|
|
49
|
+
/**
|
|
50
|
+
* Массив кастомных выходных дней
|
|
51
|
+
* month: 0-11 (где 0 - январь), day: 1-31
|
|
52
|
+
*/
|
|
53
|
+
holidays?: Array<{
|
|
54
|
+
month: number;
|
|
55
|
+
day: number;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Пропускать стандартные новогодние праздники (с 1 по 14 января).
|
|
59
|
+
* По умолчанию true.
|
|
60
|
+
*/
|
|
61
|
+
skipDefaultJanuaryHolidays?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export declare const calculateEndDate: (startDate: Date, totalMinutes: number, config?: HolidayConfig) => Date;
|
|
58
64
|
/**
|
|
59
65
|
* Функция получает сущность и генерирует из него элемент спецификации
|
|
60
66
|
* @param entity
|
package/dist/utils/methods.js
CHANGED
|
@@ -113,26 +113,7 @@ const leftToDoByProductionTask = (marks, myQuantity) => {
|
|
|
113
113
|
return moreMinusNum(myQuantity - createByMarks);
|
|
114
114
|
};
|
|
115
115
|
exports.leftToDoByProductionTask = leftToDoByProductionTask;
|
|
116
|
-
|
|
117
|
-
*
|
|
118
|
-
* @param startDate
|
|
119
|
-
* @param totalMinutes
|
|
120
|
-
* @returns
|
|
121
|
-
* Возвращает время окончания работы над ТЗ
|
|
122
|
-
* Обратить внимание, что считается только рабочее время.
|
|
123
|
-
* Суббота и воскресенье не считаются за рабочий день.
|
|
124
|
-
*/
|
|
125
|
-
/**
|
|
126
|
-
*
|
|
127
|
-
* @param startDate
|
|
128
|
-
* @param totalMinutes
|
|
129
|
-
* @returns
|
|
130
|
-
* Возвращает время окончания работы над ТЗ
|
|
131
|
-
* Обратить внимание, что считается только рабочее время.
|
|
132
|
-
* Суббота и воскресенье не считаются за рабочий день.
|
|
133
|
-
* Если startDate выходит за пределы рабочего времени, отсчет начинается от ближайшей рабочей даты.
|
|
134
|
-
*/
|
|
135
|
-
const calculateEndDate = (startDate, totalMinutes) => {
|
|
116
|
+
const calculateEndDate = (startDate, totalMinutes, config) => {
|
|
136
117
|
let currentDate = new Date(startDate);
|
|
137
118
|
let remainingMinutes = totalMinutes;
|
|
138
119
|
const workDayStartHour = 5;
|
|
@@ -140,7 +121,21 @@ const calculateEndDate = (startDate, totalMinutes) => {
|
|
|
140
121
|
const workDayEndHour = workDayStartHour + workDayHours;
|
|
141
122
|
// Функция для проверки, является ли дата рабочим днем
|
|
142
123
|
const isWorkDay = (date) => {
|
|
124
|
+
var _a, _b;
|
|
143
125
|
const dayOfWeek = date.getUTCDay();
|
|
126
|
+
const month = date.getUTCMonth();
|
|
127
|
+
const day = date.getUTCDate();
|
|
128
|
+
const skipJanuary = (_a = config === null || config === void 0 ? void 0 : config.skipDefaultJanuaryHolidays) !== null && _a !== void 0 ? _a : true;
|
|
129
|
+
if (skipJanuary && month === 0 && day >= 1 && day <= 14) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
// Проверяем кастомные праздники из конфига
|
|
133
|
+
if ((_b = config === null || config === void 0 ? void 0 : config.holidays) === null || _b === void 0 ? void 0 : _b.length) {
|
|
134
|
+
const isHoliday = config.holidays.some(holiday => holiday.month === month && holiday.day === day);
|
|
135
|
+
if (isHoliday) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
144
139
|
return dayOfWeek !== 0 && dayOfWeek !== 6;
|
|
145
140
|
};
|
|
146
141
|
const getWorkDayStart = (date) => {
|
|
@@ -25,7 +25,7 @@ export declare class OperationTime {
|
|
|
25
25
|
preTime: number;
|
|
26
26
|
mainTime: number;
|
|
27
27
|
helperTime: number;
|
|
28
|
-
} | null, count?: number);
|
|
28
|
+
} | null | ModelOperation, count?: number);
|
|
29
29
|
private timeKolvo;
|
|
30
30
|
}
|
|
31
31
|
export declare function worksHors(operation: any, kolvo_all?: number): number;
|