feat(appointments): only doctors with a weekly schedule get a tab
my/clinic-doctors now reports has_schedule per doctor, and the appointments page builds tabs from it. A doctor with no working days had a tab that could only ever show an empty timeline. The flag is resolved with one query for the whole list rather than one per doctor. Clinic owners now read this authenticated endpoint too instead of the public clinic doctor-list, which is where the flag lives; admin keeps the public list and, with no flag present, hides nobody. Also repairs fallout from making the resource supervisor mandatory: four test classes build resources through their own helpers and were failing with 422. The supervisorFor helper moved to ApiTestCase so all domains share one, rather than copying it per suite. Full backend suite is green again (1306 tests) — the previous commit only ran tests/Resource and missed this. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -61,34 +61,6 @@ abstract class ResourceTestCase extends ApiTestCase
|
||||
return [$user, $doctor, $address];
|
||||
}
|
||||
|
||||
/**
|
||||
* پزشکِ ناظرِ محیطِ همین آدرس — از وقتی ناظر روی منبع الزامی شد، هر ساختِ منبع
|
||||
* یکی لازم دارد. برای کلینیک یک پزشک عضو ساخته میشود و برای مطب، خودِ پزشک.
|
||||
*/
|
||||
protected function supervisorFor(DoctorAddress $address): Doctor
|
||||
{
|
||||
if ($address->tenantEntityType() === 'doctor') {
|
||||
return $this->em->getRepository(Doctor::class)->find($address->tenantEntityId());
|
||||
}
|
||||
|
||||
$clinic = $this->em->getRepository(Clinic::class)->find($address->tenantEntityId());
|
||||
|
||||
foreach ($clinic->getDoctors() as $existing) {
|
||||
return $existing;
|
||||
}
|
||||
|
||||
$user = $this->createUser(['ROLE_USER', 'ROLE_DOCTOR']);
|
||||
$doctor = new Doctor($user, 'پزشک ناظر');
|
||||
$doctor->setMobileNumber($user->getMobileNumber());
|
||||
$this->em->persist($doctor);
|
||||
$this->em->flush();
|
||||
|
||||
$clinic->getDoctors()->add($doctor);
|
||||
$this->em->flush();
|
||||
|
||||
return $doctor;
|
||||
}
|
||||
|
||||
protected function resourceType(DoctorAddress $address, string $code = 'device', string $name = 'دستگاه'): ResourceType
|
||||
{
|
||||
$type = new ResourceType($address->tenantEntityType(), $address->tenantEntityId(), $code, $name);
|
||||
|
||||
Reference in New Issue
Block a user