Add GET /consultations/{uuid}/assessments for consultation-scoped forms.
Deploy Ladill Care / deploy (push) Successful in 50s
Deploy Ladill Care / deploy (push) Successful in 50s
Only POST existed on that path, so navigating to the natural collection URL 404'd. Serve the patient assessments index with consultation return context, and cover it with a doctor feature test. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -11,6 +11,7 @@ use App\Models\Consultation;
|
||||
use App\Models\Member;
|
||||
use App\Models\Organization;
|
||||
use App\Models\Patient;
|
||||
use App\Models\Practitioner;
|
||||
use App\Models\User;
|
||||
use App\Models\Visit;
|
||||
use App\Services\Care\CareFeatures;
|
||||
@@ -60,17 +61,30 @@ class CareAssessmentCaptureTest extends TestCase
|
||||
],
|
||||
]);
|
||||
|
||||
$this->branch = Branch::create([
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'name' => 'Main',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$this->member = Member::create([
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'user_ref' => $this->user->public_id,
|
||||
'role' => 'doctor',
|
||||
'branch_id' => $this->branch->id,
|
||||
]);
|
||||
|
||||
$this->branch = Branch::create([
|
||||
// Doctors are branch-scoped via linked practitioner desks.
|
||||
Practitioner::create([
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'name' => 'Main',
|
||||
'branch_id' => $this->branch->id,
|
||||
'member_id' => $this->member->id,
|
||||
'user_ref' => $this->user->public_id,
|
||||
'name' => 'Dr Capture',
|
||||
'specialty' => 'General Practice',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
@@ -320,6 +334,39 @@ class CareAssessmentCaptureTest extends TestCase
|
||||
$this->assertDatabaseHas('care_audit_logs', ['action' => 'assessment.cancelled']);
|
||||
}
|
||||
|
||||
public function test_doctor_can_view_consultation_scoped_assessments_index(): void
|
||||
{
|
||||
$this->setMemberRole('doctor');
|
||||
|
||||
$visit = Visit::create([
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'patient_id' => $this->patient->id,
|
||||
'status' => Visit::STATUS_OPEN,
|
||||
'checked_in_at' => now(),
|
||||
]);
|
||||
|
||||
$consultation = Consultation::create([
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'visit_id' => $visit->id,
|
||||
'patient_id' => $this->patient->id,
|
||||
'status' => Consultation::STATUS_DRAFT,
|
||||
'started_at' => now(),
|
||||
]);
|
||||
|
||||
$this->actingAs($this->user)
|
||||
->get(route('care.consultations.assessments.index', $consultation))
|
||||
->assertOk()
|
||||
->assertSee('Clinical assessments')
|
||||
->assertSee($this->patient->fullName());
|
||||
|
||||
// Path shape matches care.ladill.com/consultations/{uuid}/assessments
|
||||
$this->actingAs($this->user)
|
||||
->get('/consultations/'.$consultation->uuid.'/assessments')
|
||||
->assertOk();
|
||||
}
|
||||
|
||||
public function test_consultation_scoped_start_links_consultation_and_visit(): void
|
||||
{
|
||||
$this->setMemberRole('doctor');
|
||||
|
||||
Reference in New Issue
Block a user