File tree Expand file tree Collapse file tree
supabase/functions/delete-account Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,24 +72,20 @@ serve(async (req) => {
7272 // Fetch all listings for the user to delete their avatars
7373 const { data : listings , error : listingsError } = await supabaseAdmin
7474 . from ( "listings" )
75- . select ( "slug, avatar, photos" )
75+ . select ( "id, slug, avatar, photos" )
7676 . eq ( "owner_id" , user . id ) ;
7777 if ( listingsError ) {
7878 console . error ( "Listings fetch error:" , listingsError ) ;
7979 throw listingsError ;
8080 }
8181 // Delete media for each listing
8282 for ( const listing of listings ?? [ ] ) {
83- if ( ! listing . slug ) {
84- console . warn ( "Skipping listing media deletion because slug is missing" ) ;
85- continue ;
86- }
87-
8883 try {
8984 await deleteListingMedia ( supabaseAdmin , listing ) ;
9085 } catch ( error ) {
86+ const listingLabel = listing . slug ?? `id:${ listing . id } ` ;
9187 console . error (
92- `Error deleting media for listing ${ listing . slug } :` ,
88+ `Error deleting media for listing ${ listingLabel } :` ,
9389 error
9490 ) ;
9591 throw error ;
You can’t perform that action at this time.
0 commit comments