implement delete session

This commit is contained in:
2025-02-14 10:59:51 -06:00
parent 9bfc591fcc
commit 37862e747f
2 changed files with 14 additions and 0 deletions

View File

@@ -342,6 +342,16 @@ func (q *Queries) DeleteRedirectURI(ctx context.Context, arg DeleteRedirectURIPa
return err return err
} }
const deleteSession = `-- name: DeleteSession :exec
DELETE FROM sessions
WHERE id = ?
`
func (q *Queries) DeleteSession(ctx context.Context, id string) error {
_, err := q.db.ExecContext(ctx, deleteSession, id)
return err
}
const getAuthorizationCode = `-- name: GetAuthorizationCode :one const getAuthorizationCode = `-- name: GetAuthorizationCode :one
SELECT id, code, code_challenge, code_challenge_method, user_id, client_id, scope, redirect_uri, created_at, expires_at, used_at SELECT id, code, code_challenge, code_challenge_method, user_id, client_id, scope, redirect_uri, created_at, expires_at, used_at
FROM authorization_codes FROM authorization_codes

View File

@@ -226,6 +226,10 @@ WHERE id = ?;
INSERT INTO sessions (id, user_id, expires_at) INSERT INTO sessions (id, user_id, expires_at)
VALUES (?, ?, ?); VALUES (?, ?, ?);
-- name: DeleteSession :exec
DELETE FROM sessions
WHERE id = ?;
-- name: RevokeClientApproval :exec -- name: RevokeClientApproval :exec
DELETE FROM client_approvals DELETE FROM client_approvals
WHERE user_id = ? AND client_id = ?; WHERE user_id = ? AND client_id = ?;