mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-15 01:55:21 +00:00
143 lines
4.6 KiB
Python
143 lines
4.6 KiB
Python
"""Account module file"""
|
|
"""Django import"""
|
|
from django.db import models
|
|
from django.contrib.auth.models import User
|
|
"""App import"""
|
|
from base.constants import USER_TYPE
|
|
# Create your models here.
|
|
|
|
class UserProfile(models.Model):
|
|
"""
|
|
User details
|
|
"""
|
|
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='user_profile')
|
|
user_type = models.CharField(max_length=15, choices=USER_TYPE, null=True, blank=True, default=None)
|
|
is_verified = models.BooleanField(default=False)
|
|
|
|
# OTP validity
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
is_active = models.BooleanField(default=False)
|
|
|
|
class Meta(object):
|
|
""" Meta information """
|
|
db_table = 'user_profile'
|
|
|
|
def __str__(self):
|
|
"""return phone as an object"""
|
|
return f'{self.user}'
|
|
|
|
class UserPhoneOtp(models.Model):
|
|
"""
|
|
This class is used to verify user email and their contact no.
|
|
"""
|
|
"""user details"""
|
|
country_code = models.IntegerField()
|
|
phone = models.CharField(max_length=17)
|
|
"""otp details"""
|
|
otp = models.CharField(max_length=10)
|
|
is_verified = models.BooleanField(default=False)
|
|
|
|
# OTP validity
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
expired_at = models.DateTimeField(blank=True, null=True)
|
|
is_active = models.BooleanField(default=True)
|
|
|
|
class Meta(object):
|
|
""" Meta information """
|
|
db_table = 'user_phone_otp'
|
|
|
|
def __str__(self):
|
|
"""return phone as an object"""
|
|
return self.phone
|
|
|
|
class UserEmailOtp(models.Model):
|
|
"""
|
|
This class is used to verify user email and their contact no.
|
|
"""
|
|
"""user details"""
|
|
email = models.EmailField()
|
|
"""otp details"""
|
|
otp = models.CharField(max_length=10)
|
|
is_verified = models.BooleanField(default=False)
|
|
user_type = models.CharField(max_length=15, choices=USER_TYPE, null=True, blank=True, default=None)
|
|
|
|
# OTP validity
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
expired_at = models.DateTimeField(blank=True, null=True)
|
|
is_active = models.BooleanField(default=True)
|
|
|
|
class Meta(object):
|
|
""" Meta information """
|
|
db_table = 'user_email_otp'
|
|
verbose_name = 'User Email OTP'
|
|
verbose_name_plural = 'User Email OTP'
|
|
|
|
def __str__(self):
|
|
"""return phone as an object"""
|
|
return self.email
|
|
|
|
class DefaultTaskImages(models.Model):
|
|
"""Default images upload in oss bucket"""
|
|
|
|
task_name = models.CharField(max_length=15)
|
|
image_url = models.URLField(null=True, blank=True, default=None)
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
|
|
class Meta(object):
|
|
""" Meta information """
|
|
db_table = 'default_task_image'
|
|
|
|
def __str__(self):
|
|
"""return phone as an object"""
|
|
return self.task_name
|
|
|
|
class UserDelete(models.Model):
|
|
"""
|
|
User delete information
|
|
"""
|
|
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='delete_information_set')
|
|
"""Old email"""
|
|
old_email = models.EmailField(blank=True, null=True, verbose_name='Original Email')
|
|
"""Dummy email"""
|
|
d_email = models.EmailField(blank=True, null=True, verbose_name='Dummy Email')
|
|
is_active = models.BooleanField(default=True)
|
|
"""reason for leaving"""
|
|
reason = models.TextField(max_length=500, blank=True, null=True, verbose_name='Reason for Leaving')
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
|
|
class Meta(object):
|
|
""" Meta information """
|
|
db_table = 'user_delete_information'
|
|
|
|
def __str__(self):
|
|
return self.user.email
|
|
|
|
|
|
class UserNotification(models.Model):
|
|
"""
|
|
User notification details
|
|
"""
|
|
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='user_notification')
|
|
"""Push Notification"""
|
|
push_notification = models.BooleanField(default=True)
|
|
"""Email Notification"""
|
|
email_notification = models.BooleanField(default=True)
|
|
"""SMS Notification"""
|
|
sms_notification = models.BooleanField(default=True)
|
|
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
|
|
class Meta(object):
|
|
""" Meta information """
|
|
db_table = 'user_notification'
|
|
verbose_name = 'User Notification'
|
|
verbose_name_plural = 'User Notification'
|
|
|
|
def __str__(self):
|
|
return self.user.email
|