mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 10:31:13 -05:00
Refactor: Rename timeline event to milestone
This commit is contained in:
@@ -940,7 +940,7 @@ export async function submitTimelineEvent(
|
|||||||
.from('content_submissions')
|
.from('content_submissions')
|
||||||
.insert({
|
.insert({
|
||||||
user_id: userId,
|
user_id: userId,
|
||||||
submission_type: 'timeline_event',
|
submission_type: 'milestone',
|
||||||
content,
|
content,
|
||||||
status: 'pending',
|
status: 'pending',
|
||||||
approval_mode: 'full',
|
approval_mode: 'full',
|
||||||
@@ -1030,7 +1030,7 @@ export async function submitTimelineEventUpdate(
|
|||||||
.from('content_submissions')
|
.from('content_submissions')
|
||||||
.insert({
|
.insert({
|
||||||
user_id: userId,
|
user_id: userId,
|
||||||
submission_type: 'timeline_event',
|
submission_type: 'milestone',
|
||||||
content,
|
content,
|
||||||
status: 'pending',
|
status: 'pending',
|
||||||
approval_mode: 'full',
|
approval_mode: 'full',
|
||||||
|
|||||||
@@ -290,7 +290,8 @@ serve(async (req) => {
|
|||||||
await deletePhoto(supabase, resolvedData);
|
await deletePhoto(supabase, resolvedData);
|
||||||
entityId = resolvedData.photo_id;
|
entityId = resolvedData.photo_id;
|
||||||
break;
|
break;
|
||||||
case 'timeline_event':
|
case 'milestone':
|
||||||
|
case 'timeline_event': // Keep for backward compatibility
|
||||||
entityId = await createTimelineEvent(supabase, resolvedData, submitterId, authenticatedUserId, submissionId);
|
entityId = await createTimelineEvent(supabase, resolvedData, submitterId, authenticatedUserId, submissionId);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -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';
|
||||||
Reference in New Issue
Block a user