Ghosted memorial birds
This commit is contained in:
1 parent
270652f1a8
commit
ff177dbaed
4 files changed
+94
-42
No files matched your search
@@ -98,6 +98,7 @@ export const createFlockNote = async ({
|
||||
FROM birds
|
||||
WHERE birds.id = $2
|
||||
AND birds.workspace_id = $1
|
||||
AND birds.memorialized_at IS NULL
|
||||
)
|
||||
RETURNING id, workspace_id, bird_id, title, body, created_by_user_id, created_at, updated_at
|
||||
)
|
||||
@@ -125,6 +126,12 @@ export const deleteFlockNote = async (noteId: string, workspaceId: number) => {
|
||||
`DELETE FROM flock_notes
|
||||
WHERE id = $1
|
||||
AND workspace_id = $2
|
||||
AND (bird_id IS NULL OR EXISTS (
|
||||
SELECT 1 FROM birds
|
||||
WHERE birds.id = flock_notes.bird_id
|
||||
AND birds.workspace_id = $2
|
||||
AND birds.memorialized_at IS NULL
|
||||
))
|
||||
RETURNING id, title`,
|
||||
[noteId, workspaceId],
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user