mirror of
https://github.com/sakaljurgis/best-choice.git
synced 2026-07-08 21:47:40 +00:00
delete project
This commit is contained in:
@@ -188,8 +188,19 @@ export const updateProject = async (
|
||||
};
|
||||
|
||||
export const deleteProject = async (id: string): Promise<boolean> => {
|
||||
// Remove dependent items and prices explicitly while leaving shared URLs untouched.
|
||||
const result = await query(
|
||||
`
|
||||
WITH deleted_prices AS (
|
||||
DELETE FROM item_prices ip
|
||||
USING items i
|
||||
WHERE ip.item_id = i.id
|
||||
AND i.project_id = $1
|
||||
),
|
||||
deleted_items AS (
|
||||
DELETE FROM items
|
||||
WHERE project_id = $1
|
||||
)
|
||||
DELETE FROM projects
|
||||
WHERE id = $1
|
||||
`,
|
||||
|
||||
Reference in New Issue
Block a user