add webhook delete query

This commit is contained in:
Pavel 2024-04-23 18:02:15 +03:00
parent 6d04e29714
commit 5a487f6994
2 changed files with 9 additions and 2 deletions

@ -676,7 +676,14 @@ SELECT * FROM tokens;
SELECT * FROM tokens WHERE Expiration <= TO_TIMESTAMP(EXTRACT(EPOCH FROM NOW()) + (10 * 60));
-- name: WebhookDelete :exec
DELETE FROM tokens WHERE AccountID = $1;
WITH userd AS (
UPDATE users SET Deleted = true WHERE AmoUserID = $1 RETURNING AccountID
),
tokend AS (
DELETE FROM tokens WHERE AccountID IN (SELECT AccountID FROM userd) RETURNING *
)
SELECT * FROM tokend;
-- name: SoftDeleteAccount :exec
UPDATE users SET Deleted = TRUE WHERE AccountID = $1;

@ -259,7 +259,7 @@ func (r *AmoRepository) GetAllTokens(ctx context.Context) ([]model.Token, error)
return tokens, nil
}
func (r *AmoRepository) WebhookDelete(ctx context.Context) error {
func (r *AmoRepository) WebhookDelete(ctx context.Context, amoID int) error {
return nil