Просмотр исходного кода

fix: restore missing Delete method on RefreshTokenRepo

neyrogovnarik 1 месяц назад
Родитель
Сommit
0f522c95c2
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      backend/internal/repository/refresh_tokens.go

+ 8 - 0
backend/internal/repository/refresh_tokens.go

@@ -168,6 +168,14 @@ func (r *RefreshTokenRepo) RevokeAllForUser(ctx context.Context, userID string)
 	return err
 }
 
+func (r *RefreshTokenRepo) Delete(ctx context.Context, tokenHash string) error {
+	_, err := r.pool.Exec(ctx,
+		`DELETE FROM refresh_tokens WHERE token_hash = $1`,
+		tokenHash,
+	)
+	return err
+}
+
 // ReplaceIfExists soft-replaces a token (sets replaced_at) and returns true if a row was updated.
 // Returns false if the token was already replaced by another request.
 func (r *RefreshTokenRepo) ReplaceIfExists(ctx context.Context, tokenHash string) (bool, error) {