Remove influencer-era documentation, unused components, boilerplate assets, and ghost tiktok cron job. Add supplier invoice management, document API routes, and PWA icons. Replace boilerplate README. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
38 lines
1021 B
TypeScript
38 lines
1021 B
TypeScript
import { createClient } from '@/lib/supabase/server'
|
|
import { NextResponse } from 'next/server'
|
|
import { ensureInitialized } from '@/lib/init'
|
|
import { verifyIntegrity } from '@/lib/core/documents/document-service'
|
|
|
|
ensureInitialized()
|
|
|
|
/**
|
|
* POST /api/documents/:id/verify
|
|
* Verify document integrity by re-computing SHA-256 and comparing
|
|
*/
|
|
export async function POST(
|
|
request: Request,
|
|
{ params }: { params: Promise<{ id: string }> }
|
|
) {
|
|
const supabase = await createClient()
|
|
|
|
const { data: { user } } = await supabase.auth.getUser()
|
|
|
|
if (!user) {
|
|
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
|
|
}
|
|
|
|
const { id } = await params
|
|
|
|
try {
|
|
const result = await verifyIntegrity(user.id, id)
|
|
|
|
return NextResponse.json({ data: result })
|
|
} catch (error) {
|
|
console.error('[documents/verify/POST] Verification failed:', error)
|
|
return NextResponse.json(
|
|
{ error: error instanceof Error ? error.message : 'Verification failed' },
|
|
{ status: 500 }
|
|
)
|
|
}
|
|
}
|