Files
clinicpro/docs/tasks/task-13-like/database.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

34 lines
1.6 KiB
Markdown

# پایگاه داده — تسک ۱۳: ماژول لایک
## ساختار واقعی از 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) تضمین می‌کند هر کاربر فقط یک بار لایک/آنلایک بزند