diff --git a/frontend/app/api/admin/collections-requests/approve/route.ts b/frontend/app/api/admin/collections-requests/approve/route.ts index cbf5724..3cb6cb6 100644 --- a/frontend/app/api/admin/collections-requests/approve/route.ts +++ b/frontend/app/api/admin/collections-requests/approve/route.ts @@ -24,7 +24,7 @@ export async function POST(request: NextRequest) { return NextResponse.json({ error: updatedUserCollReqErr.message }, { status: 500 }); } - // Update the user's collections data in the database, set is_public = true + // Update the user's collections data in the database, set is_public to is_make_public console.log('is_public:', is_make_public); const { data: updatedUserCollections, error: updatedUserCollErr } = await supabase .from('collections') diff --git a/frontend/app/api/admin/collections-requests/route.ts b/frontend/app/api/admin/collections-requests/route.ts index 3589cd7..72aedbb 100644 --- a/frontend/app/api/admin/collections-requests/route.ts +++ b/frontend/app/api/admin/collections-requests/route.ts @@ -15,7 +15,25 @@ export async function GET(request: NextRequest) { // Retrieve the collections requests data from the database const { data: collectionsReq, error: collErr } = await supabase .from('collections_requests') - .select('collection_id, is_make_public, is_pending, is_approved, created_at, updated_at, collections (collection_id, id, display_name, description, is_public, users (id, name, email))') + .select(` + collection_id, + is_make_public, + is_pending, + is_approved, + created_at, + updated_at, + collections ( + id, + display_name, + description, + is_public, + users ( + id, + name, + email + ) + ) + `) .eq('is_pending', true); if (collErr) { diff --git a/frontend/app/api/admin/collections/route.ts b/frontend/app/api/admin/collections/route.ts index 1755399..4077210 100644 --- a/frontend/app/api/admin/collections/route.ts +++ b/frontend/app/api/admin/collections/route.ts @@ -15,7 +15,19 @@ export async function GET(request: NextRequest) { // Retrieve the collections requests data from the database const { data: collections, error: collErr } = await supabase .from('collections') - .select('collection_id, id, display_name, description, is_public, created_at, users (id, name, email)'); + .select(` + collection_id, + id, + display_name, + description, + is_public, + created_at, + users ( + id, + name, + email + ) + `); if (collErr) { console.error('Error fetching collections data from database:', collErr.message); @@ -57,7 +69,7 @@ export async function PUT(request: NextRequest) { .from('collections_requests') .delete() .eq('collection_id', collection_id); - + if (delError) { console.error('Error deleting collection requests data in database:', delError.message); return NextResponse.json({ error: delError.message }, { status: 500 }); diff --git a/frontend/app/api/admin/is-admin/route.ts b/frontend/app/api/admin/is-admin/route.ts index ef47cdc..e4d9d7b 100644 --- a/frontend/app/api/admin/is-admin/route.ts +++ b/frontend/app/api/admin/is-admin/route.ts @@ -36,7 +36,12 @@ export async function GET(request: NextRequest) { // Ensure user is an admin const { data: userData, error: userError } = await supabase .from('users') - .select('id, admins (id)') + .select(` + id, + admins ( + id + ) + `) .eq('id', userId) .single(); diff --git a/frontend/app/api/admin/users/route.ts b/frontend/app/api/admin/users/route.ts index d4d0c82..af4f242 100644 --- a/frontend/app/api/admin/users/route.ts +++ b/frontend/app/api/admin/users/route.ts @@ -15,7 +15,14 @@ export async function GET(request: NextRequest) { const { data: usersData, error: usersError } = await supabase .from('users') - .select('id, name, email, admins (id)'); + .select(` + id, + name, + email, + admins ( + id + ) + `); if (usersError) { console.error('Error fetching users data from database:', usersError.message); diff --git a/frontend/app/api/user/collections-requests/route.ts b/frontend/app/api/user/collections-requests/route.ts index 2989939..9f9d92f 100644 --- a/frontend/app/api/user/collections-requests/route.ts +++ b/frontend/app/api/user/collections-requests/route.ts @@ -38,7 +38,21 @@ export async function GET(request: NextRequest) { // Retrieve the user's collections and collections requests data via inner join from the database const { data: userCollectionsReq, error: userCollErr } = await supabase .from('collections') - .select('collection_id, display_name, description, is_public, created_at, collections_requests (collection_id, is_make_public, is_pending, is_approved, created_at, updated_at)') + .select(` + collection_id, + display_name, + description, + is_public, + created_at, + collections_requests ( + collection_id, + is_make_public, + is_pending, + is_approved, + created_at, + updated_at + ) + `) .eq('id', userId); if (userCollErr) {