mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 15:31:12 -05:00
Fix milestone entity display and validation
This commit is contained in:
@@ -33,7 +33,7 @@ export function SpecialFieldDisplay({ change, compact = false }: SpecialFieldDis
|
|||||||
return <DateFieldDisplay change={change} compact={compact} />;
|
return <DateFieldDisplay change={change} compact={compact} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fieldName.includes('_id') && fieldName !== 'id' && fieldName !== 'user_id') {
|
if (fieldName.includes('_id') && fieldName !== 'id' && fieldName !== 'user_id' && fieldName !== 'entity_id') {
|
||||||
return <RelationshipFieldDisplay change={change} compact={compact} />;
|
return <RelationshipFieldDisplay change={change} compact={compact} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -144,6 +144,25 @@ export const photoValidationSchema = z.object({
|
|||||||
photographer_credit: z.string().max(200, 'Credit must be less than 200 characters').optional(),
|
photographer_credit: z.string().max(200, 'Credit must be less than 200 characters').optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Milestone/Timeline Event Schema
|
||||||
|
export const milestoneValidationSchema = z.object({
|
||||||
|
title: z.string().min(1, 'Event title is required').max(200, 'Title must be less than 200 characters'),
|
||||||
|
description: z.string().max(2000, 'Description must be less than 2000 characters').optional(),
|
||||||
|
event_type: z.string().min(1, 'Event type is required'),
|
||||||
|
event_date: z.string().min(1, 'Event date is required'),
|
||||||
|
event_date_precision: z.enum(['day', 'month', 'year']).optional(),
|
||||||
|
entity_type: z.string().min(1, 'Entity type is required'),
|
||||||
|
entity_id: z.string().uuid('Invalid entity ID'),
|
||||||
|
is_public: z.boolean().optional(),
|
||||||
|
display_order: z.number().optional(),
|
||||||
|
from_value: z.string().optional(),
|
||||||
|
to_value: z.string().optional(),
|
||||||
|
from_entity_id: z.string().uuid().optional().nullable(),
|
||||||
|
to_entity_id: z.string().uuid().optional().nullable(),
|
||||||
|
from_location_id: z.string().uuid().optional().nullable(),
|
||||||
|
to_location_id: z.string().uuid().optional().nullable(),
|
||||||
|
});
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
// SCHEMA REGISTRY
|
// SCHEMA REGISTRY
|
||||||
// ============================================
|
// ============================================
|
||||||
@@ -157,6 +176,7 @@ export const entitySchemas = {
|
|||||||
property_owner: companyValidationSchema,
|
property_owner: companyValidationSchema,
|
||||||
ride_model: rideModelValidationSchema,
|
ride_model: rideModelValidationSchema,
|
||||||
photo: photoValidationSchema,
|
photo: photoValidationSchema,
|
||||||
|
milestone: milestoneValidationSchema,
|
||||||
};
|
};
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|||||||
Reference in New Issue
Block a user