File tree Expand file tree Collapse file tree
backend/supabase/migrations
dashboard/src/app/api/service Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ create or replace function update_full_url (p_service_id integer )
2+ returns void
3+ security definer
4+ language plpgsql
5+ as
6+ $$
7+ begin
8+ update public .endpoints e
9+ set full_url = concat(s .base_url , e .name )
10+ from public .services s
11+ where s .id = p_service_id and e .service_id = s .id ;
12+ end;
13+ $$;
Original file line number Diff line number Diff line change 11import { NextResponse } from 'next/server' ;
22import { randomBytes , createCipheriv } from "crypto" ;
3- import { dropServiceEndpointsCaches } from "@/app/api/utils" ;
3+ import { dropServiceEndpointsCaches } from "@/app/api/utils" ;
44import { createClient } from '@/utils/supabase/server' ;
55import { env } from 'next-runtime-env' ;
66
@@ -49,10 +49,16 @@ export async function POST(req: Request) {
4949 . eq ( "id" , body . id )
5050 . select ( )
5151 . single ( ) ;
52+
53+ if ( result . error ) throw result . error ;
54+
55+ result = await supabase . rpc ( "update_full_url" , { p_service_id : body . id } )
5256 }
5357
5458 if ( result . error ) throw result . error ;
59+
5560 await dropServiceEndpointsCaches ( userId ! , body . serviceName ) ;
61+
5662 return NextResponse . json ( result . data ) ;
5763 } catch ( error : any ) {
5864 return NextResponse . json (
You can’t perform that action at this time.
0 commit comments