Skip to content

Enhance exception handling, caching, and CORS in QuoteService#5

Merged
WillianSilva51 merged 7 commits intomainfrom
feat/new-tests
Apr 3, 2026
Merged

Enhance exception handling, caching, and CORS in QuoteService#5
WillianSilva51 merged 7 commits intomainfrom
feat/new-tests

Conversation

@WillianSilva51
Copy link
Copy Markdown
Owner

[Copilot is generating a summary...]

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Quotes API/service layer to improve domain validation and exception handling, adjusts Redis cache key generation behavior, adds global CORS middleware configuration, and moves test/lint tooling into a dev optional dependency group.

Changes:

  • Add duplicate-quote validation in QuoteService.create_quote() backed by a new repository lookup method and corresponding tests.
  • Restructure exception modules/handlers under api/core/* and improve unexpected exception logging.
  • Split dev tools into project.optional-dependencies.dev and update CI to install them via uv sync --extra dev.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
uv.lock Moves pytest/ruff into an optional dev extra in the lock metadata.
pyproject.toml Defines [project.optional-dependencies].dev for test/lint dependencies.
api/tests/test_quote_service.py Adds tests/fixtures for duplicate detection; introduces a placeholder get_all test.
api/services/quote_service.py Adds duplicate check + fixes tags filter construction for get_all.
api/routers/quotes.py Tightens API key dependency typing.
api/repositories/quote_repository.py Uses model_validate on create; adds get_quote_by_content_and_author.
api/main.py Switches exception imports to core.* and adds global CORS middleware.
api/exceptions/__init__.py Removes old exceptions package exports.
api/core/handlers/exception_handlers.py Updates imports and logs unexpected exceptions with stack traces via Loguru.
api/core/handlers/__init__.py Adds package export for handlers.
api/core/exceptions/custom_exceptions.py Ensures exceptions call super().__init__ for proper message behavior.
api/core/exceptions/__init__.py Adds package export for exceptions.
api/core/cache.py Filters cache key kwargs and caches falsy-but-not-None results.
.github/workflows/python-tests.yml Installs dev extras in CI with uv.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@WillianSilva51 WillianSilva51 reopened this Apr 3, 2026
@WillianSilva51 WillianSilva51 merged commit 63d1ef5 into main Apr 3, 2026
1 check passed
@WillianSilva51 WillianSilva51 deleted the feat/new-tests branch April 3, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants