sessions #2

Merged
admin merged 63 commits from sessions into main 2025-06-16 19:03:01 +02:00
52 changed files with 2590 additions and 190 deletions
Showing only changes of commit b3ef96a0ce - Show all commits

View File

@ -393,3 +393,27 @@ func (q *Queries) UpdateServiceSessionLastActive(ctx context.Context, id uuid.UU
_, err := q.db.Exec(ctx, updateServiceSessionLastActive, id) _, err := q.db.Exec(ctx, updateServiceSessionLastActive, id)
return err return err
} }
const updateServiceSessionTokens = `-- name: UpdateServiceSessionTokens :exec
UPDATE service_sessions
SET access_token_id = $2, refresh_token_id = $3, expires_at = $4
WHERE id = $1
AND is_active = TRUE
`
type UpdateServiceSessionTokensParams struct {
ID uuid.UUID `json:"id"`
AccessTokenID *uuid.UUID `json:"access_token_id"`
RefreshTokenID *uuid.UUID `json:"refresh_token_id"`
ExpiresAt *time.Time `json:"expires_at"`
}
func (q *Queries) UpdateServiceSessionTokens(ctx context.Context, arg UpdateServiceSessionTokensParams) error {
_, err := q.db.Exec(ctx, updateServiceSessionTokens,
arg.ID,
arg.AccessTokenID,
arg.RefreshTokenID,
arg.ExpiresAt,
)
return err
}

View File

@ -46,6 +46,12 @@ SET last_active = NOW()
WHERE id = $1 WHERE id = $1
AND is_active = TRUE; AND is_active = TRUE;
-- name: UpdateServiceSessionTokens :exec
UPDATE service_sessions
SET access_token_id = $2, refresh_token_id = $3, expires_at = $4
WHERE id = $1
AND is_active = TRUE;
-- name: ListAllServiceSessions :many -- name: ListAllServiceSessions :many
SELECT * FROM service_sessions SELECT * FROM service_sessions
ORDER BY issued_at DESC ORDER BY issued_at DESC