feat: add clinic doctor invitation feature
- Implemented ClinicInvitationController to handle doctor invitations. - Created ClinicDoctorInvitation entity and repository for managing invitations. - Added ClinicInvitationService for business logic related to invitations. - Introduced endpoints for inviting, listing, resending, changing status, and deleting invitations. - Updated security configuration to allow public access to invitation endpoints. - Added migration for clinic_doctor_invitations table. - Enhanced DoctorRepository with a method to find doctors by mobile number. - Updated ClinicDetailPage to include invitation management UI.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\ClinicInvitation\Repository;
|
||||
|
||||
use App\ClinicInvitation\Entity\ClinicDoctorInvitation;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class ClinicDoctorInvitationRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, ClinicDoctorInvitation::class);
|
||||
}
|
||||
|
||||
public function findByToken(string $token): ?ClinicDoctorInvitation
|
||||
{
|
||||
return $this->findOneBy(['token' => $token]);
|
||||
}
|
||||
|
||||
public function findPendingByMobileAndClinic(string $mobile, int $clinicId): ?ClinicDoctorInvitation
|
||||
{
|
||||
return $this->createQueryBuilder('i')
|
||||
->where('i.mobile = :mobile')
|
||||
->andWhere('i.clinic = :clinicId')
|
||||
->andWhere('i.status = :status')
|
||||
->setParameter('mobile', $mobile)
|
||||
->setParameter('clinicId', $clinicId)
|
||||
->setParameter('status', ClinicDoctorInvitation::STATUS_PENDING)
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getOneOrNullResult();
|
||||
}
|
||||
|
||||
public function save(ClinicDoctorInvitation $invitation): void
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
$em->persist($invitation);
|
||||
$em->flush();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user