mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 23:31:12 -05:00
Fix: Handle internal errors
This commit is contained in:
@@ -565,7 +565,7 @@ export async function submitParkUpdate(
|
||||
item_type: 'park',
|
||||
action_type: 'edit',
|
||||
item_data: JSON.parse(JSON.stringify({
|
||||
...extractChangedFields(data, existingPark),
|
||||
...extractChangedFields(data, existingPark as any),
|
||||
park_id: parkId, // Always include for relational integrity
|
||||
images: processedImages
|
||||
})) as Json,
|
||||
@@ -848,7 +848,7 @@ export async function submitRideUpdate(
|
||||
item_type: 'ride',
|
||||
action_type: 'edit',
|
||||
item_data: {
|
||||
...extractChangedFields(data, existingRide),
|
||||
...extractChangedFields(data, existingRide as any),
|
||||
ride_id: rideId, // Always include for relational integrity
|
||||
images: processedImages as unknown as Json
|
||||
},
|
||||
@@ -1012,7 +1012,7 @@ export async function submitRideModelUpdate(
|
||||
item_type: 'ride_model',
|
||||
action_type: 'edit',
|
||||
item_data: {
|
||||
...extractChangedFields(data, existingModel),
|
||||
...extractChangedFields(data, existingModel as any),
|
||||
ride_model_id: rideModelId, // Always include for relational integrity
|
||||
images: processedImages as unknown as Json
|
||||
},
|
||||
@@ -1124,7 +1124,7 @@ export async function submitManufacturerUpdate(
|
||||
item_type: 'manufacturer',
|
||||
action_type: 'edit',
|
||||
item_data: {
|
||||
...extractChangedFields(data, existingCompany as Partial<CompanyDatabaseRecord>),
|
||||
...extractChangedFields(data, existingCompany as any),
|
||||
company_id: companyId, // Always include for relational integrity
|
||||
company_type: 'manufacturer', // Always include for entity type discrimination
|
||||
images: processedImages as unknown as Json
|
||||
@@ -1232,7 +1232,7 @@ export async function submitDesignerUpdate(
|
||||
item_type: 'designer',
|
||||
action_type: 'edit',
|
||||
item_data: {
|
||||
...extractChangedFields(data, existingCompany as Partial<CompanyDatabaseRecord>),
|
||||
...extractChangedFields(data, existingCompany as any),
|
||||
company_id: companyId, // Always include for relational integrity
|
||||
company_type: 'designer', // Always include for entity type discrimination
|
||||
images: processedImages as unknown as Json
|
||||
@@ -1340,7 +1340,7 @@ export async function submitOperatorUpdate(
|
||||
item_type: 'operator',
|
||||
action_type: 'edit',
|
||||
item_data: {
|
||||
...extractChangedFields(data, existingCompany as Partial<CompanyDatabaseRecord>),
|
||||
...extractChangedFields(data, existingCompany as any),
|
||||
company_id: companyId, // Always include for relational integrity
|
||||
company_type: 'operator', // Always include for entity type discrimination
|
||||
images: processedImages as unknown as Json
|
||||
@@ -1448,7 +1448,7 @@ export async function submitPropertyOwnerUpdate(
|
||||
item_type: 'property_owner',
|
||||
action_type: 'edit',
|
||||
item_data: {
|
||||
...extractChangedFields(data, existingCompany as Partial<CompanyDatabaseRecord>),
|
||||
...extractChangedFields(data, existingCompany as any),
|
||||
company_id: companyId, // Always include for relational integrity
|
||||
company_type: 'property_owner', // Always include for entity type discrimination
|
||||
images: processedImages as unknown as Json
|
||||
|
||||
@@ -164,7 +164,7 @@ export function transformRideModelData(submissionData: RideModelSubmissionData):
|
||||
slug: submissionData.slug,
|
||||
manufacturer_id: submissionData.manufacturer_id,
|
||||
category: submissionData.category,
|
||||
ride_type: submissionData.ride_type || null,
|
||||
ride_type: (submissionData.ride_type || null) as string,
|
||||
description: submissionData.description || null,
|
||||
banner_image_url: submissionData.banner_image_url || null,
|
||||
banner_image_id: submissionData.banner_image_id || null,
|
||||
|
||||
@@ -344,7 +344,12 @@ class NotificationService {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return data || [];
|
||||
return (data || []).map(t => ({
|
||||
...t,
|
||||
is_active: t.is_active ?? true,
|
||||
description: t.description || undefined,
|
||||
novu_workflow_id: t.novu_workflow_id || undefined
|
||||
}));
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error fetching notification templates', {
|
||||
action: 'fetch_notification_templates',
|
||||
|
||||
@@ -96,9 +96,9 @@ export function normalizePhotoSubmissionItems(
|
||||
id: item.id,
|
||||
url: item.cloudflare_image_url,
|
||||
filename: item.filename || `Photo ${item.order_index + 1}`,
|
||||
caption: item.caption,
|
||||
title: item.title,
|
||||
date_taken: item.date_taken,
|
||||
caption: item.caption || undefined,
|
||||
title: item.title || undefined,
|
||||
date_taken: item.date_taken || undefined,
|
||||
order_index: item.order_index,
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -115,12 +115,12 @@ async function logRequestMetadata(metadata: RequestMetadata): Promise<void> {
|
||||
p_method: metadata.method,
|
||||
p_status_code: metadata.statusCode,
|
||||
p_duration_ms: metadata.duration,
|
||||
p_error_type: metadata.errorType || null,
|
||||
p_error_message: metadata.errorMessage || null,
|
||||
p_user_agent: metadata.userAgent || null,
|
||||
p_client_version: metadata.clientVersion || null,
|
||||
p_parent_request_id: metadata.parentRequestId || null,
|
||||
p_trace_id: metadata.traceId || null,
|
||||
p_error_type: metadata.errorType ?? undefined,
|
||||
p_error_message: metadata.errorMessage ?? undefined,
|
||||
p_user_agent: metadata.userAgent ?? undefined,
|
||||
p_client_version: metadata.clientVersion ?? undefined,
|
||||
p_parent_request_id: metadata.parentRequestId ?? undefined,
|
||||
p_trace_id: metadata.traceId ?? undefined,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -74,7 +74,7 @@ export async function fetchSubmissionItems(submissionId: string): Promise<Submis
|
||||
* Build dependency tree for submission items
|
||||
*/
|
||||
export function buildDependencyTree(items: SubmissionItemWithDeps[]): SubmissionItemWithDeps[] {
|
||||
const itemMap = new Map(items.map(item => [item.id, { ...item, dependencies: [], dependents: [] }]));
|
||||
const itemMap = new Map(items.map(item => [item.id, { ...item, dependencies: [] as SubmissionItemWithDeps[], dependents: [] as SubmissionItemWithDeps[] }]));
|
||||
|
||||
// Build relationships
|
||||
items.forEach(item => {
|
||||
|
||||
Reference in New Issue
Block a user