-
Notifications
You must be signed in to change notification settings - Fork 0
Incidents Backend Refactor #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Test Results Summary293 tests - 9 293 ✅ - 9 11s ⏱️ ±0s Results for commit 33cd7dc. ± Comparison against base commit c972c7c. This pull request removes 44 and adds 35 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
naasanov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just a couple changes
naasanov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
* refactor: Store warnings/complaints as a separate Incident table * refactor: Couple of minor changes that were requested
The current system tracks complaints as their own table while warnings and citations are stored as integer counters on the Location entity. This creates inconsistency in how we track incidents and makes it difficult to view the history or details of individual warnings/citations. This PR consolidates all three incident types into a single Incidents table with a severity field.
Changes:
New Incident Module
incident_entity.py,incident_model.py,incident_service.py, andincident_router.pyto replace the complaint moduleIncidentSeverityenum with values:complaint,warning,citationseverityfield to incident data model and entityLocation Entity Updates
warning_countandcitation_countcolumns since these are now derived from the incidents tablecomplaintsrelationship toincidentsLocationDtoto returnincidentslist instead ofcomplaintsMAX_COUNTconstant and count validation logicRemoved Increment Routes
POST /api/police/locations/{id}/warningsandPOST /api/police/locations/{id}/citationsendpointspolice_router.pysince police credential routes live inaccount_router.pyincrement_warnings()andincrement_citations()methods fromLocationServiceTest Updates
incident_utils.py,incident_service_test.py,incident_router_test.py)Script Updates
reset_dev.pyto removewarning_countandcitation_countfrom location seedingCursor was helpful with making these changes, but I reviewed all AI-made changes prior to committing the code.
Closes #127