Appointments should have only healthcare service of type schedulable#3517
Appointments should have only healthcare service of type schedulable#3517
Conversation
📝 WalkthroughWalkthroughAdded validation in the appointment booking endpoint to enforce that healthcare services used for scheduling must have internal_type set to "scheduling". The change includes a pre-check before other validations and corresponding test cases covering both compliant and non-compliant healthcare service configurations. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3517 +/- ##
===========================================
+ Coverage 75.51% 75.54% +0.02%
===========================================
Files 473 473
Lines 21932 21936 +4
Branches 2286 2288 +2
===========================================
+ Hits 16563 16571 +8
+ Misses 4853 4850 -3
+ Partials 516 515 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@care/emr/api/viewsets/scheduling/availability.py`:
- Around line 126-135: In lock_create_appointment, guard against a null
healthcare_service before accessing healthcare_service.internal_type: check
token_slot.resource.healthcare_service is not None (or use getattr) when
token_slot.resource.resource_type ==
SchedulableResourceTypeOptions.healthcare_service.value, and if it is None or
its internal_type is not "scheduling" raise the same ValidationError; update the
conditional that currently reads
token_slot.resource.healthcare_service.internal_type to first verify existence
and then evaluate internal_type so a missing FK yields the ValidationError
instead of an AttributeError.
Proposed Changes
Associated Issue
Architecture changes
Merge Checklist
/docsOnly PR's with test cases included and passing lint and test pipelines will be reviewed
@ohcnetwork/care-backend-maintainers @ohcnetwork/care-backend-admins
Summary by CodeRabbit
Bug Fixes
Tests