HH/apps/accounts/migrations/0001_initial.py

149 lines
10 KiB
Python

<<<<<<< HEAD
# Generated by Django 6.0 on 2026-01-12 09:50
=======
# Generated by Django 6.0.1 on 2026-01-12 09:50
>>>>>>> 1f9d8a7 (update on the complaint sla and staff hierarchy)
import django.utils.timezone
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='User',
fields=[
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('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)),
('email', models.EmailField(db_index=True, max_length=254, unique=True)),
('username', models.CharField(blank=True, max_length=150, null=True)),
('phone', models.CharField(blank=True, max_length=20)),
('employee_id', models.CharField(blank=True, db_index=True, max_length=50)),
('avatar', models.ImageField(blank=True, null=True, upload_to='avatars/')),
('bio', models.TextField(blank=True)),
('language', models.CharField(choices=[('en', 'English'), ('ar', 'Arabic')], default='en', max_length=5)),
('notification_email_enabled', models.BooleanField(default=True, help_text='Enable email notifications')),
('notification_sms_enabled', models.BooleanField(default=False, help_text='Enable SMS notifications')),
('preferred_notification_channel', models.CharField(choices=[('email', 'Email'), ('sms', 'SMS'), ('both', 'Both')], default='email', help_text='Preferred notification channel for general notifications', max_length=10)),
('explanation_notification_channel', models.CharField(choices=[('email', 'Email'), ('sms', 'SMS'), ('both', 'Both')], default='email', help_text='Preferred channel for explanation requests', max_length=10)),
('is_active', models.BooleanField(default=True)),
('is_provisional', models.BooleanField(default=False, help_text='User is in onboarding process')),
('invitation_token', models.CharField(blank=True, help_text='Token for account activation', max_length=100, null=True, unique=True)),
('invitation_expires_at', models.DateTimeField(blank=True, help_text='When the invitation token expires', null=True)),
('acknowledgement_completed', models.BooleanField(default=False, help_text='User has completed acknowledgement wizard')),
('acknowledgement_completed_at', models.DateTimeField(blank=True, help_text='When acknowledgement was completed', null=True)),
('current_wizard_step', models.IntegerField(default=0, help_text='Current step in onboarding wizard')),
('wizard_completed_steps', models.JSONField(blank=True, default=list, help_text='List of completed wizard step IDs')),
],
options={
'ordering': ['-date_joined'],
},
),
migrations.CreateModel(
name='AcknowledgementChecklistItem',
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)),
('role', models.CharField(blank=True, choices=[('px_admin', 'PX Admin'), ('hospital_admin', 'Hospital Admin'), ('department_manager', 'Department Manager'), ('px_coordinator', 'PX Coordinator'), ('physician', 'Physician'), ('nurse', 'Nurse'), ('staff', 'Staff'), ('viewer', 'Viewer')], help_text='Target role for this item', max_length=50, null=True)),
('code', models.CharField(help_text='Unique code for this checklist item', max_length=100, unique=True)),
('text_en', models.CharField(max_length=500)),
('text_ar', models.CharField(blank=True, max_length=500)),
('description_en', models.TextField(blank=True)),
('description_ar', models.TextField(blank=True)),
('is_required', models.BooleanField(default=True, help_text='Item must be acknowledged')),
('order', models.IntegerField(default=0, help_text='Display order in checklist')),
('is_active', models.BooleanField(default=True)),
],
options={
'ordering': ['role', 'order', 'code'],
},
),
migrations.CreateModel(
name='AcknowledgementContent',
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)),
('role', models.CharField(blank=True, choices=[('px_admin', 'PX Admin'), ('hospital_admin', 'Hospital Admin'), ('department_manager', 'Department Manager'), ('px_coordinator', 'PX Coordinator'), ('physician', 'Physician'), ('nurse', 'Nurse'), ('staff', 'Staff'), ('viewer', 'Viewer')], help_text='Target role for this content', max_length=50, null=True)),
('code', models.CharField(help_text='Unique code for this content section', max_length=100, unique=True)),
('title_en', models.CharField(max_length=200)),
('title_ar', models.CharField(blank=True, max_length=200)),
('description_en', models.TextField()),
('description_ar', models.TextField(blank=True)),
('content_en', models.TextField(blank=True)),
('content_ar', models.TextField(blank=True)),
('icon', models.CharField(blank=True, help_text="Icon class (e.g., 'fa-user', 'fa-shield')", max_length=50)),
('color', models.CharField(blank=True, help_text="Hex color code (e.g., '#007bff')", max_length=7)),
('order', models.IntegerField(default=0, help_text='Display order in wizard')),
('is_active', models.BooleanField(default=True)),
],
options={
'ordering': ['role', 'order', 'code'],
},
),
migrations.CreateModel(
name='Role',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(choices=[('px_admin', 'PX Admin'), ('hospital_admin', 'Hospital Admin'), ('department_manager', 'Department Manager'), ('px_coordinator', 'PX Coordinator'), ('physician', 'Physician'), ('nurse', 'Nurse'), ('staff', 'Staff'), ('viewer', 'Viewer')], max_length=50, unique=True)),
('display_name', models.CharField(max_length=100)),
('description', models.TextField(blank=True)),
('level', models.IntegerField(default=0, help_text='Higher number = higher authority')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'ordering': ['-level', 'name'],
},
),
migrations.CreateModel(
name='UserAcknowledgement',
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)),
('is_acknowledged', models.BooleanField(default=True)),
('acknowledged_at', models.DateTimeField(auto_now_add=True)),
('signature', models.TextField(blank=True, help_text='Digital signature data (base64 encoded)')),
('signature_ip', models.GenericIPAddressField(blank=True, help_text='IP address when signed', null=True)),
('signature_user_agent', models.TextField(blank=True, help_text='User agent when signed')),
('metadata', models.JSONField(blank=True, default=dict, help_text='Additional metadata')),
],
options={
'ordering': ['-acknowledged_at'],
},
),
migrations.CreateModel(
name='UserProvisionalLog',
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)),
('event_type', models.CharField(choices=[('created', 'User Created'), ('invitation_sent', 'Invitation Sent'), ('invitation_resent', 'Invitation Resent'), ('wizard_started', 'Wizard Started'), ('step_completed', 'Wizard Step Completed'), ('wizard_completed', 'Wizard Completed'), ('user_activated', 'User Activated'), ('invitation_expired', 'Invitation Expired')], db_index=True, max_length=50)),
('description', models.TextField()),
('ip_address', models.GenericIPAddressField(blank=True, null=True)),
('user_agent', models.TextField(blank=True)),
('metadata', models.JSONField(blank=True, default=dict, help_text='Additional event data')),
],
options={
'ordering': ['-created_at'],
},
),
]