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:
pac7
2025-10-08 13:56:00 +00:00
parent 9eb5e61d4a
commit 543e7fe81e
2 changed files with 41 additions and 2 deletions

View File

@@ -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' } }
);
}