From 47051766e318ddb0a3c2b3419e41fa2e4ea56573 Mon Sep 17 00:00:00 2001 From: Muhammad Afif Date: Sat, 11 Oct 2025 12:16:24 +0700 Subject: [PATCH] add: schedule db --- db/schedule.db.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/db/schedule.db.js b/db/schedule.db.js index 7d6e2bc..294d155 100644 --- a/db/schedule.db.js +++ b/db/schedule.db.js @@ -31,7 +31,7 @@ const getAllScheduleDb = async (searchParams = {}) => { c.shift_id FROM schedule a LEFT JOIN m_shift b ON a.shift_id = b.shift_id - LEFT JOIN user_schedule c ON a.user_schedule_id = c.user_schedule_id + LEFT JOIN user_schedule c ON a.schedule_id = c.user_schedule_id WHERE a.deleted_at IS NULL ${whereConditions.length > 0 ? ` AND ${whereConditions.join(" AND ")}` : ""} ${whereOrConditions ? ` ${whereOrConditions}` : ""} @@ -59,7 +59,6 @@ const getAllScheduleDb = async (searchParams = {}) => { const getScheduleByIdDb = async (id) => { const queryText = ` SELECT - COUNT(*) OVER() AS total_data, a.*, b.shift_id, b.shift_name, @@ -69,7 +68,7 @@ const getScheduleByIdDb = async (id) => { c.user_id FROM schedule a LEFT JOIN m_shift b ON a.shift_id = b.shift_id - LEFT JOIN user_schedule c ON a.user_schedule_id = c.user_schedule_id + LEFT JOIN user_schedule c ON a.schedule_id = c.user_schedule_id WHERE a.schedule_id = $1 AND a.deleted_at IS NULL `; const result = await pool.query(queryText, [id]);