diff --git a/backend-api/src/controllers/AssetController.ts b/backend-api/src/controllers/AssetController.ts index 3cd5a98..517ab91 100644 --- a/backend-api/src/controllers/AssetController.ts +++ b/backend-api/src/controllers/AssetController.ts @@ -3,17 +3,18 @@ import {z} from 'zod'; import {AssetService} from '../services/AssetService'; import {AssetRepository} from '../repositories/AssetRepository'; import {getUserId} from '../middleware/auth'; -type AssetType = 'cash' | 'investment' | 'property' | 'vehicle' | 'other'; + +const ASSET_TYPES = ['cash', 'investment', 'property', 'vehicle', 'other'] as const; const createAssetSchema = z.object({ name: z.string().min(1), - type: z.nativeEnum(AssetType), + type: z.enum(ASSET_TYPES), value: z.number().min(0), }); const updateAssetSchema = z.object({ name: z.string().min(1).optional(), - type: z.nativeEnum(AssetType).optional(), + type: z.enum(ASSET_TYPES).optional(), value: z.number().min(0).optional(), });