269 lines
14 KiB
Python
Executable File
269 lines
14 KiB
Python
Executable File
from django.db import models
|
|
from django.contrib.auth.models import User
|
|
from datetime import datetime
|
|
import uuid
|
|
|
|
|
|
class CorporateMember(models.Model):
|
|
APPROVAL_CHOICES = [
|
|
('pending', 'Pending'),
|
|
('approved', 'Approved'),
|
|
('rejected', 'Rejected'),
|
|
]
|
|
|
|
is_approved = models.CharField(max_length=10, choices=APPROVAL_CHOICES, default='pending')
|
|
corporate_member_uuid = models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True)
|
|
joining_date = models.DateTimeField(default=datetime.now)
|
|
approve_date = models.DateTimeField(null=True, blank=True)
|
|
name = models.CharField(max_length=255)
|
|
address = models.TextField()
|
|
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
|
pin_code = models.CharField(max_length=10)
|
|
country = models.CharField(max_length=255)
|
|
state = models.CharField(max_length=255)
|
|
city = models.CharField(max_length=255)
|
|
contact_person_name = models.CharField(max_length=255)
|
|
contact_person_email = models.EmailField()
|
|
contact_person_support_email = models.EmailField()
|
|
contact_person_phone_number_country_code = models.CharField(max_length=30)
|
|
contact_person_phone_number = models.CharField(max_length=20)
|
|
contact_person_support_phone_number_country_code = models.CharField(max_length=30)
|
|
contact_person_support_phone_number = models.CharField(max_length=20)
|
|
kyc = models.FileField(upload_to='kyc/')
|
|
pending_payment = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
domain_name = models.CharField(max_length=255)
|
|
credit_limit = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
available_credit_points = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
used_credit_point = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
requested_credit_point = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
discount_percentage = models.DecimalField(max_digits=10, default=0, decimal_places=2) # Change to FloatField
|
|
reason = models.TextField(null=True, blank=True)
|
|
|
|
class CorporateUser(models.Model):
|
|
APPROVAL_CHOICES = [
|
|
('active', 'Active'),
|
|
('banned', 'Banned'),
|
|
]
|
|
|
|
is_approved = models.CharField(max_length=10, choices=APPROVAL_CHOICES, default='active')
|
|
corporate_user_uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
|
joining_date = models.DateTimeField(default=datetime.now)
|
|
approve_date = models.DateTimeField(null=True, blank=True)
|
|
name = models.CharField(max_length=255)
|
|
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
|
this_user_admin = models.ForeignKey(CorporateMember, on_delete=models.CASCADE)
|
|
contact_person_email = models.EmailField()
|
|
contact_person_phone_number_country_code = models.CharField(max_length=5)
|
|
contact_person_phone_number = models.CharField(max_length=20)
|
|
pending_payment = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
credit_limit = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
available_credit_points = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
used_credit_point = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
services_access_premise_pool = models.BooleanField(default=False)
|
|
services_access_script_builder = models.BooleanField(default=False)
|
|
services_access_narration = models.BooleanField(default=False)
|
|
services_access_conversion = models.BooleanField(default=False)
|
|
services_access_project_center = models.BooleanField(default=False)
|
|
services_access_viewers_lounge = models.BooleanField(default=False)
|
|
services_access_subtitle = models.BooleanField(default=False)
|
|
discount_percentage = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
|
|
|
|
class Transaction(models.Model):
|
|
TRANSACTION_CHOICES = [
|
|
('corporate_user', 'Corporate User'),
|
|
('corporate_member', 'Corporate Member'),
|
|
('institute', 'Institute'),
|
|
('student', 'Student'),
|
|
]
|
|
CORPORATE_SERVICE_CHOICES = [
|
|
('premise_pool', 'Premise Pool'),
|
|
('script_builder', 'Script Builder'),
|
|
('narration', 'Narration'),
|
|
('conversion', 'Conversion'),
|
|
('project_center', 'Project Center'),
|
|
('viewers_lounge', 'Viewers Lounge'),
|
|
('subtitle', 'Subtitle'),
|
|
]
|
|
TRANSACTION_STATUS = [
|
|
('pending', 'Pending'),
|
|
('paid', 'Paid'),
|
|
]
|
|
transaction_uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
|
user = models.ForeignKey(User, on_delete=models.CASCADE,related_name='user_id_s')
|
|
date = models.DateTimeField(default=datetime.now)
|
|
user_type = models.CharField(max_length=20, choices=TRANSACTION_CHOICES)
|
|
service_type = models.CharField(max_length=20, choices=CORPORATE_SERVICE_CHOICES)
|
|
service_id = models.CharField(max_length=200)
|
|
amount = models.DecimalField(max_digits=10, decimal_places=2)
|
|
status = models.CharField(max_length=8, choices=TRANSACTION_STATUS, default='pending')
|
|
|
|
|
|
class CreditRequest(models.Model):
|
|
REQUEST_CHOICES = [
|
|
('corporate_membership', 'Corporate Membership'),
|
|
|
|
]
|
|
credit_request_uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
|
ctype = models.CharField(max_length=20, choices=REQUEST_CHOICES)
|
|
date = models.DateTimeField(default=datetime.now)
|
|
request_from = models.ForeignKey(CorporateUser, on_delete=models.CASCADE, related_name='credit_requests_sent')
|
|
request_to = models.ForeignKey(CorporateMember, on_delete=models.CASCADE, related_name='credit_requests_received')
|
|
credits_requested = models.DecimalField(max_digits=10, decimal_places=2)
|
|
|
|
class CreditRequestFromMember(models.Model):
|
|
REQUEST_CHOICES = [
|
|
('corporate_membership', 'Corporate Membership'),
|
|
]
|
|
credit_request_uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
|
ctype = models.CharField(max_length=20, choices=REQUEST_CHOICES)
|
|
date = models.DateTimeField(default=datetime.now)
|
|
request_from = models.ForeignKey(CorporateMember, on_delete=models.CASCADE, related_name='credit_requests_member_received')
|
|
credits_requested = models.DecimalField(max_digits=10, decimal_places=2)
|
|
|
|
class Payment(models.Model):
|
|
user = models.ForeignKey(CorporateMember, on_delete=models.CASCADE)
|
|
amount = models.DecimalField(max_digits=10, decimal_places=2)
|
|
|
|
class Institute(models.Model):
|
|
APPROVAL_CHOICES = [
|
|
('pending', 'Pending'),
|
|
('approved', 'Approved'),
|
|
('rejected', 'Rejected'),
|
|
]
|
|
is_approved = models.CharField(max_length=10, choices=APPROVAL_CHOICES, default='pending')
|
|
institute_uuid = models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True)
|
|
joining_date = models.DateTimeField(default=datetime.now)
|
|
approve_date = models.DateTimeField(null=True, blank=True)
|
|
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
|
name = models.CharField(max_length=255)
|
|
institute_type = models.CharField(max_length=255)
|
|
institute_phone_number_country_code = models.CharField(max_length=30)
|
|
institute_phone_number = models.CharField(max_length=20)
|
|
institute_email = models.EmailField()
|
|
address = models.TextField()
|
|
pin_code = models.CharField(max_length=10)
|
|
country = models.CharField(max_length=255)
|
|
state = models.CharField(max_length=255)
|
|
city = models.CharField(max_length=255)
|
|
admin_name = models.CharField(max_length=255)
|
|
admin_email = models.EmailField()
|
|
admin_phone_number_country_code = models.CharField(max_length=30)
|
|
admin_phone_number = models.CharField(max_length=20)
|
|
requested_credit_point = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
kyc = models.FileField(upload_to='kyc/')
|
|
domain_name = models.CharField(max_length=255)
|
|
credit_limit = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
available_credit_points = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
used_credit_point = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
pending_payment = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
discount_percentage = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
reason = models.TextField(null=True, blank=True)
|
|
|
|
|
|
class AffiliatedStudent(models.Model):
|
|
APPROVAL_CHOICES = [
|
|
('pending', 'Pending'),
|
|
('approved', 'Approved'),
|
|
('rejected', 'Rejected'),
|
|
]
|
|
is_approved = models.CharField(max_length=10, choices=APPROVAL_CHOICES, default='pending')
|
|
affiliated_student_uuid = models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True)
|
|
joining_date = models.DateTimeField(default=datetime.now)
|
|
approve_date = models.DateTimeField(null=True, blank=True)
|
|
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
|
name = models.CharField(max_length=255)
|
|
email = models.EmailField()
|
|
student_institute_email = models.EmailField()
|
|
affiliated_student_phone_number_country_code = models.CharField(max_length=30)
|
|
affiliated_student_phone_number = models.CharField(max_length=20)
|
|
affiliated_student_alternate_phone_number_country_code = models.CharField(max_length=30, null=True, blank=True)
|
|
affiliated_student_alternate_phone_number = models.CharField(max_length=20, null=True, blank=True)
|
|
institute = models.ForeignKey(Institute, on_delete=models.CASCADE)
|
|
requested_credit_point = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
credit_limit = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
available_credit_points = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
used_credit_point = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
pending_payment = models.DecimalField(max_digits=10, default=0, decimal_places=2)
|
|
free_credits = models.DecimalField(max_digits=10, default=250, decimal_places=2)
|
|
kyc = models.FileField(upload_to='kyc/')
|
|
end_date = models.DateField()
|
|
reason = models.TextField(null=True, blank=True)
|
|
|
|
class UnaffiliatedStudent(models.Model):
|
|
APPROVAL_CHOICES = [
|
|
('pending', 'Pending'),
|
|
('approved', 'Approved'),
|
|
('rejected', 'Rejected'),
|
|
]
|
|
is_approved = models.CharField(max_length=10, choices=APPROVAL_CHOICES, default='pending')
|
|
unaffiliated_student_uuid = models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True)
|
|
joining_date = models.DateTimeField(default=datetime.now)
|
|
approve_date = models.DateTimeField(null=True, blank=True)
|
|
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
|
name = models.CharField(max_length=255)
|
|
email = models.EmailField()
|
|
student_institute_email = models.EmailField()
|
|
unaffiliated_student_phone_number_country_code = models.CharField(max_length=30)
|
|
unaffiliated_student_phone_number = models.CharField(max_length=20)
|
|
unaffiliated_student_alternate_phone_number_country_code = models.CharField(max_length=30, null=True, blank=True)
|
|
unaffiliated_student_alternate_phone_number = models.CharField(max_length=20, null=True, blank=True)
|
|
institute_name = models.CharField(max_length=255, null=True, blank=True)
|
|
institute_type = models.CharField(max_length=255, null=True, blank=True)
|
|
institute_address = models.TextField(null=True, blank=True)
|
|
institute_pin_code = models.CharField(max_length=10, null=True, blank=True)
|
|
institute_country = models.CharField(max_length=255, null=True, blank=True)
|
|
institute_state = models.CharField(max_length=255, null=True, blank=True)
|
|
institute_city = models.CharField(max_length=255, null=True, blank=True)
|
|
free_credits = models.DecimalField(max_digits=10, default=250, decimal_places=2)
|
|
kyc = models.FileField(upload_to='kyc/')
|
|
end_date = models.DateField()
|
|
reason = models.TextField(null=True, blank=True)
|
|
|
|
|
|
class WaitForInstituteStudent(models.Model):
|
|
APPROVAL_CHOICES = [
|
|
('pending', 'Pending'),
|
|
('approved', 'Approved'),
|
|
('rejected', 'Rejected'),
|
|
]
|
|
is_approved = models.CharField(max_length=10, choices=APPROVAL_CHOICES, default='pending')
|
|
wait_for_institute_student_uuid = models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True)
|
|
joining_date = models.DateTimeField(default=datetime.now)
|
|
approve_date = models.DateTimeField(null=True, blank=True)
|
|
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
|
name = models.CharField(max_length=255)
|
|
email = models.EmailField()
|
|
student_institute_email = models.EmailField()
|
|
wait_for_institute_student_phone_number_country_code = models.CharField(max_length=30)
|
|
wait_for_institute_student_phone_number = models.CharField(max_length=20)
|
|
wait_for_institute_student_a_phone_number_country_code = models.CharField(max_length=30, null=True, blank=True)
|
|
wait_for_institute_student_alternate_phone_number = models.CharField(max_length=20, null=True, blank=True)
|
|
free_credits = models.DecimalField(max_digits=10, default=250, decimal_places=2)
|
|
institute_email = models.EmailField()
|
|
kyc = models.FileField(upload_to='kyc/')
|
|
end_date = models.DateField()
|
|
reason = models.TextField(null=True, blank=True)
|
|
|
|
|
|
class CreditRequestStudent(models.Model):
|
|
REQUEST_CHOICES = [
|
|
('student_membership', 'Student Membership'),
|
|
|
|
]
|
|
credit_request_uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
|
ctype = models.CharField(max_length=20, choices=REQUEST_CHOICES)
|
|
date = models.DateTimeField(default=datetime.now)
|
|
request_from = models.ForeignKey(AffiliatedStudent, on_delete=models.CASCADE, related_name='credit_requests_student_sent')
|
|
request_to = models.ForeignKey(Institute, on_delete=models.CASCADE, related_name='credit_requests_student_received')
|
|
credits_requested = models.DecimalField(max_digits=10, decimal_places=2)
|
|
|
|
class CreditRequestInstitute(models.Model):
|
|
REQUEST_CHOICES = [
|
|
('institute_membership', 'Institute Membership'),
|
|
]
|
|
credit_request_uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
|
ctype = models.CharField(max_length=20, choices=REQUEST_CHOICES)
|
|
date = models.DateTimeField(default=datetime.now)
|
|
request_from = models.ForeignKey(Institute, on_delete=models.CASCADE, related_name='credit_requests_institute_received')
|
|
credits_requested = models.DecimalField(max_digits=10, decimal_places=2) |