Fix authentication state persistence and admin role display
- Implement complete authentication system with JWT token validation - Add auth provider with persistent login state across page refreshes - Create multilingual login/register forms with Material-UI components - Fix token validation using raw SQL queries to bypass Prisma sync issues - Add comprehensive error handling for expired/invalid tokens - Create profile and settings pages with full i18n support - Add proper user role management (admin/user) with database sync - Implement secure middleware with CSRF protection and auth checks - Add debug endpoints for troubleshooting authentication issues - Fix Zustand store persistence for authentication state 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
35
app/api/debug/schema/route.ts
Normal file
35
app/api/debug/schema/route.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { NextResponse } from 'next/server'
|
||||
import { prisma } from '@/lib/db'
|
||||
|
||||
export const runtime = 'nodejs'
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
// Get table structure for User table
|
||||
const tableInfo = await prisma.$queryRaw`
|
||||
SELECT column_name, data_type, is_nullable, column_default
|
||||
FROM information_schema.columns
|
||||
WHERE table_name = 'User' AND table_schema = 'public'
|
||||
ORDER BY ordinal_position;
|
||||
`
|
||||
|
||||
// Also try to get one user record to see what fields are actually there
|
||||
let sampleUser = null
|
||||
try {
|
||||
sampleUser = await prisma.$queryRaw`SELECT * FROM "User" LIMIT 1;`
|
||||
} catch (e) {
|
||||
sampleUser = { error: 'Could not fetch sample user: ' + e.message }
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
tableStructure: tableInfo,
|
||||
sampleUser: sampleUser
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Schema debug error:', error)
|
||||
return NextResponse.json({
|
||||
error: 'Schema debug failed',
|
||||
details: error.message
|
||||
}, { status: 500 })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user