26 lines
942 B
TypeScript
26 lines
942 B
TypeScript
import { z } from "zod/v4";
|
|
|
|
import { RelationshipValuesSchema } from "../api/domain/value-objects/asset-relationship-values.vo";
|
|
|
|
export const RelationshipInputSchema = z.strictObject({
|
|
sourceId: z.uuid(),
|
|
targetId: z.uuid(),
|
|
typeId: z.uuid(),
|
|
notes: z.string().max(10000),
|
|
});
|
|
export type RelationshipInputDTO = z.infer<typeof RelationshipInputSchema>;
|
|
export const RelationshipRequestSchema = z.strictObject({ values: RelationshipInputSchema });
|
|
export const RelationshipSchema = z.strictObject({
|
|
id: z.uuid(),
|
|
companyId: z.uuid(),
|
|
values: RelationshipValuesSchema,
|
|
createdBy: z.uuid(),
|
|
createdByName: z.string(),
|
|
createdAt: z.iso.datetime(),
|
|
endedBy: z.uuid().nullable(),
|
|
endedByName: z.string().nullable(),
|
|
endedAt: z.iso.datetime().nullable(),
|
|
});
|
|
export const RelationshipResponseSchema = z.strictObject({ relationship: RelationshipSchema });
|
|
export type RelationshipDTO = z.infer<typeof RelationshipSchema>;
|