Refactor giveaway job processing and enhance environment documentation

- Improved handling of the `giveawayCreate` job in the bot's job processing for better consistency.
- Updated `.env.example` to clarify the usage of `BOT_TOKEN` for both the bot and WebUI.
- Added `bullmq` dependency to the WebUI package for enhanced job management capabilities.
This commit is contained in:
smueller
2026-07-22 15:31:03 +02:00
parent 429f974bfc
commit 387fbf11da
32 changed files with 2620 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
import { BirthdayConfigDashboardPatchSchema } from '@nexumi/shared';
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import { getBirthdayDashboard, updateBirthdayDashboard } from '@/lib/module-configs/birthdays';
import { prisma } from '@/lib/prisma';
interface RouteParams {
params: Promise<{ guildId: string }>;
}
export async function GET(_request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
await requireGuildAccess(guildId);
const config = await getBirthdayDashboard(guildId);
return NextResponse.json(config);
} catch (error) {
return toApiErrorResponse(error);
}
}
export async function PATCH(request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
const session = await requireGuildAccess(guildId);
const body = await request.json();
const patch = BirthdayConfigDashboardPatchSchema.parse(body);
const before = await getBirthdayDashboard(guildId);
const after = await updateBirthdayDashboard(guildId, patch);
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'birthdays.update',
path: `/dashboard/${guildId}/birthdays`,
before,
after
});
return NextResponse.json(after);
} catch (error) {
return toApiErrorResponse(error);
}
}

View File

@@ -0,0 +1,44 @@
import { GiveawayActionSchema } from '@nexumi/shared';
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import { endGiveawayDashboard, setGiveawayPaused } from '@/lib/module-configs/giveaways';
import { prisma } from '@/lib/prisma';
interface RouteParams {
params: Promise<{ guildId: string; giveawayId: string }>;
}
export async function POST(request: NextRequest, { params }: RouteParams) {
const { guildId, giveawayId } = await params;
try {
const session = await requireGuildAccess(guildId);
const body = await request.json();
const action = GiveawayActionSchema.parse(body.action);
let giveaway;
if (action === 'end') {
giveaway = await endGiveawayDashboard(guildId, giveawayId);
} else if (action === 'pause') {
giveaway = await setGiveawayPaused(guildId, giveawayId, true);
} else {
giveaway = await setGiveawayPaused(guildId, giveawayId, false);
}
if (!giveaway) {
return NextResponse.json({ error: 'Giveaway not found or already ended' }, { status: 404 });
}
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: `giveaways.${action}`,
path: `/dashboard/${guildId}/giveaways`,
after: giveaway
});
return NextResponse.json(giveaway);
} catch (error) {
return toApiErrorResponse(error);
}
}

View File

@@ -0,0 +1,32 @@
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import { deleteGiveawayDashboard } from '@/lib/module-configs/giveaways';
import { prisma } from '@/lib/prisma';
interface RouteParams {
params: Promise<{ guildId: string; giveawayId: string }>;
}
export async function DELETE(_request: NextRequest, { params }: RouteParams) {
const { guildId, giveawayId } = await params;
try {
const session = await requireGuildAccess(guildId);
const deleted = await deleteGiveawayDashboard(guildId, giveawayId);
if (!deleted) {
return NextResponse.json({ error: 'Giveaway not found' }, { status: 404 });
}
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'giveaways.delete',
path: `/dashboard/${guildId}/giveaways`,
before: { giveawayId }
});
return NextResponse.json({ ok: true });
} catch (error) {
return toApiErrorResponse(error);
}
}

View File

@@ -0,0 +1,47 @@
import { GiveawayCreateDashboardSchema } from '@nexumi/shared';
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import { createGiveawayDashboard, GiveawayCreateTimeoutError, listGiveaways } from '@/lib/module-configs/giveaways';
import { prisma } from '@/lib/prisma';
interface RouteParams {
params: Promise<{ guildId: string }>;
}
export async function GET(_request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
await requireGuildAccess(guildId);
const giveaways = await listGiveaways(guildId);
return NextResponse.json({ giveaways });
} catch (error) {
return toApiErrorResponse(error);
}
}
export async function POST(request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
const session = await requireGuildAccess(guildId);
const body = await request.json();
const input = GiveawayCreateDashboardSchema.parse(body);
const giveaway = await createGiveawayDashboard(guildId, session.user.id, input);
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'giveaways.create',
path: `/dashboard/${guildId}/giveaways`,
after: giveaway
});
return NextResponse.json(giveaway, { status: 201 });
} catch (error) {
if (error instanceof GiveawayCreateTimeoutError) {
return NextResponse.json({ error: error.message }, { status: 504 });
}
return toApiErrorResponse(error);
}
}

