fix: update Dockerfile and remove .next from git
This commit is contained in:
@@ -1,21 +1,48 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { createClient } from '@/utils/supabase/server'
|
||||
import { redirect } from 'next/navigation'
|
||||
import { NextResponse } from 'next/server'
|
||||
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
// valid JSON body check (optional, but good for parsing)
|
||||
const body = await request.json();
|
||||
const supabase = await createClient()
|
||||
|
||||
// Log the request for now - placeholder for actual logic
|
||||
console.log('Delete account request received:', body);
|
||||
// Check if user is authenticated
|
||||
const {
|
||||
data: { user },
|
||||
} = await supabase.auth.getUser()
|
||||
|
||||
return NextResponse.json(
|
||||
{ message: 'Request received. Account deletion processed.' },
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Invalid request body' },
|
||||
{ status: 400 }
|
||||
);
|
||||
if (!user) {
|
||||
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
|
||||
}
|
||||
|
||||
// Perform soft deletes
|
||||
const now = new Date().toISOString()
|
||||
|
||||
// 1. Soft delete usage data (card_progress)
|
||||
await supabase
|
||||
.from('card_progress')
|
||||
.update({ deleted_at: now })
|
||||
.eq('user_id', user.id)
|
||||
|
||||
// 2. Soft delete content (decks)
|
||||
await supabase
|
||||
.from('decks')
|
||||
.update({ deleted_at: now })
|
||||
.eq('creator_id', user.id)
|
||||
|
||||
// 3. Soft delete organization (folders)
|
||||
await supabase
|
||||
.from('folders')
|
||||
.update({ deleted_at: now })
|
||||
.eq('user_id', user.id)
|
||||
|
||||
// 4. Soft delete profile
|
||||
await supabase
|
||||
.from('profiles')
|
||||
.update({ deleted_at: now })
|
||||
.eq('id', user.id)
|
||||
|
||||
// 5. Sign out
|
||||
await supabase.auth.signOut()
|
||||
|
||||
return NextResponse.redirect(new URL('/', request.url))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user