feat(api): add dashboard endpoints for clinic, doctor, and secretary roles
- Implemented GET /api/v1/dashboard/clinic to return clinic stats and today's schedule for clinic owners. - Implemented GET /api/v1/dashboard/doctor to return doctor's stats and today's schedule for doctors. - Implemented GET /api/v1/dashboard/secretary to return stats and conditional appointments for secretaries. feat(migrations): create user_active_context and mobile_verification_otp tables - Added migration to create user_active_context table for tracking active user sessions. - Added migration to create mobile_verification_otp table for handling mobile number verification. feat(migrations): create site_config table for application settings - Added migration to create site_config table to store various site configuration settings. feat(appointments): create MyAppointmentsController for user-specific appointments - Added MyAppointmentsController to handle fetching user-specific appointments with pagination and filtering. feat(auth): implement NotificationMobileController for mobile number verification - Added NotificationMobileController to handle OTP requests and verification for mobile number changes. feat(auth): create MobileVerificationOtp entity for OTP management - Created MobileVerificationOtp entity to manage OTP records for mobile verification. feat(auth): create UserActiveContext entity for user session management - Created UserActiveContext entity to manage user active sessions. feat(config): implement SiteConfigController for managing site settings - Added SiteConfigController to handle fetching and updating site configuration settings. feat(config): create SiteConfig entity and repository for configuration management - Created SiteConfig entity and repository to manage site configuration data.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Auth\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table(name: 'mobile_verification_otp')]
|
||||
#[ORM\Index(columns: ['entity_type', 'entity_id'], name: 'idx_otp_entity')]
|
||||
class MobileVerificationOtp
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(name: 'entity_type', type: 'string', length: 20)]
|
||||
private string $entityType;
|
||||
|
||||
#[ORM\Column(name: 'entity_id', type: 'integer')]
|
||||
private int $entityId;
|
||||
|
||||
#[ORM\Column(name: 'new_mobile', type: 'string', length: 15)]
|
||||
private string $newMobile;
|
||||
|
||||
#[ORM\Column(name: 'otp_code', type: 'string', length: 6)]
|
||||
private string $otpCode;
|
||||
|
||||
#[ORM\Column(name: 'expires_at', type: 'integer')]
|
||||
private int $expiresAt;
|
||||
|
||||
#[ORM\Column(name: 'is_used', type: 'boolean')]
|
||||
private bool $isUsed = false;
|
||||
|
||||
#[ORM\Column(name: 'created_at', type: 'integer')]
|
||||
private int $createdAt;
|
||||
|
||||
public function __construct(string $entityType, int $entityId, string $newMobile)
|
||||
{
|
||||
$this->entityType = $entityType;
|
||||
$this->entityId = $entityId;
|
||||
$this->newMobile = $newMobile;
|
||||
$this->otpCode = str_pad((string) random_int(0, 999999), 6, '0', STR_PAD_LEFT);
|
||||
$this->expiresAt = time() + 300; // 5 minutes
|
||||
$this->createdAt = time();
|
||||
}
|
||||
|
||||
public function getId(): ?int { return $this->id; }
|
||||
public function getEntityType(): string { return $this->entityType; }
|
||||
public function getEntityId(): int { return $this->entityId; }
|
||||
public function getNewMobile(): string { return $this->newMobile; }
|
||||
public function getOtpCode(): string { return $this->otpCode; }
|
||||
public function isExpired(): bool { return time() > $this->expiresAt; }
|
||||
public function isUsed(): bool { return $this->isUsed; }
|
||||
|
||||
public function markUsed(): void { $this->isUsed = true; }
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Auth\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table(name: 'user_active_context')]
|
||||
class UserActiveContext
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\OneToOne(targetEntity: User::class)]
|
||||
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
|
||||
private User $user;
|
||||
|
||||
#[ORM\Column(name: 'db_uuid', type: 'string', length: 36)]
|
||||
private string $dbUuid;
|
||||
|
||||
#[ORM\Column(name: 'updated_at', type: 'integer')]
|
||||
private int $updatedAt;
|
||||
|
||||
public function __construct(User $user, string $dbUuid)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->dbUuid = $dbUuid;
|
||||
$this->updatedAt = time();
|
||||
}
|
||||
|
||||
public function getUser(): User { return $this->user; }
|
||||
public function getDbUuid(): string { return $this->dbUuid; }
|
||||
public function getUpdatedAt(): int { return $this->updatedAt; }
|
||||
|
||||
public function setDbUuid(string $dbUuid): self
|
||||
{
|
||||
$this->dbUuid = $dbUuid;
|
||||
$this->updatedAt = time();
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user