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,68 @@
|
||||
# معماری — تسک ۰۸: ماژول دستهبندیها
|
||||
|
||||
## ساختار فایلها
|
||||
```
|
||||
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
|
||||
```php
|
||||
#[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 نمونه
|
||||
```php
|
||||
// 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));
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,69 @@
|
||||
# پایگاه داده — تسک ۰۸: ماژول دستهبندیها
|
||||
|
||||
## ساختار واقعی از DB backup
|
||||
|
||||
جدول `category` یک entity با چند bundle است.
|
||||
بیشتر دادهها (استانها، شهرها، تخصصها) در INSERTهای DB backup موجودند.
|
||||
|
||||
## جدول: categories
|
||||
_(entity_type=category — از DB backup تأیید شده)_
|
||||
|
||||
| ستون | نوع | نام Drupal | توضیح |
|
||||
|------|-----|-----------|-------|
|
||||
| id | INT UNSIGNED AUTO_INCREMENT PK | id | |
|
||||
| uuid | CHAR(36) UNIQUE NOT NULL | uuid | |
|
||||
| bundle | VARCHAR(32) NOT NULL | bundle | نوع دستهبندی |
|
||||
| label | VARCHAR(255) NULL | label | نام (base field) |
|
||||
| status | TINYINT(1) DEFAULT 1 | status | فعال/غیرفعال |
|
||||
| parent_id | INT FK → categories.id NULL | field_parent | والد (استان→شهر / تخصص والد) |
|
||||
| weight | INT DEFAULT 0 | field_weight | ترتیب نمایش |
|
||||
| logo_id | INT FK → files.id NULL | field_logo | تصویر/آیکون (برای بیمهها) |
|
||||
| title | VARCHAR(255) NULL | field_title | عنوان جایگزین |
|
||||
| representation_id | INT FK → representations.id NULL | field_representation | نماینده مرتبط (برای city bundle) |
|
||||
|
||||
## فیلدهای اختصاصی bundle=city
|
||||
_(فقط برای city bundle — از config تأیید شده)_
|
||||
|
||||
| ستون | نوع | نام Drupal | توضیح |
|
||||
|------|-----|-----------|-------|
|
||||
| contact_phone | VARCHAR(255) NULL | field_contactphone | تلفن |
|
||||
| email | VARCHAR(255) NULL | field_email | ایمیل |
|
||||
| description | TEXT NULL | field_description | توضیحات |
|
||||
| slogan | VARCHAR(255) NULL | field_slogan | شعار |
|
||||
| domain | VARCHAR(255) NULL | field_domain | دامنه اختصاصی شهر |
|
||||
| keywords | VARCHAR(255) NULL | field_keywords | کلیدواژه SEO |
|
||||
| footer_description | TEXT NULL | field_footerdescription | توضیحات footer |
|
||||
| footer_disclaimer | TEXT NULL | field_footerdisclaimer | سلب مسئولیت |
|
||||
| social_media | LONGTEXT NULL | field_socialmedia | شبکههای اجتماعی (JSON) |
|
||||
|
||||
## مقادیر مجاز bundle
|
||||
```
|
||||
state → استان (31 استان ایران — داده در DB موجود)
|
||||
city → شهر (parent_id = state_id)
|
||||
specially_doctor → تخصص پزشکی
|
||||
doctor_services → سرویسهای پزشکی
|
||||
insurance_type → نوع بیمه پایه
|
||||
supplementary_insurance → بیمه تکمیلی
|
||||
tag → تگ بلاگ
|
||||
```
|
||||
|
||||
## ایندکسها
|
||||
```sql
|
||||
CREATE INDEX idx_categories_bundle ON categories(bundle);
|
||||
CREATE INDEX idx_categories_parent ON categories(parent_id);
|
||||
CREATE INDEX idx_categories_status ON categories(status, bundle);
|
||||
```
|
||||
|
||||
## دادههای موجود در DB backup (نمونه)
|
||||
```
|
||||
استانها: id=1..100 (bundle='state') — تمام ۳۱ استان ایران
|
||||
شهرها: id=101..2503 (bundle='city') — شهرهای ایران
|
||||
```
|
||||
دادهها باید از DB backup به Symfony fixtures مهاجرت داده شوند.
|
||||
|
||||
## نکته مهم: city bundle
|
||||
City bundle فیلدهای زیادی دارد که برای نمایش اطلاعات سایت نماینده استفاده میشوند:
|
||||
- `field_representation` → لینک به نماینده (multi-tenant)
|
||||
- `field_domain` → دامنه اختصاصی شهر
|
||||
- `field_slogan`, `field_keywords` → SEO
|
||||
این فیلدها در Symfony در جدول جداگانه `city_settings` یا در همان categories با nullable columns نگهداشته میشوند.
|
||||
@@ -0,0 +1,33 @@
|
||||
# نکات پیادهسازی — تسک ۰۸: ماژول دستهبندیها
|
||||
|
||||
## کشینگ
|
||||
لیستهای Lookup (استان، شهر، تخصص) بهندرت تغییر میکنند.
|
||||
→ نتایج را با Symfony Cache (Redis) کش کن:
|
||||
```php
|
||||
public function findByType(string $type): array
|
||||
{
|
||||
return $this->cache->get("categories_{$type}", function (ItemInterface $item) use ($type) {
|
||||
$item->expiresAfter(3600); // 1 ساعت
|
||||
return $this->repository->findBy(['type' => $type], ['sortOrder' => 'ASC']);
|
||||
});
|
||||
}
|
||||
```
|
||||
→ هنگام ایجاد/ویرایش/حذف category، کش مربوط را invalidate کن.
|
||||
|
||||
## فیلتر شهر براساس استان
|
||||
برای لیست شهرها، پارامتر `state_id` اختیاری است:
|
||||
```
|
||||
GET /api/v1/categorys/city?state_id=5
|
||||
```
|
||||
|
||||
## مجوزها
|
||||
```
|
||||
GET /api/v1/categorys/* → عمومی (بدون auth)
|
||||
POST /api/v1/category → ROLE_ADMIN
|
||||
PATCH /api/v1/category/{id} → ROLE_ADMIN
|
||||
DELETE /api/v1/category/{id} → ROLE_ADMIN
|
||||
```
|
||||
|
||||
## نکته نام endpoint
|
||||
در Drupal از `categorys` (اشتباه گرامری) استفاده شده.
|
||||
در Symfony همان مسیر را حفظ کن تا کلاینت تغییر نکند.
|
||||
@@ -0,0 +1,52 @@
|
||||
# تسک ۰۸: ماژول دستهبندیها و Lookup ها
|
||||
|
||||
## توضیح
|
||||
پیادهسازی لیستهای ثابت (lookup) مثل استانها، شهرها، تخصصهای پزشکی،
|
||||
بیمهها، تگها و مدیریت دستهبندیها.
|
||||
|
||||
## Endpoint ها
|
||||
|
||||
| متد | مسیر | توضیح | نیاز به Auth |
|
||||
|-----|------|-------|-------------|
|
||||
| GET | `/api/v1/categorys/tag` | لیست تگها | خیر |
|
||||
| GET | `/api/v1/categorys/supplementary_insurance` | بیمههای تکمیلی | خیر |
|
||||
| GET | `/api/v1/categorys/insurance_type` | نوع بیمه پایه | خیر |
|
||||
| GET | `/api/v1/categorys/state` | لیست استانها | خیر |
|
||||
| GET | `/api/v1/categorys/city` | لیست شهرها | خیر |
|
||||
| GET | `/api/v1/categorys/specially_doctor` | تخصصهای پزشکی | خیر |
|
||||
| GET | `/api/v1/categorys/doctor_services` | سرویسهای پزشکی | خیر |
|
||||
| POST | `/api/v1/category` | ایجاد دستهبندی | بله (Admin) |
|
||||
| PATCH | `/api/v1/category/{id}` | ویرایش دستهبندی | بله (Admin) |
|
||||
| DELETE | `/api/v1/category/{id}` | حذف دستهبندی | بله (Admin) |
|
||||
|
||||
## پیشنیازها
|
||||
- تسک ۰۱ و ۰۲
|
||||
|
||||
## نکته مهم
|
||||
این تسک باید **قبل از تسکهای ۰۵، ۰۶** انجام شود چون
|
||||
تسکهای دکتر و کلینیک به categories وابستهاند.
|
||||
|
||||
## زمان تخمینی
|
||||
۴ تا ۵ ساعت
|
||||
|
||||
## نمونه Response
|
||||
|
||||
### GET /api/v1/categorys/state
|
||||
```json
|
||||
{
|
||||
"data": [
|
||||
{ "id": 1, "name": "تهران", "code": "tehran" },
|
||||
{ "id": 2, "name": "اصفهان", "code": "isfahan" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### GET /api/v1/categorys/specially_doctor
|
||||
```json
|
||||
{
|
||||
"data": [
|
||||
{ "id": 1, "name": "قلب و عروق", "code": "cardiology" },
|
||||
{ "id": 2, "name": "مغز و اعصاب", "code": "neurology" }
|
||||
]
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user