View File

@@ -0,0 +1,59 @@
import { SelfRolePanelDashboardUpdateSchema } from '@nexumi/shared';
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import { deleteSelfRolePanel, updateSelfRolePanel } from '@/lib/module-configs/selfroles';
import { prisma } from '@/lib/prisma';
interface RouteParams {
params: Promise<{ guildId: string; panelId: string }>;
}
export async function PATCH(request: NextRequest, { params }: RouteParams) {
const { guildId, panelId } = await params;
try {
const session = await requireGuildAccess(guildId);
const body = await request.json();
const patch = SelfRolePanelDashboardUpdateSchema.parse(body);
const updated = await updateSelfRolePanel(guildId, panelId, patch);
if (!updated) {
return NextResponse.json({ error: 'Panel not found' }, { status: 404 });
}
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'selfroles.update',
path: `/dashboard/${guildId}/selfroles`,
after: updated
});
return NextResponse.json(updated);
} catch (error) {
return toApiErrorResponse(error);
}
}
export async function DELETE(_request: NextRequest, { params }: RouteParams) {
const { guildId, panelId } = await params;
try {
const session = await requireGuildAccess(guildId);
const deleted = await deleteSelfRolePanel(guildId, panelId);
if (!deleted) {
return NextResponse.json({ error: 'Panel not found' }, { status: 404 });
}
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'selfroles.delete',
path: `/dashboard/${guildId}/selfroles`,
before: { panelId }
});
return NextResponse.json({ ok: true });
} catch (error) {
return toApiErrorResponse(error);
}
}

View File

@@ -0,0 +1,44 @@
import { SelfRolePanelDashboardCreateSchema } from '@nexumi/shared';
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import { createSelfRolePanel, listSelfRolePanels } from '@/lib/module-configs/selfroles';
import { prisma } from '@/lib/prisma';
interface RouteParams {
params: Promise<{ guildId: string }>;
}
export async function GET(_request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
await requireGuildAccess(guildId);
const panels = await listSelfRolePanels(guildId);
return NextResponse.json({ panels });
} catch (error) {
return toApiErrorResponse(error);
}
}
export async function POST(request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
const session = await requireGuildAccess(guildId);
const body = await request.json();
const input = SelfRolePanelDashboardCreateSchema.parse(body);
const panel = await createSelfRolePanel(guildId, input);
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'selfroles.create',
path: `/dashboard/${guildId}/selfroles`,
after: panel
});
return NextResponse.json(panel, { status: 201 });
} catch (error) {
return toApiErrorResponse(error);
}
}

View File

@@ -0,0 +1,46 @@
import { StarboardConfigDashboardPatchSchema } from '@nexumi/shared';
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import { getStarboardDashboard, updateStarboardDashboard } from '@/lib/module-configs/starboard';
import { prisma } from '@/lib/prisma';
interface RouteParams {
params: Promise<{ guildId: string }>;
}
export async function GET(_request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
await requireGuildAccess(guildId);
const config = await getStarboardDashboard(guildId);
return NextResponse.json(config);
} catch (error) {
return toApiErrorResponse(error);
}
}
export async function PATCH(request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
const session = await requireGuildAccess(guildId);
const body = await request.json();
const patch = StarboardConfigDashboardPatchSchema.parse(body);
const before = await getStarboardDashboard(guildId);
const after = await updateStarboardDashboard(guildId, patch);
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'starboard.update',
path: `/dashboard/${guildId}/starboard`,
before,
after
});
return NextResponse.json(after);
} catch (error) {
return toApiErrorResponse(error);
}
}

View File

