Fix Next.js 15 compatibility and TypeScript errors

- Update API route handlers to use async params for Next.js 15 compatibility
- Fix MUI DataGrid deprecated props (pageSize -> initialState.pagination)
- Replace Material-UI Grid components with Box for better compatibility
- Fix admin authentication system with proper request parameters
- Update permission constants to match available AdminPermission enum values
- Add missing properties to Page interface for type safety
- Update .gitignore to exclude venv/, import logs, and large data directories
- Optimize Next.js config to reduce memory usage during builds

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-24 09:54:13 +00:00
parent b0dd6c1a4b
commit 4303e48fac
25 changed files with 269 additions and 91 deletions

View File

@@ -9,8 +9,8 @@ export async function GET(
{ params }: { params: Promise<{ id: string }> }
) {
try {
const admin = await getCurrentAdmin();
if (!admin || !hasPermission(admin, AdminPermission.MODERATE_CONTENT)) {
const admin = await getCurrentAdmin(request as any);
if (!admin || !hasPermission(admin, AdminPermission.DELETE_CONTENT)) {
return NextResponse.json(
{ error: 'Unauthorized' },
{ status: 401 }
@@ -80,8 +80,8 @@ export async function PUT(
{ params }: { params: Promise<{ id: string }> }
) {
try {
const admin = await getCurrentAdmin();
if (!admin || !hasPermission(admin, AdminPermission.MODERATE_CONTENT)) {
const admin = await getCurrentAdmin(request as any);
if (!admin || !hasPermission(admin, AdminPermission.DELETE_CONTENT)) {
return NextResponse.json(
{ error: 'Unauthorized' },
{ status: 401 }
@@ -142,8 +142,8 @@ export async function DELETE(
{ params }: { params: Promise<{ id: string }> }
) {
try {
const admin = await getCurrentAdmin();
if (!admin || !hasPermission(admin, AdminPermission.MODERATE_CONTENT)) {
const admin = await getCurrentAdmin(request as any);
if (!admin || !hasPermission(admin, AdminPermission.DELETE_CONTENT)) {
return NextResponse.json(
{ error: 'Unauthorized' },
{ status: 401 }

View File

@@ -6,8 +6,8 @@ export const runtime = 'nodejs';
export async function GET(request: Request) {
try {
const admin = await getCurrentAdmin();
if (!admin || !hasPermission(admin, AdminPermission.MODERATE_CONTENT)) {
const admin = await getCurrentAdmin(request as any);
if (!admin || !hasPermission(admin, AdminPermission.DELETE_CONTENT)) {
return NextResponse.json(
{ error: 'Unauthorized' },
{ status: 401 }