initial commit
This commit is contained in:
257
core/apps/companies/migrations/0001_initial.py
Normal file
257
core/apps/companies/migrations/0001_initial.py
Normal file
@@ -0,0 +1,257 @@
|
||||
# Generated by Django 5.2.4 on 2025-08-01 09:53
|
||||
|
||||
import django.core.validators
|
||||
import django.db.models.deletion
|
||||
import uuid
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
("banks", "0001_initial"),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="CompanyModel",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.UUIDField(
|
||||
default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name="ID"
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True, verbose_name="Created At")),
|
||||
("updated_at", models.DateTimeField(auto_now=True, verbose_name="Updated At")),
|
||||
(
|
||||
"name",
|
||||
models.CharField(
|
||||
max_length=512,
|
||||
validators=[
|
||||
django.core.validators.RegexValidator(
|
||||
message="Company name contains invalid characters.",
|
||||
regex="^[A-Za-z0-9\\s\\.\\-\\,\\&]+$",
|
||||
),
|
||||
django.core.validators.MinLengthValidator(3),
|
||||
],
|
||||
verbose_name="name",
|
||||
),
|
||||
),
|
||||
(
|
||||
"pinfl_code",
|
||||
models.CharField(
|
||||
blank=True,
|
||||
null=True,
|
||||
validators=[
|
||||
django.core.validators.RegexValidator(
|
||||
message="PINFL code must be exactly 14 digits.", regex="^\\d{14}$"
|
||||
)
|
||||
],
|
||||
verbose_name="PINFL code",
|
||||
),
|
||||
),
|
||||
(
|
||||
"iin_code",
|
||||
models.CharField(
|
||||
blank=True,
|
||||
null=True,
|
||||
validators=[
|
||||
django.core.validators.RegexValidator(
|
||||
message="IIN code must be exactly 14 digits.", regex="^\\d{14}$"
|
||||
)
|
||||
],
|
||||
verbose_name="IIN code",
|
||||
),
|
||||
),
|
||||
(
|
||||
"phone",
|
||||
models.CharField(
|
||||
max_length=25,
|
||||
unique=True,
|
||||
validators=[
|
||||
django.core.validators.RegexValidator(
|
||||
message="Enter a valid international phone number (E.164 format, e.g., +14155552671).",
|
||||
regex="^\\+?[1-9]\\d{1,14}$",
|
||||
)
|
||||
],
|
||||
verbose_name="Phone Number",
|
||||
),
|
||||
),
|
||||
(
|
||||
"email",
|
||||
models.CharField(
|
||||
max_length=255,
|
||||
unique=True,
|
||||
validators=[django.core.validators.EmailValidator()],
|
||||
verbose_name="Email Address",
|
||||
),
|
||||
),
|
||||
(
|
||||
"iik_code",
|
||||
models.CharField(
|
||||
blank=True,
|
||||
max_length=30,
|
||||
null=True,
|
||||
validators=[
|
||||
django.core.validators.RegexValidator(
|
||||
message="IIK code must be alphanumeric and between 10 and 30 characters.",
|
||||
regex="^[A-Z0-9]{10,30}$",
|
||||
)
|
||||
],
|
||||
verbose_name="IIK code",
|
||||
),
|
||||
),
|
||||
(
|
||||
"legal_address",
|
||||
models.CharField(
|
||||
blank=True,
|
||||
max_length=512,
|
||||
null=True,
|
||||
validators=[django.core.validators.MinLengthValidator(10)],
|
||||
verbose_name="Legal Address",
|
||||
),
|
||||
),
|
||||
(
|
||||
"real_address",
|
||||
models.CharField(
|
||||
blank=True,
|
||||
max_length=512,
|
||||
null=True,
|
||||
validators=[django.core.validators.MinLengthValidator(10)],
|
||||
verbose_name="Real Address",
|
||||
),
|
||||
),
|
||||
("logo", models.ImageField(upload_to="", verbose_name="Logo")),
|
||||
(
|
||||
"signature_authority_document",
|
||||
models.FileField(upload_to="", verbose_name="Signature Authority Document"),
|
||||
),
|
||||
(
|
||||
"bank",
|
||||
models.ForeignKey(
|
||||
blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to="banks.bankmodel"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Company",
|
||||
"verbose_name_plural": "Companies",
|
||||
"db_table": "companies",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="CompanyFolderModel",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.UUIDField(
|
||||
default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name="ID"
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True, verbose_name="Created At")),
|
||||
("updated_at", models.DateTimeField(auto_now=True, verbose_name="Updated At")),
|
||||
(
|
||||
"name",
|
||||
models.CharField(
|
||||
max_length=150,
|
||||
validators=[
|
||||
django.core.validators.MaxLengthValidator(150),
|
||||
django.core.validators.MinLengthValidator(3),
|
||||
],
|
||||
verbose_name="name",
|
||||
),
|
||||
),
|
||||
(
|
||||
"company",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.PROTECT, related_name="folders", to="companies.companymodel"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Company Folder",
|
||||
"verbose_name_plural": "Company Folders",
|
||||
"db_table": "company_folders",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="CompanyAccountModel",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.UUIDField(
|
||||
default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name="ID"
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True, verbose_name="Created At")),
|
||||
("updated_at", models.DateTimeField(auto_now=True, verbose_name="Updated At")),
|
||||
("role", models.CharField(blank=True, max_length=255, null=True, verbose_name="Role")),
|
||||
(
|
||||
"user",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="companies",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
verbose_name="User",
|
||||
),
|
||||
),
|
||||
(
|
||||
"company",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="accounts",
|
||||
to="companies.companymodel",
|
||||
verbose_name="Company",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Company Account",
|
||||
"verbose_name_plural": "Company Accounts",
|
||||
"db_table": "company_accounts",
|
||||
},
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name="companymodel",
|
||||
index=models.Index(fields=["phone"], name="companies_phone_inx"),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name="companymodel",
|
||||
index=models.Index(fields=["email"], name="companies_email_inx"),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name="companymodel",
|
||||
index=models.Index(fields=["iin_code"], name="companies_iin_code_inx"),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name="companymodel",
|
||||
index=models.Index(fields=["pinfl_code"], name="companies_pinfl_code_inx"),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name="companymodel",
|
||||
index=models.Index(fields=["name"], name="companies_name_inx"),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="companyfoldermodel",
|
||||
constraint=models.UniqueConstraint(
|
||||
fields=("name", "company"), name="company_folders_name_company_unique_constraint"
|
||||
),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name="companyaccountmodel",
|
||||
index=models.Index(fields=["user"], name="company_accounts_user_inx"),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name="companyaccountmodel",
|
||||
index=models.Index(fields=["company"], name="company_accounts_company_inx"),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name="companyaccountmodel",
|
||||
unique_together={("user", "company")},
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.2.4 on 2025-08-01 10:30
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("companies", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="companymodel",
|
||||
name="logo",
|
||||
field=models.ImageField(blank=True, null=True, upload_to="", verbose_name="Logo"),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="companymodel",
|
||||
name="signature_authority_document",
|
||||
field=models.FileField(blank=True, null=True, upload_to="", verbose_name="Signature Authority Document"),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 5.2.4 on 2025-08-01 12:18
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("companies", "0002_alter_companymodel_logo_and_more"),
|
||||
("contracts", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="companyfoldermodel",
|
||||
name="contracts",
|
||||
field=models.ManyToManyField(
|
||||
related_name="folders", to="contracts.contractmodel", verbose_name="Contracts"
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.2.4 on 2025-08-04 09:44
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("companies", "0003_companyfoldermodel_contracts"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="companymodel",
|
||||
name="logo",
|
||||
field=models.ImageField(blank=True, max_length=1024, null=True, upload_to="", verbose_name="Logo"),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="companymodel",
|
||||
name="signature_authority_document",
|
||||
field=models.FileField(
|
||||
blank=True, max_length=1024, null=True, upload_to="", verbose_name="Signature Authority Document"
|
||||
),
|
||||
),
|
||||
]
|
||||
0
core/apps/companies/migrations/__init__.py
Normal file
0
core/apps/companies/migrations/__init__.py
Normal file
Reference in New Issue
Block a user