mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 12:51:16 -05:00
Refactor: Implement cleanup plan
This commit is contained in:
@@ -20,14 +20,7 @@ export function UppyPhotoSubmissionUpload({
|
||||
entityId,
|
||||
entityType,
|
||||
parentId,
|
||||
// Legacy props (deprecated)
|
||||
parkId,
|
||||
rideId,
|
||||
}: UppyPhotoSubmissionUploadProps) {
|
||||
// Support legacy props
|
||||
const finalEntityId = entityId || rideId || parkId || '';
|
||||
const finalEntityType = entityType || (rideId ? 'ride' : parkId ? 'park' : 'ride');
|
||||
const finalParentId = parentId || (rideId ? parkId : undefined);
|
||||
const [title, setTitle] = useState('');
|
||||
const [photos, setPhotos] = useState<PhotoWithCaption[]>([]);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
@@ -203,9 +196,9 @@ export function UppyPhotoSubmissionUpload({
|
||||
.from('photo_submissions')
|
||||
.insert({
|
||||
submission_id: submissionData.id,
|
||||
entity_type: finalEntityType,
|
||||
entity_id: finalEntityId,
|
||||
parent_id: finalParentId || null,
|
||||
entity_type: entityType,
|
||||
entity_id: entityId,
|
||||
parent_id: parentId || null,
|
||||
title: title.trim() || null,
|
||||
})
|
||||
.select()
|
||||
@@ -239,8 +232,8 @@ export function UppyPhotoSubmissionUpload({
|
||||
console.log('✅ Photo submission created:', {
|
||||
submission_id: submissionData.id,
|
||||
photo_submission_id: photoSubmissionData.id,
|
||||
entity_type: finalEntityType,
|
||||
entity_id: finalEntityId,
|
||||
entity_type: entityType,
|
||||
entity_id: entityId,
|
||||
photo_count: photoItems.length,
|
||||
});
|
||||
|
||||
@@ -285,12 +278,9 @@ export function UppyPhotoSubmissionUpload({
|
||||
|
||||
const metadata = {
|
||||
submissionType: 'photo',
|
||||
entityId: finalEntityId,
|
||||
entityType: finalEntityType,
|
||||
parentId: finalParentId,
|
||||
// Legacy support
|
||||
parkId: finalEntityType === 'park' ? finalEntityId : finalParentId,
|
||||
rideId: finalEntityType === 'ride' ? finalEntityId : undefined,
|
||||
entityId,
|
||||
entityType,
|
||||
parentId,
|
||||
userId: user?.id,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user