update sqlc gen

This commit is contained in:
Pavel 2024-05-03 11:20:31 +03:00
parent 2ce1a36bbb
commit f6c3470bd8
2 changed files with 16 additions and 10 deletions

@ -678,14 +678,17 @@ SELECT * FROM tokens WHERE Expiration <= TO_TIMESTAMP(EXTRACT(EPOCH FROM NOW())
-- name: WebhookDelete :exec
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;
DELETE FROM tokens WHERE AccountID IN (SELECT AccountID FROM userd);
-- name: SoftDeleteAccount :exec
UPDATE users SET Deleted = TRUE WHERE AccountID = $1;
WITH userd AS (
SELECT AmoUserID FROM users WHERE users.AccountID = $1
),
tokend AS (
UPDATE users SET Deleted = true WHERE AmoUserID IN (SELECT AmoUserID FROM userd) RETURNING users.AccountID
)
DELETE FROM tokens WHERE tokens.AccountID IN (SELECT AccountID FROM tokend);
-- name: GetCurrentAccount :one
SELECT * FROM users WHERE AccountID = $1;

@ -3028,7 +3028,13 @@ func (q *Queries) SetQuizSettings(ctx context.Context, arg SetQuizSettingsParams
}
const softDeleteAccount = `-- name: SoftDeleteAccount :exec
UPDATE users SET Deleted = TRUE WHERE AccountID = $1
WITH userd AS (
SELECT AmoUserID FROM users WHERE users.AccountID = $1
),
tokend AS (
UPDATE users SET Deleted = true WHERE AmoUserID IN (SELECT AmoUserID FROM userd) RETURNING users.AccountID
)
DELETE FROM tokens WHERE tokens.AccountID IN (SELECT AccountID FROM tokend)
`
func (q *Queries) SoftDeleteAccount(ctx context.Context, accountid string) error {
@ -3211,11 +3217,8 @@ func (q *Queries) UpdateUtmsFields(ctx context.Context, dollar_1 []int32) error
const webhookDelete = `-- name: WebhookDelete :exec
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 accountid, refreshtoken, accesstoken, authcode, expiration, createdat
)
SELECT accountid, refreshtoken, accesstoken, authcode, expiration, createdat FROM tokend
DELETE FROM tokens WHERE AccountID IN (SELECT AccountID FROM userd)
`
func (q *Queries) WebhookDelete(ctx context.Context, amouserid int32) error {