Remove completed_on column and add due_date to DaqbookServiceRecord#280
Remove completed_on column and add due_date to DaqbookServiceRecord#280rhythmatician merged 8 commits intomainfrom
Conversation
…handling in work_item_details
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 52afbc4f8d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR performs a schema refactoring of the DaqbookServiceRecord model by removing the redundant completed_on column and adding a new due_date field to track calibration due dates. It also introduces a new API endpoint to retrieve the latest service records per DAQBook asset, enhances validation in the WireSetCert model, and includes changes to work_item_details.py that have critical issues.
Changes:
- Remove
completed_oncolumn from DaqbookServiceRecord and adddue_datecolumn with corresponding migrations - Create new
/daqbook-service-records/latest/endpoint to retrieve the most recent service record for each DAQBook - Add validation to ensure
asset_tagis not None before parsing certificate documents in WireSetCert
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| utils/sync/daqbooks/models.py | Replaces completed_on field with due_date, updates upsert logic to include due_date, and maps next_service_date from Qualer API to due_date |
| utils/schemas.py | Adds DaqbookServiceRecordLatestSchema for the new endpoint response format |
| routes/daqbook_service_records.py | New route file implementing the /daqbook-service-records/latest/ endpoint using DISTINCT ON to get latest records |
| migrations/versions/fe9f4dd27012_add_due_date_to_daqbookservicerecord_.py | Migration to add the due_date column to daqbook_service_records table |
| migrations/versions/e0d468d53509_remove_completed_on_date_from_.py | Migration to drop the redundant completed_on column |
| db/models/wire_set_cert.py | Adds defensive validation check to ensure asset_tag is not None before parsing certificates |
| routes/work_item_details.py | Changes asset_id parameter type and adds Never type check (contains critical bugs) |
| app.py | Registers the new daqbook_service_records blueprint |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… asset attributes validation
Eliminate the redundant
completed_oncolumn from the DaqbookServiceRecord model and introduce a newdue_datefield. Additionally, implement a route to retrieve the latest service records and enhance validation for asset_tag in WireSetCert.