test: implement resource template propagation tests for resource revisions feat: create prepareResourceTemplateUpdates function for handling resource template updates feat: add resource revision specifications for managing resource revisions in the database test: add tests for entity column visibility and local storage handling feat: implement entity column visibility storage for managing column preferences feat: create synchronizeTemplateStructure utility for managing template field and section synchronization
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
import { z } from "zod/v4";
|
|
|
|
import {
|
|
AssetInputSchema,
|
|
AssetRecordedInputSchema,
|
|
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: AssetRecordedInputSchema,
|
|
specification: AssetSpecificationSchema.optional(),
|
|
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,
|
|
displayStatus: z.enum(["available", "in_use", "broken", "maintenance", "retired"]),
|
|
assigned: z.boolean(),
|
|
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 { assetTechnicalStatus, canAssignAsset } from "../api/domain/asset-state";
|
|
|
|
export type AssetDTO = z.infer<typeof AssetSchema>;
|
|
|
|
export type AssetResponseDTO = z.infer<typeof AssetResponseSchema>;
|