Update plan with remaining phases

This commit is contained in:
gpt-engineer-app[bot]
2025-10-21 12:25:36 +00:00
parent 1138eea024
commit 638d49c8d9
3 changed files with 55 additions and 39 deletions

View File

@@ -3,7 +3,7 @@ import { serve } from "https://deno.land/std@0.190.0/http/server.ts";
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.57.4";
import { validateEntityData, validateEntityDataStrict } from "./validation.ts";
import { createErrorResponse } from "../_shared/errorSanitizer.ts";
import { edgeLogger } from "../_shared/logger.ts";
import { edgeLogger, startRequest, endRequest } from "../_shared/logger.ts";
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
@@ -47,17 +47,33 @@ const RIDE_MODEL_FIELDS = [
];
serve(async (req) => {
const tracking = startRequest(); // Start request tracking
if (req.method === 'OPTIONS') {
return new Response(null, { headers: corsHeaders });
}
try {
edgeLogger.info('Processing selective approval request', {
requestId: tracking.requestId,
traceId: tracking.traceId
});
// Verify authentication first with a client that respects RLS
const authHeader = req.headers.get('Authorization');
if (!authHeader) {
const duration = endRequest(tracking);
edgeLogger.warn('Authentication missing', { requestId: tracking.requestId, duration });
return new Response(
JSON.stringify({ error: 'Authentication required. Please log in.' }),
{ status: 401, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
JSON.stringify({ error: 'Authentication required. Please log in.', requestId: tracking.requestId }),
{
status: 401,
headers: {
...corsHeaders,
'Content-Type': 'application/json',
'X-Request-ID': tracking.requestId
}
}
);
}