refactor: improve return of reorder

This commit is contained in:
Carlos Valente
2025-05-16 20:23:35 +02:00
committed by Carlos Valente
parent 7bed3757f2
commit ba96ecfd91
6 changed files with 36 additions and 15 deletions
@@ -86,15 +86,15 @@ export async function rundownBatchPut(req: Request, res: Response<MessageRespons
}
}
export async function rundownReorder(req: Request, res: Response<OntimeEntry | ErrorResponse>) {
export async function rundownReorder(req: Request, res: Response<Rundown | ErrorResponse>) {
if (failEmptyObjects(req.body, res)) {
return;
}
try {
const { eventId, from, to } = req.body;
const event = await reorderEntry(eventId, from, to);
res.status(200).send(event.newEvent);
const newRundown = await reorderEntry(eventId, from, to);
res.status(200).send(newRundown);
} catch (error) {
const message = getErrorMessage(error);
res.status(400).send({ message });