lab2 fix
Application / Lint (pull_request) Canceled after 0s
Application / Unit tests (pull_request) Canceled after 0s
Application / Docker build (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
Vladislav Kunetskiy
2026-10-10 00:50:24 +03:00
parent 1e38dbdf35
commit da9fcf346a
36 changed files with 995 additions and 1038 deletions
@@ -80,14 +80,13 @@ func (r *SessionRepository) Resolve(ctx context.Context, tokenHash []byte) (doma
}, nil
}
// Revoke is intentionally idempotent: deleting an already absent session is a no-op.
// The HTTP contract for DELETE /auth/sessions/current defines only 204/401, so a
// missing session must not surface as an error.
func (r *SessionRepository) Revoke(ctx context.Context, userID uuid.UUID, tokenHash []byte) error {
ctx, cancel := r.store.timeout(ctx)
defer cancel()
if err := r.store.queries.DeleteSession(ctx, sqlcgen.DeleteSessionParams{TokenHash: tokenHash, UserID: userID}); err != nil {
if err := r.store.queries.DeleteSession(
ctx, sqlcgen.DeleteSessionParams{TokenHash: tokenHash, UserID: userID},
); err != nil {
return fmt.Errorf("revoke session: %w", mapError(err))
}