3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-17 15:15:02 +00:00

optional log_message_id

This commit is contained in:
iamshoXy 2023-07-01 15:16:47 +02:00
parent 4f4913d6e4
commit e836a1c36a

View file

@ -35,7 +35,7 @@ const caseData = z.object({
is_hidden: z.boolean(), is_hidden: z.boolean(),
pp_id: z.nullable(z.string()), pp_id: z.nullable(z.string()),
pp_name: z.nullable(z.string()), pp_name: z.nullable(z.string()),
log_message_id: z.nullable(z.string()), log_message_id: z.string().optional(),
notes: z.array(caseNoteData), notes: z.array(caseNoteData),
}); });
@ -75,8 +75,7 @@ export function initGuildsImportExportAPI(guildRouter: express.Router) {
try { try {
data = importExportData.parse(req.body.data); data = importExportData.parse(req.body.data);
} catch (err) { } catch (err) {
const prettyMessage = `${err.issues[0].code}: expected ${err.issues[0].expected}, received ${ const prettyMessage = `${err.issues[0].code}: expected ${err.issues[0].expected}, received ${err.issues[0].received
err.issues[0].received
} at /${err.issues[0].path.join("/")}`; } at /${err.issues[0].path.join("/")}`;
return clientError(res, `Invalid import data format: ${prettyMessage}`); return clientError(res, `Invalid import data format: ${prettyMessage}`);
return; return;
@ -168,7 +167,7 @@ export function initGuildsImportExportAPI(guildRouter: express.Router) {
is_hidden: theCase.is_hidden, is_hidden: theCase.is_hidden,
pp_id: theCase.pp_id, pp_id: theCase.pp_id,
pp_name: theCase.pp_name, pp_name: theCase.pp_name,
log_message_id: theCase.log_message_id, log_message_id: theCase.log_message_id ?? undefined,
notes: theCase.notes.map((note) => ({ notes: theCase.notes.map((note) => ({
mod_id: note.mod_id, mod_id: note.mod_id,
mod_name: note.mod_name, mod_name: note.mod_name,