Initial commit - clean project structure

This commit is contained in:
2026-08-18 16:48:15 +03:30
commit 331148037e
147 changed files with 5543 additions and 0 deletions

30
notifications/models.py Normal file
View File

@@ -0,0 +1,30 @@
from django.db import models
class Notification(models.Model):
# انواع رویدادهایی که این اپ فقط بهشون گوش می‌ده (event-listener)؛
# خودش تولیدکننده‌ی رویداد نیست. طبق سند معماری:
# LessonCompleted/XPEarned (Progress), OrderPaid (Payment),
# TicketReplied (Support), FamilyLinkAccepted/WeeklyReportReady (Family)
TYPE_CHOICES = [
('xp_earned', 'امتیاز گرفتی'),
('lesson_completed', 'درس تکمیل شد'),
('order_paid', 'پرداخت موفق'),
('ticket_replied', 'پاسخ تیکت'),
('family_link_accepted', 'اتصال خانواده تأیید شد'),
('weekly_report_ready', 'گزارش هفتگی آماده شد'),
]
user_id = models.IntegerField(db_index=True) # ارجاع سبک به accounts.User
type = models.CharField(max_length=30, choices=TYPE_CHOICES)
title = models.CharField(max_length=150)
body = models.CharField(max_length=300, blank=True)
related_id = models.IntegerField(null=True, blank=True) # id رکورد رویداد منبع، بدون FK واقعی
is_read = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
ordering = ['-created_at']
def __str__(self):
return f"notif-{self.id}-{self.type}-user{self.user_id}"