fix: cant add multiple future rehersals

This commit is contained in:
Nathan FONTEYNE 2026-07-10 14:51:03 +02:00
parent 749abda8ba
commit 5e28345ed5
7 changed files with 196 additions and 35 deletions

View file

@ -11,6 +11,16 @@ async function findNext() {
return rows[0] || null;
}
async function findUpcoming() {
const { rows } = await pool.query(
`SELECT id, name, venue, concert_date, created_by, created_at, updated_at
FROM setlists
WHERE concert_date >= CURRENT_DATE
ORDER BY concert_date ASC`
);
return rows;
}
async function findHistory() {
const { rows } = await pool.query(
`SELECT id, name, venue, concert_date, created_by, created_at, updated_at
@ -152,6 +162,7 @@ async function getStats() {
module.exports = {
findNext,
findUpcoming,
findHistory,
findHistoryWithSongs,
findById,

View file

@ -18,6 +18,13 @@ router.get(
})
);
router.get(
'/upcoming',
asyncHandler(async (req, res) => {
res.json(await setlistsRepo.findUpcoming());
})
);
router.get(
'/history',
asyncHandler(async (req, res) => {