-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api): Correctly restore deleted accounts in currency
- Loading branch information
1 parent
4244457
commit 541f615
Showing
6 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
source/Gnomeshade.Data/Repositories/Queries/AccountInCurrency/RestoreDeleted.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
WITH a AS (SELECT accounts_in_currency.id | ||
FROM accounts_in_currency | ||
INNER JOIN owners ON owners.id = accounts_in_currency.owner_id | ||
INNER JOIN ownerships ON owners.id = ownerships.owner_id | ||
INNER JOIN access ON access.id = ownerships.access_id | ||
WHERE accounts_in_currency.id = @id | ||
AND ownerships.user_id = @ownerId | ||
AND (access.normalized_name = 'DELETE' OR access.normalized_name = 'OWNER')) | ||
UPDATE accounts_in_currency | ||
SET modified_at = CURRENT_TIMESTAMP, | ||
modified_by_user_id = @ownerId, | ||
deleted_at = NULL, | ||
deleted_by_user_id = NULL | ||
FROM a | ||
WHERE accounts_in_currency.id IN (SELECT id FROM a); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters