update sqlc gen

This commit is contained in:
Pavel 2024-04-23 18:04:31 +03:00
parent 5a487f6994
commit 268f16f54d

@ -3066,11 +3066,17 @@ func (q *Queries) UpdateUsers(ctx context.Context, arg UpdateUsersParams) error
}
const webhookDelete = `-- 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 accountid, refreshtoken, accesstoken, authcode, expiration, createdat
)
SELECT accountid, refreshtoken, accesstoken, authcode, expiration, createdat FROM tokend
`
func (q *Queries) WebhookDelete(ctx context.Context, accountid string) error {
_, err := q.db.ExecContext(ctx, webhookDelete, accountid)
func (q *Queries) WebhookDelete(ctx context.Context, amouserid int32) error {
_, err := q.db.ExecContext(ctx, webhookDelete, amouserid)
return err
}