fix: Allow clearing event description in update endpoint

This commit is contained in:
Starstrike
2025-05-01 14:54:19 -04:00
parent bb5f28c304
commit e0de661050

View File

@@ -339,10 +339,10 @@ app.put('/api/events/:slug', async (req: Request, res: Response) => {
await db.run( await db.run(
'UPDATE events SET title = ?, description = ?, date = ?, location = ?, needed_items = ?, rsvp_cutoff_date = ? WHERE slug = ?', 'UPDATE events SET title = ?, description = ?, date = ?, location = ?, needed_items = ?, rsvp_cutoff_date = ? WHERE slug = ?',
[ [
title || eventRows[0].title, title ?? eventRows[0].title,
description || eventRows[0].description, description === undefined ? eventRows[0].description : description,
date || eventRows[0].date, date ?? eventRows[0].date,
location || eventRows[0].location, location ?? eventRows[0].location,
JSON.stringify(parsedNeededItems), JSON.stringify(parsedNeededItems),
rsvp_cutoff_date !== undefined ? rsvp_cutoff_date : eventRows[0].rsvp_cutoff_date, rsvp_cutoff_date !== undefined ? rsvp_cutoff_date : eventRows[0].rsvp_cutoff_date,
slug slug