Skip to content

Commit f03c788

Browse files
committed
chore: made upcoming event sort by date in ASC order
1 parent a55b2d4 commit f03c788

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

backend/controllers/eventController.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,11 @@ class EventController {
406406
}
407407

408408
const allowedSortFields = ['id', 'title', 'start_date', 'end_date', 'created_at'];
409+
409410
const validSortBy = allowedSortFields.includes(sortBy) ? sortBy : 'start_date';
410411

411412
const validSortOrder = ['ASC', 'DESC'].includes(sortOrder.toUpperCase())
412-
? sortOrder.toUpperCase()
413+
? (queryType != 'past' ? 'ASC' : sortOrder.toUpperCase())
413414
: 'DESC';
414415

415416
const { count, rows: events } = await Event.findAndCountAll({

0 commit comments

Comments
 (0)