mirror of
https://github.com/sakaljurgis/best-choice.git
synced 2026-11-06 14:18:01 +00:00
delete project
This commit is contained in:
1 parent
343f48de66
commit
cea323ec3b
4 files changed
+74
No files matched your search
@@ -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