41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { z } from "zod/v4";
|
|
|
|
import {
|
|
AssetInputSchema,
|
|
AssetSpecificationSchema,
|
|
AssetStatusSchema,
|
|
AssetValueSchema,
|
|
} from "../api/domain/asset-values";
|
|
|
|
import { RelationshipSchema } from "./relationships";
|
|
import { WorkstationSchema } from "./workstations";
|
|
|
|
export type { AssetCharacteristic, AssetInput } from "../api/domain/asset-values";
|
|
|
|
export { AssetInputSchema, AssetSpecificationSchema, AssetStatusSchema, AssetValueSchema };
|
|
export const InventoryParamsSchema = z.strictObject({ companyId: z.uuid() });
|
|
export const AssetParamsSchema = InventoryParamsSchema.extend({ id: z.uuid() });
|
|
export const SaveAssetRequestSchema = z.strictObject({ values: AssetInputSchema });
|
|
export const AssetRevisionSchema = z.strictObject({
|
|
id: z.uuid(),
|
|
values: AssetInputSchema,
|
|
actorId: z.uuid(),
|
|
actorName: z.string().min(1),
|
|
recordedAt: z.iso.datetime(),
|
|
});
|
|
export const AssetSchema = z.strictObject({
|
|
id: z.uuid(),
|
|
companyId: z.uuid(),
|
|
specification: AssetSpecificationSchema,
|
|
values: AssetInputSchema,
|
|
history: z.array(AssetRevisionSchema).min(1),
|
|
});
|
|
export const InventoryResponseSchema = z.strictObject({
|
|
workstations: z.array(WorkstationSchema),
|
|
assets: z.array(AssetSchema),
|
|
relationships: z.array(RelationshipSchema),
|
|
});
|
|
export const AssetResponseSchema = z.strictObject({ asset: AssetSchema });
|
|
export type AssetDTO = z.infer<typeof AssetSchema>;
|
|
export type AssetResponseDTO = z.infer<typeof AssetResponseSchema>;
|