feat: finish back-end work (untested)
This commit is contained in:
@@ -85,3 +85,13 @@ DELETE FROM order_item WHERE item_id = $1 AND order_id = $2;
|
||||
const SET_ITEM_IS_IN_SEASON = `
|
||||
UPDATE item SET in_season = $1 WHERE id = $2;
|
||||
`
|
||||
|
||||
const GET_ORDER_MADE_DETAILS = `
|
||||
SELECT
|
||||
id,
|
||||
filled
|
||||
FROM
|
||||
order_record
|
||||
WHERE
|
||||
id = $1;
|
||||
`
|
||||
|
||||
@@ -61,7 +61,7 @@ WITH order_bill AS (
|
||||
WHERE
|
||||
orec.user_id = $1
|
||||
AND orec.orderer = $2
|
||||
AND orec.date_place = $3
|
||||
AND orec.date_placed = $3
|
||||
GROUP BY orec.id
|
||||
) totals ON orec.id = totals.id
|
||||
)
|
||||
@@ -163,3 +163,19 @@ ORDER BY date_due DESC
|
||||
OFFSET $1
|
||||
LIMIT $2;
|
||||
`
|
||||
|
||||
const UPDATE_ORDER_FILLED = `UPDATE order_record
|
||||
SET filled = (
|
||||
SELECT order_filled
|
||||
FROM order_record orec
|
||||
INNER JOIN (SELECT
|
||||
orec.id,
|
||||
COALESCE(EVERY(made = quantity), false) AS order_filled
|
||||
FROM
|
||||
order_record orec
|
||||
LEFT JOIN order_item oi ON oi.order_id = orec.id
|
||||
GROUP BY
|
||||
orec.id) orec_result ON orec.id = orec_result.id
|
||||
AND orec.id = $1
|
||||
) WHERE order_record.id = $1
|
||||
`
|
||||
|
||||
@@ -31,6 +31,9 @@ FROM
|
||||
ordr_user
|
||||
INNER JOIN ordr_position
|
||||
ON job_position = ordr_position.id
|
||||
WHERE
|
||||
user_name LIKE '%' || $3 ||'%'
|
||||
AND position_name LIKE '%' || $4 || '%'
|
||||
ORDER BY user_name
|
||||
OFFSET $1
|
||||
LIMIT $2;
|
||||
@@ -45,7 +48,7 @@ SELECT
|
||||
is_admin::boolean
|
||||
FROM
|
||||
ordr_user
|
||||
INNER JOIN ordr_position
|
||||
LEFT JOIN ordr_position
|
||||
ON job_position = ordr_position.id
|
||||
AND ordr_user.sub_id = $1;
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user