Conversation
|
hey hey👋 have you run
already? |
kenzysoror
left a comment
There was a problem hiding this comment.
great job on the endpoints, sonya!!🙌
before we dive into the review, it would be great if you could move the database logic into the services/ layer rather than keeping it directly in the router!
we want to try to keep routers focused on request/response handling, while the services layer contains the actual business logic and DB operations. this helps keep the API layer lightweight, makes the logic easier to reuse, and makes things simpler to test.
i know this wasn't originally implemented with agencies.py, so for the "structural" reference, you can take a look at: #15 and #17. they follow the pattern i'm talking about by putting the DB logic in services/<entity>.py and calling it from the router + you can see my comments on suggested changes.
| from ..database import get_db | ||
| from ..models import Agency, Agent | ||
| from ..schemas import AgentCreate, AgentUpdate, Agent as AgentSchema | ||
|
|
There was a problem hiding this comment.
include from ..services import agents as agent_service
Jira ticket link
Jira ticket
Implementation description
On PUT specifically, agency_id is only validated if it's actually included in the request body; no need to re-validate if not changing.
Steps to test
Navigate to: this link
What should reviewers focus on?
Checklist
Format for branch, commit, and PR title: docs/GIT.md.