- Simplified asset assignment validation in SequelizeAssetRepository. - Updated asset module to include legacy asset assignment migration. - Enhanced inventory assignment logic to better handle asset-person relationships. - Improved localization strings for asset guidance and scope. - Removed person assignment display from asset detail view. - Streamlined inventory page by removing person-related filters and displays. - Adjusted asset form to eliminate person assignment input. - Updated tests to reflect changes in asset and person handling. - Added phone link component for better phone number formatting and linking. - Enhanced person details view to include current workstations and improved layout. - Refactored person avatar component to support children and improved rendering.
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { z } from "zod/v4";
|
|
|
|
import { FieldTypeSchema, TemplateSectionSchema } from "./asset-definition";
|
|
|
|
export const AssetStatusSchema = z.enum(["available", "in_use", "maintenance", "retired"]);
|
|
export const AssetCharacteristicSchema = z.strictObject({
|
|
fieldId: z.uuid(),
|
|
name: z.string().min(1).max(100),
|
|
type: FieldTypeSchema,
|
|
unit: z.string().max(30),
|
|
choices: z.array(z.string().min(1).max(100)),
|
|
required: z.boolean(),
|
|
sectionId: z.uuid().optional(),
|
|
});
|
|
export const AssetValueSchema = z.union([z.string().max(10000), z.number().finite(), z.boolean()]);
|
|
export const AssetInputSchema = z.strictObject({
|
|
name: z.string().min(1).max(100),
|
|
templateId: z.uuid(),
|
|
siteId: z.uuid().nullable(),
|
|
brandId: z.uuid().nullable().optional(),
|
|
status: AssetStatusSchema,
|
|
notes: z.string().max(10000),
|
|
characteristics: z.record(z.uuid(), AssetValueSchema),
|
|
});
|
|
export const AssetSpecificationSchema = z.strictObject({
|
|
templateId: z.uuid(),
|
|
templateName: z.string().min(1).max(100),
|
|
sections: z.array(TemplateSectionSchema).max(30).optional(),
|
|
fields: z.array(AssetCharacteristicSchema).min(1).max(100),
|
|
});
|
|
export type AssetInput = z.infer<typeof AssetInputSchema>;
|
|
export type AssetSpecificationData = z.infer<typeof AssetSpecificationSchema>;
|
|
export type AssetCharacteristic = z.infer<typeof AssetCharacteristicSchema>;
|