Files
clinicpro/docs/tasks/task-08-categories/architecture.md
T
hamed de1a78a235 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.
2026-06-09 22:00:34 +03:30

1.9 KiB

معماری — تسک ۰۸: ماژول دسته‌بندی‌ها

ساختار فایل‌ها

src/Module/Category/
├── Controller/
│   └── CategoryController.php    ← همه endpoint ها
├── Service/
│   └── CategoryService.php
├── Repository/
│   └── CategoryRepository.php
├── Entity/
│   └── Category.php
├── DTO/
│   ├── Request/
│   │   ├── CreateCategoryRequest.php
│   │   └── UpdateCategoryRequest.php
│   └── Response/
│       └── CategoryResponse.php
└── DataFixtures/
    └── CategoryFixtures.php      ← داده‌های اولیه (استان، شهر، تخصص، ...)

Entity: Category

#[ORM\Entity]
#[ORM\Table(name: 'categories')]
class Category
{
    #[ORM\Id, ORM\GeneratedValue, ORM\Column]
    private int $id;

    #[ORM\Column(length: 200)]
    private string $name;

    #[ORM\Column(length: 100, nullable: true)]
    private ?string $code;  // کد انگلیسی برای فیلتر

    // نوع دسته: tag, supplementary_insurance, insurance_type,
    //           state, city, specially_doctor, doctor_services
    #[ORM\Column(length: 50)]
    private string $type;

    #[ORM\ManyToOne(targetEntity: self::class)]
    #[ORM\JoinColumn(nullable: true)]
    private ?Category $parent;  // برای رابطه استان-شهر

    #[ORM\Column(type: 'integer', default: 0)]
    private int $sortOrder = 0;

    // TimestampableTrait
}

Routing نمونه

// GET /api/v1/categorys/{type}
#[Route('/api/v1/categorys/{type}', methods: ['GET'])]
public function listByType(string $type): Response
{
    $allowed = ['tag', 'supplementary_insurance', 'insurance_type',
                'state', 'city', 'specially_doctor', 'doctor_services'];
    if (!in_array($type, $allowed)) {
        return $this->notFound();
    }
    return $this->json($this->categoryService->findByType($type));
}