mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 11:11:16 -05:00
Improve error handling and data assignment in test data seeding
Fixes TypeScript errors in the seed data edge function by correctly assigning `userId` instead of `user.id` and safely accessing error messages. Replit-Commit-Author: Agent Replit-Commit-Session-Id: a8c5cf3e-a80e-462f-b090-b081acdcf03a Replit-Commit-Checkpoint-Type: intermediate_checkpoint
This commit is contained in:
@@ -122,7 +122,7 @@ Deno.serve(async (req) => {
|
||||
}
|
||||
|
||||
if (options.expiredLock) {
|
||||
submissionData.assigned_to = user.id;
|
||||
submissionData.assigned_to = userId;
|
||||
submissionData.locked_until = new Date(Date.now() - 1000 * 60 * 30).toISOString(); // 30 min ago
|
||||
}
|
||||
|
||||
@@ -282,8 +282,9 @@ Deno.serve(async (req) => {
|
||||
|
||||
} catch (error) {
|
||||
console.error('Seed error:', error);
|
||||
const errorMessage = error instanceof Error ? error.message : 'An unknown error occurred';
|
||||
return new Response(
|
||||
JSON.stringify({ error: error.message }),
|
||||
JSON.stringify({ error: errorMessage }),
|
||||
{ status: 500, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user