first commit

This commit is contained in:
2026-01-18 11:29:19 +03:30
commit b42c80cf1c
354 changed files with 14705 additions and 0 deletions

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

3
authentication/admin.py Normal file
View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
authentication/apps.py Normal file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class AuthenticationConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'authentication'

View File

@@ -0,0 +1,73 @@
# Generated by Django 4.2.19 on 2025-02-26 08:14
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='UserProfile',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_date', models.DateTimeField(auto_now_add=True)),
('modify_date', models.DateTimeField(auto_now=True)),
('trash', models.BooleanField(default=False)),
('key', models.UUIDField(default=uuid.uuid4, null=True)),
('fullname', models.CharField(default='', max_length=150, null=True)),
('first_name', models.CharField(default='', max_length=200, null=True)),
('last_name', models.CharField(default='', max_length=200, null=True)),
('mobile', models.CharField(default='', max_length=11, null=True)),
('password', models.CharField(max_length=100, null=True)),
('base_order', models.BigIntegerField(null=True)),
('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_createdby', to=settings.AUTH_USER_MODEL)),
('modified_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_modifiedby', to=settings.AUTH_USER_MODEL)),
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='users', to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='Province',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('key', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
('create_date', models.DateTimeField(auto_now_add=True)),
('modify_date', models.DateTimeField(auto_now=True)),
('trash', models.BooleanField(default=False)),
('name', models.CharField(max_length=200, null=True)),
('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_createdby', to=settings.AUTH_USER_MODEL)),
('modified_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_modifiedby', to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='City',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('key', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
('create_date', models.DateTimeField(auto_now_add=True)),
('modify_date', models.DateTimeField(auto_now=True)),
('trash', models.BooleanField(default=False)),
('name', models.CharField(max_length=200, null=True)),
('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_createdby', to=settings.AUTH_USER_MODEL)),
('modified_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(class)s_modifiedby', to=settings.AUTH_USER_MODEL)),
('province', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='city_province', to='authentication.province')),
],
options={
'abstract': False,
},
),
]

View File

@@ -0,0 +1,33 @@
# Generated by Django 4.2.19 on 2025-08-09 08:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('authentication', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='city',
name='Lat',
field=models.FloatField(default=0),
),
migrations.AddField(
model_name='city',
name='Lng',
field=models.FloatField(default=0),
),
migrations.AddField(
model_name='province',
name='Lat',
field=models.FloatField(default=0),
),
migrations.AddField(
model_name='province',
name='Lng',
field=models.FloatField(default=0),
),
]

View File

@@ -0,0 +1,61 @@
# Generated by Django 3.2.13 on 2025-08-09 09:18
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('authentication', '0002_city_lat_city_lng_province_lat_province_lng'),
]
operations = [
migrations.RemoveField(
model_name='city',
name='create_date',
),
migrations.RemoveField(
model_name='city',
name='created_by',
),
migrations.RemoveField(
model_name='city',
name='key',
),
migrations.RemoveField(
model_name='city',
name='modified_by',
),
migrations.RemoveField(
model_name='city',
name='modify_date',
),
migrations.RemoveField(
model_name='city',
name='trash',
),
migrations.RemoveField(
model_name='province',
name='create_date',
),
migrations.RemoveField(
model_name='province',
name='created_by',
),
migrations.RemoveField(
model_name='province',
name='key',
),
migrations.RemoveField(
model_name='province',
name='modified_by',
),
migrations.RemoveField(
model_name='province',
name='modify_date',
),
migrations.RemoveField(
model_name='province',
name='trash',
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 3.2.13 on 2025-08-09 09:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('authentication', '0003_auto_20250809_1248'),
]
operations = [
migrations.AddField(
model_name='province',
name='tel_prefix',
field=models.CharField(max_length=200, null=True),
),
]

View File

67
authentication/models.py Normal file
View File

@@ -0,0 +1,67 @@
from django.db import models
from django.conf import settings
import uuid
from django.contrib.auth.models import User
class BaseModel(models.Model):
key = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
create_date = models.DateTimeField(auto_now_add=True)
modify_date = models.DateTimeField(auto_now=True)
created_by = models.ForeignKey(
settings.AUTH_USER_MODEL,
related_name="%(class)s_createdby",
on_delete=models.CASCADE,
null=True,
blank=True,
)
modified_by = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name="%(class)s_modifiedby",
null=True,
blank=True,
)
trash = models.BooleanField(default=False)
class Meta:
abstract = True
class Province(models.Model):
name = models.CharField(max_length=200, null=True)
tel_prefix = models.CharField(max_length=200, null=True)
Lat = models.FloatField(default=0)
Lng = models.FloatField(default=0)
def save(self, *args, **kwargs):
super(Province, self).save(*args, **kwargs)
class City(models.Model):
province = models.ForeignKey(
Province, on_delete=models.CASCADE, related_name="city_province", null=True
)
name = models.CharField(max_length=200, null=True)
Lat = models.FloatField(default=0)
Lng = models.FloatField(default=0)
def save(self, *args, **kwargs):
super(City, self).save(*args, **kwargs)
class UserProfile(BaseModel):
key = models.UUIDField(default=uuid.uuid4, editable=True, null=True)
user = models.ForeignKey(
User, on_delete=models.CASCADE, related_name="users", null=True
)
fullname = models.CharField(max_length=150, null=True, default="")
first_name = models.CharField(max_length=200, null=True, default="")
last_name = models.CharField(max_length=200, null=True, default="")
mobile = models.CharField(max_length=11, null=True, default="")
password = models.CharField(max_length=100, null=True)
base_order = models.BigIntegerField(null=True)
def save(self, *args, **kwargs):
self.fullname = self.first_name + " " + self.last_name
super(UserProfile, self).save(*args, **kwargs)

View File

@@ -0,0 +1,21 @@
from rest_framework import serializers
from authentication.models import UserProfile, Province, City
class ProvinceSerializer(serializers.ModelSerializer):
class Meta:
model = Province
fields = ['key', 'name']
class CitySerializer(serializers.ModelSerializer):
class Meta:
model = City
fields = ['key', 'name']
class UserProfileSerializer(serializers.ModelSerializer):
class Meta:
model = UserProfile
fields = '__all__'

3
authentication/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

25
authentication/urls.py Normal file
View File

@@ -0,0 +1,25 @@
from django.urls import include, path
from rest_framework.routers import DefaultRouter
from authentication import views as auth_views
router = DefaultRouter()
router.register(
r'province',
auth_views.ProvinceViewSet,
basename="province"
)
router.register(
r'city',
auth_views.CityViewSet,
basename="city"
)
router.register(
r'profile',
auth_views.UserProfileViewSet,
basename="profile"
)
urlpatterns = [
path('', include(router.urls))
]

23
authentication/views.py Normal file
View File

@@ -0,0 +1,23 @@
from rest_framework import viewsets
from rest_framework.permissions import AllowAny
from authentication.models import Province, City, UserProfile
from authentication.serializers import ProvinceSerializer, CitySerializer, UserProfileSerializer
class ProvinceViewSet(viewsets.ModelViewSet):
queryset = Province.objects.all()
serializer_class = ProvinceSerializer
permission_classes = [AllowAny]
class UserProfileViewSet(viewsets.ModelViewSet):
queryset = UserProfile.objects.all()
serializer_class = UserProfileSerializer
permission_classes = [AllowAny]
class CityViewSet(viewsets.ModelViewSet):
queryset = City.objects.all()
serializer_class = CitySerializer
permission_classes = [AllowAny]