@@ -0,0 +1,62 @@
import { TagDashboardUpdateSchema } from '@nexumi/shared';
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import { deleteTag, TagConflictError, updateTag } from '@/lib/module-configs/tags';
import { prisma } from '@/lib/prisma';
interface RouteParams {
params: Promise<{ guildId: string; tagId: string }>;
}
export async function PATCH(request: NextRequest, { params }: RouteParams) {
const { guildId, tagId } = await params;
try {
const session = await requireGuildAccess(guildId);
const body = await request.json();
const patch = TagDashboardUpdateSchema.parse(body);
const updated = await updateTag(guildId, tagId, patch);
if (!updated) {
return NextResponse.json({ error: 'Tag not found' }, { status: 404 });
}
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'tags.update',
path: `/dashboard/${guildId}/tags`,
after: updated
});
return NextResponse.json(updated);
} catch (error) {
if (error instanceof TagConflictError) {
return NextResponse.json({ error: error.message }, { status: 409 });
}
return toApiErrorResponse(error);
}
}
export async function DELETE(_request: NextRequest, { params }: RouteParams) {
const { guildId, tagId } = await params;
try {
const session = await requireGuildAccess(guildId);
const deleted = await deleteTag(guildId, tagId);
if (!deleted) {
return NextResponse.json({ error: 'Tag not found' }, { status: 404 });
}
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'tags.delete',
path: `/dashboard/${guildId}/tags`,
before: { tagId }
});
return NextResponse.json({ ok: true });
} catch (error) {
return toApiErrorResponse(error);
}
}

View File

@@ -0,0 +1,47 @@
import { TagDashboardCreateSchema } from '@nexumi/shared';
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import { createTag, listTags, TagConflictError } from '@/lib/module-configs/tags';
import { prisma } from '@/lib/prisma';
interface RouteParams {
params: Promise<{ guildId: string }>;
}
export async function GET(_request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
await requireGuildAccess(guildId);
const tags = await listTags(guildId);
return NextResponse.json({ tags });
} catch (error) {
return toApiErrorResponse(error);
}
}
export async function POST(request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
const session = await requireGuildAccess(guildId);
const body = await request.json();
const input = TagDashboardCreateSchema.parse(body);
const tag = await createTag(guildId, session.user.id, input);
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'tags.create',
path: `/dashboard/${guildId}/tags`,
after: tag
});
return NextResponse.json(tag, { status: 201 });
} catch (error) {
if (error instanceof TagConflictError) {
return NextResponse.json({ error: error.message }, { status: 409 });
}
return toApiErrorResponse(error);
}
}

View File

@@ -0,0 +1,46 @@
import { TempVoiceConfigDashboardPatchSchema } from '@nexumi/shared';
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import { getTempVoiceDashboard, updateTempVoiceDashboard } from '@/lib/module-configs/tempvoice';
import { prisma } from '@/lib/prisma';
interface RouteParams {
params: Promise<{ guildId: string }>;
}
export async function GET(_request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
await requireGuildAccess(guildId);
const config = await getTempVoiceDashboard(guildId);
return NextResponse.json(config);
} catch (error) {
return toApiErrorResponse(error);
}
}
export async function PATCH(request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
const session = await requireGuildAccess(guildId);
const body = await request.json();
const patch = TempVoiceConfigDashboardPatchSchema.parse(body);
const before = await getTempVoiceDashboard(guildId);
const after = await updateTempVoiceDashboard(guildId, patch);
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'tempvoice.update',
path: `/dashboard/${guildId}/tempvoice`,
before,
after
});
return NextResponse.json(after);
} catch (error) {
return toApiErrorResponse(error);
}
}

View File

