63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
import { z } from "zod/v4";
|
|
|
|
import {
|
|
ProcessReferenceSchema,
|
|
ProcessTemplateInputSchema,
|
|
ProcessValuesSchema,
|
|
} from "../api/domain/process-values";
|
|
|
|
export type {
|
|
ProcessReferenceInput,
|
|
ProcessTaskInput,
|
|
ProcessTemplateInput,
|
|
StartProcessInput,
|
|
UpdateProcessInput,
|
|
} from "../api/domain/process-values";
|
|
|
|
export {
|
|
ProcessReferenceSchema,
|
|
ProcessTemplateInputSchema,
|
|
ProcessValuesSchema,
|
|
StartProcessInputSchema,
|
|
UpdateProcessInputSchema,
|
|
} from "../api/domain/process-values";
|
|
|
|
const audit = {
|
|
id: z.uuid(),
|
|
actorId: z.uuid().nullable(),
|
|
actorName: z.string().min(1),
|
|
recordedAt: z.iso.datetime(),
|
|
};
|
|
|
|
export const ProcessTemplateSchema = z.strictObject({
|
|
id: z.uuid(),
|
|
values: ProcessTemplateInputSchema,
|
|
history: z.array(z.strictObject({ ...audit, values: ProcessTemplateInputSchema })).min(1),
|
|
});
|
|
|
|
export const PersonProcessSchema = z.strictObject({
|
|
id: z.uuid(),
|
|
companyId: z.uuid(),
|
|
values: ProcessValuesSchema,
|
|
history: z.array(z.strictObject({ ...audit, values: ProcessValuesSchema })).min(1),
|
|
review: z.array(ProcessReferenceSchema),
|
|
});
|
|
|
|
export const ProcessTemplatesResponseSchema = z.strictObject({
|
|
templates: z.array(ProcessTemplateSchema),
|
|
});
|
|
|
|
export const ProcessTemplateResponseSchema = z.strictObject({ template: ProcessTemplateSchema });
|
|
|
|
export const ProcessesResponseSchema = z.strictObject({ processes: z.array(PersonProcessSchema) });
|
|
|
|
export const ProcessResponseSchema = z.strictObject({ process: PersonProcessSchema });
|
|
|
|
export const ProcessReviewResponseSchema = z.strictObject({
|
|
review: z.array(ProcessReferenceSchema),
|
|
});
|
|
|
|
export type ProcessTemplateDTO = z.infer<typeof ProcessTemplateSchema>;
|
|
|
|
export type PersonProcessDTO = z.infer<typeof PersonProcessSchema>;
|