Antraege eingrenzen, Reaktivierung und Bestaetigungen
Sechs Ruecklaeufer aus dem ersten Praxistest: Das Archiv reicht ueber 25 Seiten und enthaelt vieles, was kein CC-Antrag ist. Aufgenommen werden jetzt nur Threads von Spielern, die im CC-Manager mit passendem Forum-Namen erfasst sind. Angepinnte Ankuendigungen tragen die Labels "Wichtig" oder "Information" und fallen darueber raus. Der Titel wird bewusst nirgends ausgewertet - weder zum Erkennen noch zum Aussortieren. Antraege heissen mal "CC Antrag | Name", mal "The Duke Rang Update"; daran ist nichts abzulesen. Eine Reaktivierung laeuft ebenfalls ueber einen Forums-Antrag und fehlte als Entscheidung. Sie ist jetzt waehlbar und kostet nichts, solange der CC nicht redesignt wurde - die bestehende Regel entscheidet das, nicht der Dialog. Der Titel in der Liste verlinkt jetzt auf den Thread im Forum. Die Labels stehen als Kontext daneben, ohne die Entscheidung vorwegzunehmen. Wer einen Antrag von Hand eintraegt, kann beim Anlegen oder Redesignen den Thread-Link angeben. Der Antrag gilt damit als erledigt und taucht nicht erneut als offen auf. Manuelle Guthaben-Buchungen fragen vorher nach: bisher buchte ein einzelner Klick sofort, ohne zu sagen, was genau passiert. Der Dialog nennt die Wirkung und nimmt eine Notiz entgegen.
This commit is contained in:
@@ -11,8 +11,27 @@ import {
|
||||
revertCharacter,
|
||||
updateCharacter,
|
||||
} from '../services/characters.js';
|
||||
import { parseThreadId } from '../lib/forum.js';
|
||||
import { linkThreadToCharacter } from '../services/forum.js';
|
||||
import { badRequest } from '../errors.js';
|
||||
import { contextOf, idParam, optionalNote, parseWith } from './helpers.js';
|
||||
|
||||
/** Hakt den zugehörigen Forums-Thread ab, wenn einer angegeben wurde. */
|
||||
async function linkThread(
|
||||
threadInput: string | undefined,
|
||||
characterId: number,
|
||||
classification: 'NEW_CC' | 'REDESIGN',
|
||||
ctx: ReturnType<typeof contextOf>,
|
||||
): Promise<void> {
|
||||
if (!threadInput?.trim()) return;
|
||||
|
||||
const threadId = parseThreadId(threadInput);
|
||||
if (threadId === null) {
|
||||
throw badRequest('INVALID_THREAD', 'Der Thread-Link konnte nicht gelesen werden');
|
||||
}
|
||||
await linkThreadToCharacter(threadId, characterId, classification, ctx);
|
||||
}
|
||||
|
||||
const redesignKind = z.enum([CreditKind.REDESIGN_PAID, CreditKind.REDESIGN_KULANZ]);
|
||||
const reviveKind = z.enum([CreditKind.CC, CreditKind.REDESIGN_PAID, CreditKind.REDESIGN_KULANZ]);
|
||||
|
||||
@@ -24,10 +43,13 @@ export async function characterRoutes(app: FastifyInstance): Promise<void> {
|
||||
name: z.string().trim().min(1).max(160),
|
||||
loreText: z.string().trim().max(5000).optional(),
|
||||
note: optionalNote,
|
||||
forumThread: z.string().trim().max(300).optional(),
|
||||
}),
|
||||
request.body,
|
||||
);
|
||||
const result = await createCharacter(id, body, contextOf(request));
|
||||
const ctx = contextOf(request);
|
||||
const result = await createCharacter(id, body, ctx);
|
||||
await linkThread(body.forumThread, result.character.id, 'NEW_CC', ctx);
|
||||
reply.code(201);
|
||||
return result;
|
||||
});
|
||||
@@ -52,10 +74,14 @@ export async function characterRoutes(app: FastifyInstance): Promise<void> {
|
||||
loreText: z.string().trim().max(5000).optional(),
|
||||
useKind: redesignKind,
|
||||
note: optionalNote,
|
||||
forumThread: z.string().trim().max(300).optional(),
|
||||
}),
|
||||
request.body,
|
||||
);
|
||||
return redesignCharacter(id, body, contextOf(request));
|
||||
const ctx = contextOf(request);
|
||||
const result = await redesignCharacter(id, body, ctx);
|
||||
await linkThread(body.forumThread, result.character.id, 'REDESIGN', ctx);
|
||||
return result;
|
||||
});
|
||||
|
||||
app.post('/api/characters/:id/deactivate', { preHandler: requireEditor }, async (request) => {
|
||||
|
||||
@@ -64,7 +64,8 @@ export async function forumRoutes(app: FastifyInstance): Promise<void> {
|
||||
characterName: z.string().trim().min(1).max(160).optional(),
|
||||
loreText: z.string().trim().max(5000).optional(),
|
||||
predecessorId: z.number().int().positive().optional(),
|
||||
useKind: z.enum(['REDESIGN_PAID', 'REDESIGN_KULANZ']).optional(),
|
||||
characterId: z.number().int().positive().optional(),
|
||||
useKind: z.enum(['REDESIGN_PAID', 'REDESIGN_KULANZ', 'CC']).optional(),
|
||||
}),
|
||||
request.body,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user