Skip to content

BDMS 55: contact coverage & other updates#89

Merged
jirhiker merged 59 commits into
pre-productionfrom
jab-api-coverage-contact
Aug 20, 2025
Merged

BDMS 55: contact coverage & other updates#89
jirhiker merged 59 commits into
pre-productionfrom
jab-api-coverage-contact

Conversation

@jacob-a-brown

@jacob-a-brown jacob-a-brown commented Aug 18, 2025

Copy link
Copy Markdown
Contributor

Why

This PR addresses the following problem / context:

  • The /contact route should be fully covered with GET, GET by ID, PATCH, POST, and DELETE endpoints
  • tests impacted by fixtures needed to be updated to use those fixtures
  • proper authentication and permissions need to be vetted at endpoints

How

Implementation summary - the following was changed / added / removed:

  • Updated contact schemas, including ThingContactAssociation create, update, and response schemas
  • Added user to contact endpoints and functions for authentication, permissions, and paper trails
    • All contact authentication roles are amp. This can be changed if it should be general.
    • all dependency overrides are done in scope="module" fixtures so overrides in one script doesn't effect overrides in another.
  • Updated search and asset tests to use fixtures since they were previously impacted by contact tests that didn't use fixtures (and it now does)
    • added url to Asset schema to correspond with the database and incoming data.

Notes

Any special considerations, workarounds, or follow-up work to note?

  • added passive_deletes=True to cascade the deletion of email, phone, address, and ThingContactAssociation so that if a contact is deleted its child items will also be deleted. If this was not implemented the contact_id would be set to NULL in the tables, violating the not-null constraint.
  • Implemented a PydanticStyleException so that all raised exceptions follow the Pydantic style
  • the updates can include change the contact_id to associate the items with another contact

- implement Validate schema for create and update schemas
- use "| None" instead of Optional for style consistency
404 error handling is now done by simple_get_by_id
@jacob-a-brown jacob-a-brown requested a review from jirhiker August 18, 2025 14:43
@codecov-commenter

codecov-commenter commented Aug 18, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.88386% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
api/contact.py 98.78% 1 Missing ⚠️
Files with missing lines Coverage Δ
api/sample.py 100.00% <100.00%> (ø)
api/sensor.py 86.00% <100.00%> (+0.58%) ⬆️
db/contact.py 100.00% <100.00%> (ø)
db/thing.py 100.00% <100.00%> (ø)
schemas/contact.py 100.00% <100.00%> (ø)
schemas/sample.py 98.48% <100.00%> (+0.02%) ⬆️
schemas/thing.py 97.95% <100.00%> (-0.07%) ⬇️
services/contact_helper.py 100.00% <100.00%> (ø)
services/exceptions_helper.py 100.00% <100.00%> (ø)
tests/__init__.py 100.00% <100.00%> (ø)
... and 12 more

@jacob-a-brown jacob-a-brown requested review from jirhiker and removed request for jirhiker August 20, 2025 19:26
@jirhiker jirhiker merged commit ecaccd0 into pre-production Aug 20, 2025
3 checks passed
@jirhiker jirhiker deleted the jab-api-coverage-contact branch December 3, 2025 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants