Add AST JSON files for doctor service, tag controller, and SMS log entities
- Created new AST JSON file for the doctor service API documentation, detailing endpoints, parameters, and responses. - Added AST JSON file for the TagController, including methods and their relationships with imported classes. - Introduced AST JSON file for the SmsLog entity, outlining its methods and dependencies.
This commit is contained in:
@@ -10,6 +10,9 @@ use App\Secretary\Entity\DoctorSecretary;
|
||||
use App\Secretary\Repository\DoctorSecretaryRepository;
|
||||
use App\Shared\Constant\ErrorCodes;
|
||||
use App\Shared\Controller\BaseController;
|
||||
use App\Sms\Entity\SmsLog;
|
||||
use App\Sms\Service\SmsService;
|
||||
use App\Sms\Service\SmsTextResolver;
|
||||
use App\Subscription\Service\SubscriptionService;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -30,6 +33,9 @@ class SecretaryController extends BaseController
|
||||
private readonly UserRepository $userRepo,
|
||||
private readonly UserPasswordHasherInterface $hasher,
|
||||
private readonly SubscriptionService $subscriptionService,
|
||||
private readonly SmsService $smsService,
|
||||
private readonly SmsTextResolver $smsText,
|
||||
private readonly string $appUrl,
|
||||
) {}
|
||||
|
||||
#[Route('/api/v1/secretary', methods: ['POST'])]
|
||||
@@ -110,9 +116,29 @@ class SecretaryController extends BaseController
|
||||
|
||||
$this->secretaryRepo->save($secretary);
|
||||
|
||||
$this->sendWelcomeSms($mobile, $doctor, $ownerClinic);
|
||||
|
||||
return $this->success(['data' => $secretary->toArray()], 201);
|
||||
}
|
||||
|
||||
/** پیامک خوشآمد به منشی تازهتعریفشده — متن از template تگ TAG_SECRETARY */
|
||||
private function sendWelcomeSms(string $mobile, $doctor, $ownerClinic): void
|
||||
{
|
||||
$ownerName = $ownerClinic !== null
|
||||
? ($ownerClinic->getName() ?? 'کلینیک')
|
||||
: ($doctor->getUser()->getRealName() ?? 'پزشک');
|
||||
|
||||
$link = rtrim($this->appUrl, '/') . '/login';
|
||||
|
||||
$message = $this->smsText->resolve(SmsLog::TAG_SECRETARY, [
|
||||
'owner' => $ownerName,
|
||||
'username' => $mobile,
|
||||
'link' => $link,
|
||||
]);
|
||||
|
||||
$this->smsService->dispatchAsync($mobile, $message, tag: SmsLog::TAG_SECRETARY);
|
||||
}
|
||||
|
||||
#[Route('/api/v1/secretary/{uuid}', methods: ['GET'])]
|
||||
public function show(string $uuid, #[CurrentUser] User $currentUser): JsonResponse
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ class SmsLog
|
||||
public const TAG_NOTIFICATION_MOBILE = 'notification_mobile';
|
||||
public const TAG_USER_TEMPLATE = 'user_template';
|
||||
public const TAG_WELCOME = 'welcome';
|
||||
public const TAG_SECRETARY = 'secretary';
|
||||
|
||||
public const TAGS = [
|
||||
self::TAG_GLOBAL,
|
||||
@@ -29,6 +30,7 @@ class SmsLog
|
||||
self::TAG_NOTIFICATION_MOBILE,
|
||||
self::TAG_USER_TEMPLATE,
|
||||
self::TAG_WELCOME,
|
||||
self::TAG_SECRETARY,
|
||||
];
|
||||
|
||||
#[ORM\Id]
|
||||
|
||||
@@ -43,6 +43,11 @@ class SmsMessageTemplate
|
||||
'body' => "کد تأیید شماره اعلان شما: {code}\nاعتبار: ۵ دقیقه",
|
||||
'variables' => ['code'],
|
||||
],
|
||||
SmsLog::TAG_SECRETARY => [
|
||||
'title' => 'دعوت بهعنوان منشی',
|
||||
'body' => "شما بهعنوان منشیِ {owner} در کلینیکپرو تعریف شدید.\nشمارهکاربری: {username}\nلینک ورود: {link}",
|
||||
'variables' => ['owner', 'username', 'link'],
|
||||
],
|
||||
];
|
||||
|
||||
#[ORM\Id]
|
||||
|
||||
Reference in New Issue
Block a user