каркас вроде есть
This commit is contained in:
@@ -0,0 +1,192 @@
|
||||
// Зеркало DTO и enum'ов backend (Tnsu.ApprovalRoute.Api / Application / Domain).
|
||||
// Имена и форма типов должны 1:1 соответствовать C#-стороне — см.
|
||||
// backend/src/Tnsu.ApprovalRoute.Domain/Enums/*.cs и
|
||||
// backend/src/Tnsu.ApprovalRoute.Application/**/*.cs
|
||||
|
||||
export enum RouteType {
|
||||
None = 'None',
|
||||
Parallel = 'Parallel',
|
||||
Sequential = 'Sequential'
|
||||
}
|
||||
|
||||
export enum RouteStepStatus {
|
||||
None = 'None',
|
||||
Approval = 'Approval',
|
||||
Execution = 'Execution'
|
||||
}
|
||||
|
||||
export enum ProjectRole {
|
||||
None = 'None',
|
||||
ProjectManager = 'ProjectManager',
|
||||
Planner = 'Planner',
|
||||
ManagerHSE = 'ManagerHSE',
|
||||
Security = 'Security'
|
||||
}
|
||||
|
||||
export enum HeadType {
|
||||
None = 'None',
|
||||
Chief = 'Chief',
|
||||
DirectionHead = 'DirectionHead',
|
||||
DirectorTansu = 'DirectorTansu'
|
||||
}
|
||||
|
||||
export const routeTypeLabels: Record<RouteType, string> = {
|
||||
[RouteType.None]: 'Не задан',
|
||||
[RouteType.Parallel]: 'Параллельный',
|
||||
[RouteType.Sequential]: 'Последовательный'
|
||||
};
|
||||
|
||||
export const routeStepStatusLabels: Record<RouteStepStatus, string> = {
|
||||
[RouteStepStatus.None]: 'Не задан',
|
||||
[RouteStepStatus.Approval]: 'Согласование',
|
||||
[RouteStepStatus.Execution]: 'Исполнение'
|
||||
};
|
||||
|
||||
export const projectRoleLabels: Record<ProjectRole, string> = {
|
||||
[ProjectRole.None]: '—',
|
||||
[ProjectRole.ProjectManager]: 'Руководитель проекта',
|
||||
[ProjectRole.Planner]: 'Планировщик',
|
||||
[ProjectRole.ManagerHSE]: 'Менеджер HSE',
|
||||
[ProjectRole.Security]: 'Безопасность'
|
||||
};
|
||||
|
||||
export const headTypeLabels: Record<HeadType, string> = {
|
||||
[HeadType.None]: '—',
|
||||
[HeadType.Chief]: 'Непосредственный руководитель',
|
||||
[HeadType.DirectionHead]: 'Руководитель направления',
|
||||
[HeadType.DirectorTansu]: 'Директор Tansu'
|
||||
};
|
||||
|
||||
// ---- Request Types (api/request-types) ----
|
||||
|
||||
export interface RequestType {
|
||||
id: number;
|
||||
name: string;
|
||||
pageUrl: string;
|
||||
}
|
||||
|
||||
export interface CreateRequestTypeInput {
|
||||
name: string;
|
||||
pageUrl: string;
|
||||
}
|
||||
|
||||
export type UpdateRequestTypeInput = CreateRequestTypeInput;
|
||||
|
||||
export interface PatchRequestTypeInput {
|
||||
name?: string;
|
||||
pageUrl?: string;
|
||||
}
|
||||
|
||||
// ---- Template Routes (api/template-routes) ----
|
||||
|
||||
export interface TemplateRoute {
|
||||
id: number;
|
||||
routeType: RouteType;
|
||||
requestTypeId: number;
|
||||
departmentId: string | null;
|
||||
companyId: string;
|
||||
byProject: boolean;
|
||||
requiresControl: boolean;
|
||||
}
|
||||
|
||||
export interface CreateTemplateRouteInput {
|
||||
routeType: RouteType;
|
||||
requestTypeId: number;
|
||||
departmentId: string | null;
|
||||
companyId: string;
|
||||
byProject: boolean;
|
||||
requiresControl: boolean;
|
||||
}
|
||||
|
||||
export interface UpdateTemplateRouteInput {
|
||||
routeType: RouteType;
|
||||
departmentId: string | null;
|
||||
companyId: string;
|
||||
byProject: boolean;
|
||||
requiresControl: boolean;
|
||||
}
|
||||
|
||||
export interface PatchTemplateRouteInput {
|
||||
routeType?: RouteType;
|
||||
departmentId?: string | null;
|
||||
companyId?: string;
|
||||
byProject?: boolean;
|
||||
requiresControl?: boolean;
|
||||
}
|
||||
|
||||
// ---- Template Route Steps (api/template-routes/{routeId}/steps) ----
|
||||
|
||||
export interface TemplateRouteStep {
|
||||
id: number;
|
||||
orderNo: number;
|
||||
executorEmail: string | null;
|
||||
position: string | null;
|
||||
projectRole: ProjectRole | null;
|
||||
headType: HeadType | null;
|
||||
status: RouteStepStatus;
|
||||
routeId: number;
|
||||
allowReassignToOtherApprovers: boolean;
|
||||
warning?: string | null;
|
||||
}
|
||||
|
||||
export interface CreateTemplateRouteStepInput {
|
||||
orderNo: number;
|
||||
executorEmail: string | null;
|
||||
position: string | null;
|
||||
projectRole: ProjectRole | null;
|
||||
headType: HeadType | null;
|
||||
status: RouteStepStatus;
|
||||
allowReassignToOtherApprovers: boolean;
|
||||
}
|
||||
|
||||
export type UpdateTemplateRouteStepInput = CreateTemplateRouteStepInput;
|
||||
|
||||
export interface PatchTemplateRouteStepInput {
|
||||
orderNo?: number;
|
||||
executorEmail?: string | null;
|
||||
position?: string | null;
|
||||
projectRole?: ProjectRole | null;
|
||||
headType?: HeadType | null;
|
||||
status?: RouteStepStatus;
|
||||
allowReassignToOtherApprovers?: boolean;
|
||||
}
|
||||
|
||||
// ---- Resolve (api/template-routes/resolve) ----
|
||||
|
||||
export interface ResolveTemplateRouteQuery {
|
||||
requestTypeId: number;
|
||||
userEmail?: string;
|
||||
projectId?: string;
|
||||
status: RouteStepStatus;
|
||||
}
|
||||
|
||||
export interface ResolvedRouteStep {
|
||||
id: number;
|
||||
orderNo: number;
|
||||
executorEmail: string | null;
|
||||
position: string | null;
|
||||
allowReassignToOtherApprovers: boolean;
|
||||
}
|
||||
|
||||
export interface ResolveTemplateRouteResult {
|
||||
routeId: number;
|
||||
routeType: RouteType;
|
||||
requiresControl: boolean;
|
||||
steps: ResolvedRouteStep[];
|
||||
}
|
||||
|
||||
// Ровно одно из этих полей должно быть заполнено на шаге маршрута
|
||||
// (см. TemplateRouteStepFields.CountFilled на бэкенде).
|
||||
export type StepExecutorKind = 'email' | 'position' | 'projectRole' | 'headType';
|
||||
|
||||
export function detectExecutorKind(step: {
|
||||
executorEmail?: string | null;
|
||||
position?: string | null;
|
||||
projectRole?: ProjectRole | null;
|
||||
headType?: HeadType | null;
|
||||
}): StepExecutorKind {
|
||||
if (step.executorEmail) return 'email';
|
||||
if (step.position) return 'position';
|
||||
if (step.projectRole && step.projectRole !== ProjectRole.None) return 'projectRole';
|
||||
return 'headType';
|
||||
}
|
||||
Reference in New Issue
Block a user