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,46 @@
|
||||
# معماری — تسک ۱۳: ماژول لایک
|
||||
|
||||
## ساختار فایلها
|
||||
```
|
||||
src/Module/Like/
|
||||
├── Controller/
|
||||
│ └── LikeController.php
|
||||
├── Service/
|
||||
│ └── LikeService.php
|
||||
├── Repository/
|
||||
│ └── LikeRepository.php
|
||||
├── Entity/
|
||||
│ └── Like.php
|
||||
└── DTO/
|
||||
└── Request/
|
||||
└── CreateLikeRequest.php
|
||||
```
|
||||
|
||||
## Entity: Like
|
||||
```php
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table(name: 'likes')]
|
||||
class Like
|
||||
{
|
||||
#[ORM\Id, ORM\GeneratedValue, ORM\Column]
|
||||
private int $id;
|
||||
|
||||
#[ORM\Column(type: UuidType::NAME, unique: true)]
|
||||
private Uuid $uuid;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
private User $user;
|
||||
|
||||
// نوع موجودیت: blog, doctor
|
||||
#[ORM\Column(length: 30)]
|
||||
private string $entityType;
|
||||
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private int $entityId;
|
||||
|
||||
#[ORM\Column(type: 'boolean', default: true)]
|
||||
private bool $isLiked;
|
||||
|
||||
// TimestampableTrait
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,33 @@
|
||||
# پایگاه داده — تسک ۱۳: ماژول لایک
|
||||
|
||||
## ساختار واقعی از Drupal (از config تأیید شده)
|
||||
|
||||
در Drupal، لایک به عنوان bundle=`like` در entity `clinic_pro_comment` ذخیره میشود:
|
||||
- `field_like` (boolean) → آیا لایک است یا آنلایک
|
||||
- `field_comment_id` (entity_reference → comment) → لایک مربوط به کدام کامنت
|
||||
|
||||
لایکها **فقط** روی نظرات (comment) هستند، نه blog یا doctor.
|
||||
|
||||
## جدول: likes
|
||||
_(entity_type=clinic_pro_comment, bundle=like)_
|
||||
|
||||
| ستون | نوع | نام Drupal | توضیح |
|
||||
|------|-----|-----------|-------|
|
||||
| id | INT UNSIGNED AUTO_INCREMENT PK | id | |
|
||||
| uuid | CHAR(36) UNIQUE NOT NULL | uuid | |
|
||||
| user_id | INT FK → users.id NOT NULL | uid | کاربری که لایک زده |
|
||||
| comment_id | INT FK → comments.id NOT NULL | field_comment_id | کامنت مورد نظر |
|
||||
| is_liked | TINYINT(1) DEFAULT 1 | field_like | 1=لایک، 0=آنلایک |
|
||||
| created_at | INT NOT NULL | created | Unix timestamp |
|
||||
| updated_at | INT NOT NULL | changed | Unix timestamp |
|
||||
|
||||
## ایندکسها
|
||||
```sql
|
||||
CREATE UNIQUE INDEX idx_likes_user_comment ON likes(user_id, comment_id);
|
||||
CREATE INDEX idx_likes_comment ON likes(comment_id);
|
||||
```
|
||||
|
||||
## نکات مهم
|
||||
- در Drupal، لایک فقط برای **comment** است (نه blog یا doctor)
|
||||
- `field_like` boolean است — کاربر میتواند لایک (1) یا آنلایک (0) ثبت کند
|
||||
- UNIQUE(user_id, comment_id) تضمین میکند هر کاربر فقط یک بار لایک/آنلایک بزند
|
||||
@@ -0,0 +1,21 @@
|
||||
# نکات پیادهسازی — تسک ۱۳: ماژول لایک
|
||||
|
||||
## Toggle Like
|
||||
PATCH endpoint باید is_liked را toggle کند:
|
||||
```php
|
||||
public function toggle(Like $like): void
|
||||
{
|
||||
$like->setIsLiked(!$like->isLiked());
|
||||
$this->em->flush();
|
||||
}
|
||||
```
|
||||
|
||||
## جلوگیری از لایک دوگانه
|
||||
unique index روی (user_id, entity_type, entity_id) جلوگیری میکند.
|
||||
اگر قبلاً لایک وجود داشت، PATCH برای toggle استفاده میشود.
|
||||
|
||||
## مجوزها
|
||||
```
|
||||
POST /like → احراز هویتشده
|
||||
PATCH /like/{uuid} → owner
|
||||
```
|
||||
@@ -0,0 +1,17 @@
|
||||
# تسک ۱۳: ماژول لایک
|
||||
|
||||
## توضیح
|
||||
سیستم لایک برای بلاگها یا دکترها.
|
||||
|
||||
## Endpoint ها
|
||||
|
||||
| متد | مسیر | توضیح | نیاز به Auth |
|
||||
|-----|------|-------|-------------|
|
||||
| POST | `/api/v1/clinicpro/like` | ثبت لایک | بله |
|
||||
| PATCH | `/api/v1/clinicpro/like/{uuid}` | ویرایش/حذف لایک (toggle) | بله |
|
||||
|
||||
## پیشنیازها
|
||||
- تسک ۰۱، ۰۲
|
||||
|
||||
## زمان تخمینی
|
||||
۲ تا ۳ ساعت
|
||||
Reference in New Issue
Block a user