Refactor: Rename timeline event to milestone

This commit is contained in:
gpt-engineer-app[bot]
2025-10-15 19:55:26 +00:00
parent 48693c2f58
commit 7f273a2082
3 changed files with 49 additions and 3 deletions

View File

@@ -940,7 +940,7 @@ export async function submitTimelineEvent(
.from('content_submissions')
.insert({
user_id: userId,
submission_type: 'timeline_event',
submission_type: 'milestone',
content,
status: 'pending',
approval_mode: 'full',
@@ -1030,7 +1030,7 @@ export async function submitTimelineEventUpdate(
.from('content_submissions')
.insert({
user_id: userId,
submission_type: 'timeline_event',
submission_type: 'milestone',
content,
status: 'pending',
approval_mode: 'full',

View File

@@ -290,7 +290,8 @@ serve(async (req) => {
await deletePhoto(supabase, resolvedData);
entityId = resolvedData.photo_id;
break;
case 'timeline_event':
case 'milestone':
case 'timeline_event': // Keep for backward compatibility
entityId = await createTimelineEvent(supabase, resolvedData, submitterId, authenticatedUserId, submissionId);
break;
default:

View File

@@ -0,0 +1,45 @@
-- Fix entity_timeline_events event_type constraint to include 'opening'
ALTER TABLE public.entity_timeline_events
DROP CONSTRAINT IF EXISTS entity_timeline_events_event_type_check;
ALTER TABLE public.entity_timeline_events
ADD CONSTRAINT entity_timeline_events_event_type_check
CHECK (event_type IN (
'name_change',
'operator_change',
'owner_change',
'location_change',
'status_change',
'opening',
'closure',
'reopening',
'renovation',
'expansion',
'acquisition',
'milestone',
'other'
));
-- Add 'milestone' to content_submissions submission_type constraint
ALTER TABLE public.content_submissions
DROP CONSTRAINT IF EXISTS content_submissions_submission_type_check;
ALTER TABLE public.content_submissions
ADD CONSTRAINT content_submissions_submission_type_check
CHECK (submission_type IN (
'park',
'ride',
'review',
'photo',
'manufacturer',
'operator',
'designer',
'property_owner',
'photo_edit',
'photo_delete',
'ride_model',
'milestone'
));
COMMENT ON CONSTRAINT content_submissions_submission_type_check ON public.content_submissions IS
'milestone submissions are for entity timeline/historical events';