@@ -0,0 +1,66 @@
import { TicketCategoryDashboardUpdateSchema } from '@nexumi/shared';
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import {
deleteTicketCategory,
TicketCategoryConflictError,
updateTicketCategory
} from '@/lib/module-configs/tickets';
import { prisma } from '@/lib/prisma';
interface RouteParams {
params: Promise<{ guildId: string; categoryId: string }>;
}
export async function PATCH(request: NextRequest, { params }: RouteParams) {
const { guildId, categoryId } = await params;
try {
const session = await requireGuildAccess(guildId);
const body = await request.json();
const patch = TicketCategoryDashboardUpdateSchema.parse(body);
const updated = await updateTicketCategory(guildId, categoryId, patch);
if (!updated) {
return NextResponse.json({ error: 'Category not found' }, { status: 404 });
}
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'tickets.category.update',
path: `/dashboard/${guildId}/tickets`,
after: updated
});
return NextResponse.json(updated);
} catch (error) {
if (error instanceof TicketCategoryConflictError) {
return NextResponse.json({ error: error.message }, { status: 409 });
}
return toApiErrorResponse(error);
}
}
export async function DELETE(_request: NextRequest, { params }: RouteParams) {
const { guildId, categoryId } = await params;
try {
const session = await requireGuildAccess(guildId);
const deleted = await deleteTicketCategory(guildId, categoryId);
if (!deleted) {
return NextResponse.json({ error: 'Category not found' }, { status: 404 });
}
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'tickets.category.delete',
path: `/dashboard/${guildId}/tickets`,
before: { categoryId }
});
return NextResponse.json({ ok: true });
} catch (error) {
return toApiErrorResponse(error);
}
}

View File

@@ -0,0 +1,47 @@
import { TicketCategoryDashboardCreateSchema } from '@nexumi/shared';
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import { createTicketCategory, listTicketCategories, TicketCategoryConflictError } from '@/lib/module-configs/tickets';
import { prisma } from '@/lib/prisma';
interface RouteParams {
params: Promise<{ guildId: string }>;
}
export async function GET(_request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
await requireGuildAccess(guildId);
const categories = await listTicketCategories(guildId);
return NextResponse.json({ categories });
} catch (error) {
return toApiErrorResponse(error);
}
}
export async function POST(request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
const session = await requireGuildAccess(guildId);
const body = await request.json();
const input = TicketCategoryDashboardCreateSchema.parse(body);
const category = await createTicketCategory(guildId, input);
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'tickets.category.create',
path: `/dashboard/${guildId}/tickets`,
after: category
});
return NextResponse.json(category, { status: 201 });
} catch (error) {
if (error instanceof TicketCategoryConflictError) {
return NextResponse.json({ error: error.message }, { status: 409 });
}
return toApiErrorResponse(error);
}
}

View File

@@ -0,0 +1,46 @@
import { TicketConfigDashboardPatchSchema } from '@nexumi/shared';
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import { getTicketConfigDashboard, updateTicketConfigDashboard } from '@/lib/module-configs/tickets';
import { prisma } from '@/lib/prisma';
interface RouteParams {
params: Promise<{ guildId: string }>;
}
export async function GET(_request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
await requireGuildAccess(guildId);
const config = await getTicketConfigDashboard(guildId);
return NextResponse.json(config);
} catch (error) {
return toApiErrorResponse(error);
}
}
export async function PATCH(request: NextRequest, { params }: RouteParams) {
const { guildId } = await params;
try {
const session = await requireGuildAccess(guildId);
const body = await request.json();
const patch = TicketConfigDashboardPatchSchema.parse(body);
const before = await getTicketConfigDashboard(guildId);
const after = await updateTicketConfigDashboard(guildId, patch);
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'tickets.update',
path: `/dashboard/${guildId}/tickets`,
before,
after
});
return NextResponse.json(after);
} catch (error) {
return toApiErrorResponse(error);
}
}

View File

@@ -0,0 +1,15 @@
import { Skeleton } from '@/components/ui/skeleton';
export default function GiveawaysLoading() {
return (
<div className="space-y-6">
<div className="space-y-2">
<Skeleton className="h-8 w-48" />
<Skeleton className="h-4 w-80" />
</div>
{Array.from({ length: 3 }).map((_, index) => (
<Skeleton key={index} className="h-40 rounded-lg" />
))}
</div>
);
}

View File

@@ -0,0 +1,22 @@
import { GiveawaysManager } from '@/components/modules/giveaways-manager';
import { getLocale, t } from '@/lib/i18n';
import { listGiveaways } from '@/lib/module-configs/giveaways';
interface GiveawaysPageProps {
params: Promise<{ guildId: string }>;
}
export default async function GiveawaysPage({ params }: GiveawaysPageProps) {
const { guildId } = await params;
const [locale, giveaways] = await Promise.all([getLocale(), listGiveaways(guildId)]);
return (
<div className="space-y-6">
<div>
<h1 className="text-2xl font-semibold">{t(locale, 'modules.giveaways.label')}</h1>
<p className="text-sm text-muted-foreground">{t(locale, 'modules.giveaways.description')}</p>
</div>
<GiveawaysManager guildId={guildId} initialGiveaways={giveaways} />
</div>
);
}

