mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-06-28 05:26:07 +00:00
Initial commit
This commit is contained in:
84
devices/migrations/0001_initial.py
Normal file
84
devices/migrations/0001_initial.py
Normal file
@ -0,0 +1,84 @@
|
||||
# Generated by Django 5.1.2 on 2025-01-20 04:51
|
||||
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="BillFormula",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.CharField(max_length=255, primary_key=True, serialize=False),
|
||||
),
|
||||
("formula", models.CharField(max_length=255)),
|
||||
("base_amount", models.FloatField()),
|
||||
("discount_percentage", models.FloatField()),
|
||||
("created_at", models.DateTimeField(default=django.utils.timezone.now)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Payment",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.CharField(max_length=255, primary_key=True, serialize=False),
|
||||
),
|
||||
("number_of_months", models.IntegerField()),
|
||||
("amount", models.FloatField()),
|
||||
("paid", models.BooleanField(default=False)),
|
||||
("paid_at", models.DateTimeField(blank=True, null=True)),
|
||||
(
|
||||
"method",
|
||||
models.CharField(
|
||||
choices=[("WALLET", "Wallet"), ("TRANSFER", "Transfer")],
|
||||
default="TRANSFER",
|
||||
max_length=255,
|
||||
),
|
||||
),
|
||||
("expires_at", models.DateTimeField(blank=True, null=True)),
|
||||
("created_at", models.DateTimeField(default=django.utils.timezone.now)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
(
|
||||
"user",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="payments",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Topup",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.CharField(max_length=255, primary_key=True, serialize=False),
|
||||
),
|
||||
("amount", models.FloatField()),
|
||||
("paid", models.BooleanField(default=False)),
|
||||
("created_at", models.DateTimeField(default=django.utils.timezone.now)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
(
|
||||
"user",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="topups",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
18
devices/migrations/0002_payment_devices.py
Normal file
18
devices/migrations/0002_payment_devices.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.2 on 2025-01-20 04:53
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("billing", "0001_initial"),
|
||||
("devices", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="payment",
|
||||
name="devices",
|
||||
field=models.ManyToManyField(related_name="payments", to="billing.device"),
|
||||
),
|
||||
]
|
@ -0,0 +1,68 @@
|
||||
# Generated by Django 5.1.2 on 2025-01-20 06:58
|
||||
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("devices", "0002_payment_devices"),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="Device",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.CharField(max_length=255, primary_key=True, serialize=False),
|
||||
),
|
||||
("name", models.CharField(max_length=255)),
|
||||
("mac", models.CharField(max_length=255)),
|
||||
(
|
||||
"reason_for_blocking",
|
||||
models.CharField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
("is_active", models.BooleanField(default=False)),
|
||||
("registered", models.BooleanField(default=False)),
|
||||
("blocked", models.BooleanField(default=False)),
|
||||
(
|
||||
"blocked_by",
|
||||
models.CharField(
|
||||
choices=[("ADMIN", "Admin"), ("PARENT", "Parent")],
|
||||
default="PARENT",
|
||||
max_length=255,
|
||||
),
|
||||
),
|
||||
("expiry_date", models.DateTimeField(blank=True, null=True)),
|
||||
("created_at", models.DateTimeField(default=django.utils.timezone.now)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
(
|
||||
"user",
|
||||
models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.SET_NULL,
|
||||
related_name="devices",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name="BillFormula",
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="topup",
|
||||
name="user",
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name="Payment",
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name="Topup",
|
||||
),
|
||||
]
|
19
devices/migrations/0004_alter_device_id.py
Normal file
19
devices/migrations/0004_alter_device_id.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Generated by Django 5.1.2 on 2025-01-20 07:36
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("devices", "0003_device_delete_billformula_remove_topup_user_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="device",
|
||||
name="id",
|
||||
field=models.BigAutoField(
|
||||
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
||||
),
|
||||
),
|
||||
]
|
0
devices/migrations/__init__.py
Normal file
0
devices/migrations/__init__.py
Normal file
Reference in New Issue
Block a user