mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 22:31:12 -05:00
Fix validation and approval issues
This commit is contained in:
@@ -225,6 +225,27 @@ export const milestoneValidationSchema = z.object({
|
||||
path: ['from_value'],
|
||||
});
|
||||
|
||||
// ============================================
|
||||
// PHOTO OPERATION SCHEMAS
|
||||
// ============================================
|
||||
|
||||
export const photoEditValidationSchema = z.object({
|
||||
photo_id: z.string().uuid('Invalid photo ID'),
|
||||
cloudflare_image_url: z.string().url('Invalid image URL'),
|
||||
caption: z.string().trim().max(500, 'Caption must be less than 500 characters').optional().or(z.literal('')),
|
||||
title: z.string().trim().max(200, 'Title must be less than 200 characters').optional().or(z.literal('')),
|
||||
entity_type: z.string().min(1, 'Entity type is required'),
|
||||
entity_id: z.string().uuid('Invalid entity ID'),
|
||||
});
|
||||
|
||||
export const photoDeleteValidationSchema = z.object({
|
||||
photo_id: z.string().uuid('Invalid photo ID'),
|
||||
cloudflare_image_id: z.string().min(1, 'Image ID is required'),
|
||||
cloudflare_image_url: z.string().url('Invalid image URL').optional(),
|
||||
entity_type: z.string().min(1, 'Entity type is required'),
|
||||
entity_id: z.string().uuid('Invalid entity ID'),
|
||||
});
|
||||
|
||||
// ============================================
|
||||
// SCHEMA REGISTRY
|
||||
// ============================================
|
||||
@@ -238,6 +259,8 @@ export const entitySchemas = {
|
||||
property_owner: companyValidationSchema,
|
||||
ride_model: rideModelValidationSchema,
|
||||
photo: photoValidationSchema,
|
||||
photo_edit: photoEditValidationSchema,
|
||||
photo_delete: photoDeleteValidationSchema,
|
||||
milestone: milestoneValidationSchema,
|
||||
timeline_event: milestoneValidationSchema, // Alias for milestone
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user