View File

@@ -0,0 +1,15 @@
import { Skeleton } from '@/components/ui/skeleton';
export default function SelfRolesLoading() {
return (
<div className="space-y-6">
<div className="space-y-2">
<Skeleton className="h-8 w-48" />
<Skeleton className="h-4 w-80" />
</div>
{Array.from({ length: 3 }).map((_, index) => (
<Skeleton key={index} className="h-40 rounded-lg" />
))}
</div>
);
}

View File

@@ -0,0 +1,22 @@
import { SelfRolesManager } from '@/components/modules/selfroles-manager';
import { getLocale, t } from '@/lib/i18n';
import { listSelfRolePanels } from '@/lib/module-configs/selfroles';
interface SelfRolesPageProps {
params: Promise<{ guildId: string }>;
}
export default async function SelfRolesPage({ params }: SelfRolesPageProps) {
const { guildId } = await params;
const [locale, panels] = await Promise.all([getLocale(), listSelfRolePanels(guildId)]);
return (
<div className="space-y-6">
<div>
<h1 className="text-2xl font-semibold">{t(locale, 'modules.selfroles.label')}</h1>
<p className="text-sm text-muted-foreground">{t(locale, 'modules.selfroles.description')}</p>
</div>
<SelfRolesManager guildId={guildId} initialPanels={panels} />
</div>
);
}

View File

@@ -0,0 +1,15 @@
import { Skeleton } from '@/components/ui/skeleton';
export default function TagsLoading() {
return (
<div className="space-y-6">
<div className="space-y-2">
<Skeleton className="h-8 w-48" />
<Skeleton className="h-4 w-80" />
</div>
{Array.from({ length: 3 }).map((_, index) => (
<Skeleton key={index} className="h-40 rounded-lg" />
))}
</div>
);
}

View File

@@ -0,0 +1,22 @@
import { TagsManager } from '@/components/modules/tags-manager';
import { getLocale, t } from '@/lib/i18n';
import { listTags } from '@/lib/module-configs/tags';
interface TagsPageProps {
params: Promise<{ guildId: string }>;
}
export default async function TagsPage({ params }: TagsPageProps) {
const { guildId } = await params;
const [locale, tags] = await Promise.all([getLocale(), listTags(guildId)]);
return (
<div className="space-y-6">
<div>
<h1 className="text-2xl font-semibold">{t(locale, 'modules.tags.label')}</h1>
<p className="text-sm text-muted-foreground">{t(locale, 'modules.tags.description')}</p>
</div>
<TagsManager guildId={guildId} initialTags={tags} />
</div>
);
}

View File

@@ -0,0 +1,15 @@
import { Skeleton } from '@/components/ui/skeleton';
export default function TicketsLoading() {
return (
<div className="space-y-6">
<div className="space-y-2">
<Skeleton className="h-8 w-48" />
<Skeleton className="h-4 w-80" />
</div>
{Array.from({ length: 3 }).map((_, index) => (
<Skeleton key={index} className="h-40 rounded-lg" />
))}
</div>
);
}

View File

@@ -0,0 +1,28 @@
import { TicketCategoriesManager } from '@/components/modules/ticket-categories-manager';
import { TicketConfigForm } from '@/components/modules/ticket-config-form';
import { getLocale, t } from '@/lib/i18n';
import { getTicketConfigDashboard, listTicketCategories } from '@/lib/module-configs/tickets';
interface TicketsPageProps {
params: Promise<{ guildId: string }>;
}
export default async function TicketsPage({ params }: TicketsPageProps) {
const { guildId } = await params;
const [locale, config, categories] = await Promise.all([
getLocale(),
getTicketConfigDashboard(guildId),
listTicketCategories(guildId)
]);
return (
<div className="space-y-6">
<div>
<h1 className="text-2xl font-semibold">{t(locale, 'modules.tickets.label')}</h1>
<p className="text-sm text-muted-foreground">{t(locale, 'modules.tickets.description')}</p>
</div>
<TicketConfigForm guildId={guildId} initialValue={config} />
<TicketCategoriesManager guildId={guildId} initialCategories={categories} />
</div>
);
}