wisdom #2
@@ -31,7 +31,7 @@ const getAllScheduleDb = async (searchParams = {}) => {
|
|||||||
c.shift_id
|
c.shift_id
|
||||||
FROM schedule a
|
FROM schedule a
|
||||||
LEFT JOIN m_shift b ON a.shift_id = b.shift_id
|
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
|
WHERE a.deleted_at IS NULL
|
||||||
${whereConditions.length > 0 ? ` AND ${whereConditions.join(" AND ")}` : ""}
|
${whereConditions.length > 0 ? ` AND ${whereConditions.join(" AND ")}` : ""}
|
||||||
${whereOrConditions ? ` ${whereOrConditions}` : ""}
|
${whereOrConditions ? ` ${whereOrConditions}` : ""}
|
||||||
@@ -59,7 +59,6 @@ const getAllScheduleDb = async (searchParams = {}) => {
|
|||||||
const getScheduleByIdDb = async (id) => {
|
const getScheduleByIdDb = async (id) => {
|
||||||
const queryText = `
|
const queryText = `
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(*) OVER() AS total_data,
|
|
||||||
a.*,
|
a.*,
|
||||||
b.shift_id,
|
b.shift_id,
|
||||||
b.shift_name,
|
b.shift_name,
|
||||||
@@ -69,7 +68,7 @@ const getScheduleByIdDb = async (id) => {
|
|||||||
c.user_id
|
c.user_id
|
||||||
FROM schedule a
|
FROM schedule a
|
||||||
LEFT JOIN m_shift b ON a.shift_id = b.shift_id
|
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
|
WHERE a.schedule_id = $1 AND a.deleted_at IS NULL
|
||||||
`;
|
`;
|
||||||
const result = await pool.query(queryText, [id]);
|
const result = await pool.query(queryText, [id]);
|
||||||
|
|||||||
Reference in New Issue
Block a user