68 lines
4.4 KiB
Python
68 lines
4.4 KiB
Python
# Generated by Django 5.0.14 on 2026-01-05 10:43
|
|
|
|
import django.db.models.deletion
|
|
import uuid
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
('contenttypes', '0002_remove_content_type_name'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='NotificationTemplate',
|
|
fields=[
|
|
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('name', models.CharField(max_length=200, unique=True)),
|
|
('description', models.TextField(blank=True)),
|
|
('template_type', models.CharField(choices=[('survey_invitation', 'Survey Invitation'), ('survey_reminder', 'Survey Reminder'), ('complaint_acknowledgment', 'Complaint Acknowledgment'), ('complaint_update', 'Complaint Update'), ('action_assignment', 'Action Assignment'), ('sla_reminder', 'SLA Reminder'), ('sla_breach', 'SLA Breach')], db_index=True, max_length=50)),
|
|
('sms_template', models.TextField(blank=True, help_text='SMS template with {{variables}}')),
|
|
('sms_template_ar', models.TextField(blank=True)),
|
|
('whatsapp_template', models.TextField(blank=True, help_text='WhatsApp template with {{variables}}')),
|
|
('whatsapp_template_ar', models.TextField(blank=True)),
|
|
('email_subject', models.CharField(blank=True, max_length=500)),
|
|
('email_subject_ar', models.CharField(blank=True, max_length=500)),
|
|
('email_template', models.TextField(blank=True, help_text='Email HTML template with {{variables}}')),
|
|
('email_template_ar', models.TextField(blank=True)),
|
|
('is_active', models.BooleanField(default=True)),
|
|
],
|
|
options={
|
|
'ordering': ['name'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='NotificationLog',
|
|
fields=[
|
|
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('channel', models.CharField(choices=[('sms', 'SMS'), ('whatsapp', 'WhatsApp'), ('email', 'Email'), ('push', 'Push Notification')], db_index=True, max_length=20)),
|
|
('recipient', models.CharField(help_text='Phone number or email address', max_length=200)),
|
|
('subject', models.CharField(blank=True, max_length=500)),
|
|
('message', models.TextField()),
|
|
('object_id', models.UUIDField(blank=True, null=True)),
|
|
('status', models.CharField(choices=[('pending', 'Pending'), ('sending', 'Sending'), ('sent', 'Sent'), ('delivered', 'Delivered'), ('failed', 'Failed'), ('bounced', 'Bounced')], db_index=True, default='pending', max_length=20)),
|
|
('sent_at', models.DateTimeField(blank=True, null=True)),
|
|
('delivered_at', models.DateTimeField(blank=True, null=True)),
|
|
('provider', models.CharField(blank=True, help_text='SMS/Email provider used', max_length=50)),
|
|
('provider_message_id', models.CharField(blank=True, help_text='Message ID from provider', max_length=200)),
|
|
('provider_response', models.JSONField(blank=True, default=dict, help_text='Full response from provider')),
|
|
('error', models.TextField(blank=True)),
|
|
('retry_count', models.IntegerField(default=0)),
|
|
('metadata', models.JSONField(blank=True, default=dict, help_text='Additional metadata (campaign, template, etc.)')),
|
|
('content_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='contenttypes.contenttype')),
|
|
],
|
|
options={
|
|
'ordering': ['-created_at'],
|
|
'indexes': [models.Index(fields=['channel', 'status', '-created_at'], name='notificatio_channel_b100a4_idx'), models.Index(fields=['recipient', '-created_at'], name='notificatio_recipie_d4670c_idx'), models.Index(fields=['content_type', 'object_id'], name='notificatio_content_bc6e15_idx')],
|
|
},
|
|
),
|
|
]
|