feat: Implement SMS sending functionality with KavehNegar and Rangineh providers
- Add SendSmsMessage class for encapsulating SMS message data. - Create KavehNegarProvider and RanginehProvider classes implementing SmsProviderInterface for sending SMS. - Implement SmsLogRepository and SmsTemplateRepository for managing SMS logs and templates. - Develop SendSmsHandler for handling SMS sending messages. - Create SmsService to manage SMS dispatching and logging. - Add UserProfileController for managing user profiles with CRUD operations. - Implement UserProfile entity and repository for user profile data management. - Update symfony.lock and bootstrap.php for project dependencies and environment setup.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Shared\Controller;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Contracts\Cache\CacheInterface;
|
||||
|
||||
class HealthController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly CacheInterface $cache,
|
||||
) {}
|
||||
|
||||
#[Route('/health', methods: ['GET'])]
|
||||
public function __invoke(): JsonResponse
|
||||
{
|
||||
$checks = [];
|
||||
$status = 'ok';
|
||||
|
||||
try {
|
||||
$this->em->getConnection()->executeQuery('SELECT 1');
|
||||
$checks['database'] = 'ok';
|
||||
} catch (\Throwable) {
|
||||
$checks['database'] = 'error';
|
||||
$status = 'degraded';
|
||||
}
|
||||
|
||||
try {
|
||||
$item = $this->cache->getItem('health_check');
|
||||
$checks['redis'] = 'ok';
|
||||
} catch (\Throwable) {
|
||||
$checks['redis'] = 'error';
|
||||
$status = 'degraded';
|
||||
}
|
||||
|
||||
return new JsonResponse([
|
||||
'status' => $status,
|
||||
'checks' => $checks,
|
||||
'timestamp' => time(),
|
||||
], $status === 'ok' ? 200 : 503);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user