Remove deprecated ModulePlaceholderPage component for dashboard modules. This file was previously used as a catch-all for remaining modules but is no longer needed due to the introduction of dedicated route folders for Batch A modules.

This commit is contained in:
smueller
2026-07-22 15:47:34 +02:00
parent 38979b3c8b
commit e0b4077552
7 changed files with 405 additions and 60 deletions

View File

@@ -0,0 +1,53 @@
import { CommandOverrideDashboardUpsertSchema } from '@nexumi/shared';
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import { resetCommandOverrideDashboard, upsertCommandOverrideDashboard } from '@/lib/module-configs/commands';
import { prisma } from '@/lib/prisma';
interface RouteParams {
params: Promise<{ guildId: string; commandName: string }>;
}
export async function PATCH(request: NextRequest, { params }: RouteParams) {
const { guildId, commandName } = await params;
try {
const session = await requireGuildAccess(guildId);
const body = await request.json();
const input = CommandOverrideDashboardUpsertSchema.parse({ ...body, commandName });
const updated = await upsertCommandOverrideDashboard(guildId, input);
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'commands.update',
path: `/dashboard/${guildId}/commands`,
after: updated
});
return NextResponse.json(updated);
} catch (error) {
return toApiErrorResponse(error);
}
}
export async function DELETE(_request: NextRequest, { params }: RouteParams) {
const { guildId, commandName } = await params;
try {
const session = await requireGuildAccess(guildId);
const reset = await resetCommandOverrideDashboard(guildId, commandName);
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'commands.reset',
path: `/dashboard/${guildId}/commands`,
after: reset
});
return NextResponse.json(reset);
} catch (error) {
return toApiErrorResponse(error);
}
}

View File

@@ -0,0 +1,18 @@
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { listCommandOverridesDashboard } from '@/lib/module-configs/commands';
interface RouteParams {
params: Promise<{ guildId: string }>;
}
export async function GET(_request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
await requireGuildAccess(guildId);
const commands = await listCommandOverridesDashboard(guildId);
return NextResponse.json({ commands });
} catch (error) {
return toApiErrorResponse(error);
}
}