Add suggestion status update job and queue integration

- Introduced a new `SuggestionStatusUpdateJob` type and corresponding worker to handle suggestion status updates in the bot's job processing.
- Added `suggestionsQueue` and `suggestionsQueueEvents` for managing suggestion-related jobs in both the bot and WebUI.
- Implemented `runSuggestionStatusUpdateJob` to facilitate staff actions on suggestions via the WebUI, ensuring consistent behavior with existing commands.
- Enhanced error handling for suggestion actions to improve user experience and reliability.
This commit is contained in:
smueller
2026-07-22 15:39:31 +02:00
parent 0ac69ee840
commit 47b6cfabbc
16 changed files with 773 additions and 23 deletions

View File

@@ -0,0 +1,44 @@
import { SocialFeedDashboardCreateSchema } from '@nexumi/shared';
import { type NextRequest, NextResponse } from 'next/server';
import { requireGuildAccess, toApiErrorResponse } from '@/lib/auth';
import { writeDashboardAudit } from '@/lib/audit';
import { createFeed, listFeeds } from '@/lib/module-configs/feeds';
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 feeds = await listFeeds(guildId);
return NextResponse.json({ feeds });
} 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 = SocialFeedDashboardCreateSchema.parse(body);
const feed = await createFeed(guildId, input);
await writeDashboardAudit(prisma, {
guildId,
actorUserId: session.user.id,
action: 'feeds.create',
path: `/dashboard/${guildId}/feeds`,
after: feed
});
return NextResponse.json(feed, { status: 201 });
} catch (error) {
return toApiErrorResponse(error);
}
}