metis-desk/modules/assets/src/common/relationships.ts

26 lines
942 B
TypeScript
Raw Normal View History

2026-10-04 19:04:14 +00:00
import { z } from "zod/v4";
2026-10-09 08:38:19 +00:00
import { RelationshipValuesSchema } from "../api/domain/value-objects/asset-relationship-values.vo";
2026-10-04 19:04:14 +00:00
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>;