From ff969d298d9255994a23e5fe2bbbd214f1239a1f Mon Sep 17 00:00:00 2001 From: Alexander-D-Karpov Date: Sat, 4 Jun 2022 16:01:23 +0300 Subject: [PATCH] Initial commit, added base User and Hero models --- .idea/.gitignore | 8 ++ .idea/chess_backend.iml | 30 +++++ .idea/discord.xml | 7 + .idea/inspectionProfiles/Project_Default.xml | 63 +++++++++ .../inspectionProfiles/profiles_settings.xml | 6 + .idea/misc.xml | 4 + .idea/modules.xml | 8 ++ chess_backend/__init__.py | 0 .../__pycache__/__init__.cpython-310.pyc | Bin 0 -> 155 bytes .../__pycache__/settings.cpython-310.pyc | Bin 0 -> 2322 bytes .../__pycache__/urls.cpython-310.pyc | Bin 0 -> 938 bytes chess_backend/asgi.py | 16 +++ chess_backend/settings.py | 125 ++++++++++++++++++ chess_backend/urls.py | 21 +++ chess_backend/wsgi.py | 16 +++ db.sqlite3 | Bin 0 -> 131072 bytes game/__init__.py | 0 game/__pycache__/__init__.cpython-310.pyc | Bin 0 -> 146 bytes game/__pycache__/admin.cpython-310.pyc | Bin 0 -> 187 bytes game/__pycache__/apps.cpython-310.pyc | Bin 0 -> 421 bytes game/__pycache__/models.cpython-310.pyc | Bin 0 -> 184 bytes game/admin.py | 3 + game/apps.py | 6 + game/migrations/__init__.py | 0 .../__pycache__/__init__.cpython-310.pyc | Bin 0 -> 157 bytes game/models.py | 57 ++++++++ game/tests.py | 3 + game/views.py | 3 + manage.py | 22 +++ 29 files changed, 398 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/chess_backend.iml create mode 100644 .idea/discord.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 chess_backend/__init__.py create mode 100644 chess_backend/__pycache__/__init__.cpython-310.pyc create mode 100644 chess_backend/__pycache__/settings.cpython-310.pyc create mode 100644 chess_backend/__pycache__/urls.cpython-310.pyc create mode 100644 chess_backend/asgi.py create mode 100644 chess_backend/settings.py create mode 100644 chess_backend/urls.py create mode 100644 chess_backend/wsgi.py create mode 100644 db.sqlite3 create mode 100644 game/__init__.py create mode 100644 game/__pycache__/__init__.cpython-310.pyc create mode 100644 game/__pycache__/admin.cpython-310.pyc create mode 100644 game/__pycache__/apps.cpython-310.pyc create mode 100644 game/__pycache__/models.cpython-310.pyc create mode 100644 game/admin.py create mode 100644 game/apps.py create mode 100644 game/migrations/__init__.py create mode 100644 game/migrations/__pycache__/__init__.cpython-310.pyc create mode 100644 game/models.py create mode 100644 game/tests.py create mode 100644 game/views.py create mode 100755 manage.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/chess_backend.iml b/.idea/chess_backend.iml new file mode 100644 index 0000000..6714126 --- /dev/null +++ b/.idea/chess_backend.iml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000..d8e9561 --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..736b465 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,63 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..8993317 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..8b93af3 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/chess_backend/__init__.py b/chess_backend/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/chess_backend/__pycache__/__init__.cpython-310.pyc b/chess_backend/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f3e0adec098de7ebc9ab2eb3b71b1c386c2821d4 GIT binary patch literal 155 zcmd1j<>g`kf=Y*3Ng(<$h(HF6K#l_t7qb9~6oz01O-8?!3`HPe1o6vGKO;XkRlhhf zuecyHRX?C8KPxr4q*y;WBel3VJ}EIdJ2fu_jTaxEnU`4-AFo$Xd5gm)H$SB`C)EyQ LZZQ*(U||3N=%yrU literal 0 HcmV?d00001 diff --git a/chess_backend/__pycache__/settings.cpython-310.pyc b/chess_backend/__pycache__/settings.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6f4c0280478356c5943fe77f252f67a862345838 GIT binary patch literal 2322 zcmb7FTXWk)6qXeE5;tzsq&FHadMS-5ktxme!q5=KRuWU+CXyS_0~%Sowl~qO+I7?D zm7hT$pl{6Z8~7DG>6It`01q%jIg;(fbuvSct<~|hUv7Q;yD9!qyoYPn`1mv|CoR>;Ph zccmc(ENKkAE`KIJ0PAf)cKr}b!~-X;#fa}o@Mi-8Zi$0Gg(z@gz*s=PD3_6MQ+ecL z5`pczW$cv!u+02`*t9$eyF7wt11$B1jw3mQGRg0qF3W<2fRu#NOUoHz`hR?dxHskK z57=m~#K&UWVuNUF%mVQ!wud2JyJJ44$M>H+JX#+_{*&+Q;K}M{_>|nU+`;;zaNT{? z8@w=A{lkx++N+y)x&!x6FXf_ZBN*BCJrZ0IyjWYPL8 zynQ*ial)95U6o(2+YI(@8MqJ`pNtHYwY4~BZaZ#iO@rXNg>)7kF z!KwXM7quT%PkS8WDZu7M0h&V>hr~XMkip*CkQ#Fxy%Oc%0)Q$iM<0w~fl1d#*rDh;#XS~YiDny$r{YfVjuDVTsH(c(g*R;||6ePvIL z7xr2$-R$huE3M{sJg=*bc3sg`EneK$c4~=!y;f0@e2V9*imoJXwfL6O(RaGB_0r~2u6cOj2HaGR*hxG9Wcl$bi>&vlcGzdkx-f;F4szn4g%E` zBZeWvSQa4|rM0!mFs7<7DcuseQMFcER@k&q0yBx9q^H=bnimGUWDMmEj$V8w0mD{lnwm5GW`FAp{^t?giX38E@7n28p=eXF TGaulLdzhg&doc57qv@Z&B@-m0 literal 0 HcmV?d00001 diff --git a/chess_backend/asgi.py b/chess_backend/asgi.py new file mode 100644 index 0000000..a4c59e0 --- /dev/null +++ b/chess_backend/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for chess_backend project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'chess_backend.settings') + +application = get_asgi_application() diff --git a/chess_backend/settings.py b/chess_backend/settings.py new file mode 100644 index 0000000..aad56f8 --- /dev/null +++ b/chess_backend/settings.py @@ -0,0 +1,125 @@ +""" +Django settings for chess_backend project. + +Generated by 'django-admin startproject' using Django 4.0.3. + +For more information on this file, see +https://docs.djangoproject.com/en/4.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/4.0/ref/settings/ +""" + +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-%_8sy196w4hzo9^cp9(@r=i+amh47r4mxfhq_(ok&=c(@%bhmk' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + "game" +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'chess_backend.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [BASE_DIR / 'templates'] + , + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'chess_backend.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/4.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/4.0/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/4.0/howto/static-files/ + +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/chess_backend/urls.py b/chess_backend/urls.py new file mode 100644 index 0000000..11b17bb --- /dev/null +++ b/chess_backend/urls.py @@ -0,0 +1,21 @@ +"""chess_backend URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/4.0/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path + +urlpatterns = [ + path('admin/', admin.site.urls), +] diff --git a/chess_backend/wsgi.py b/chess_backend/wsgi.py new file mode 100644 index 0000000..f8b1f1e --- /dev/null +++ b/chess_backend/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for chess_backend project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'chess_backend.settings') + +application = get_wsgi_application() diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..3f428ae99ad9ea6a448b97fa8c4275ce7fdc6bee GIT binary patch literal 131072 zcmeI5dyFH=UB}&a+n$H*n&#I4Jc8h_1EeGf1o;CZ zQB_^-Znt|pzD-WL9esVeURTwxe*LXaJ-X|m@zvKZ867>o+icafPCV}2j@r=bx?0!n zsWrW^*SYEGDVNR_i!V%3PZumtY4u>gs&#aAzty~VU)|SRb;H!<=^;}pa>ty)#}R;$@k>$K{$J-zLPsJM|WWOAF6)Y-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A`xkEHh<7?U<+Jpl|$anv11B)JlKgxpluMl}5yQ z%((!yTFncgPCFsfw)AsLA<}6nB=#&5617}eX9AsOOkU3h=l@*;7J?uE0w4eaAOHd& u00JNY0w4eaAaDW+VE%ssD-}fo0T2KI5C8!X009sH0T2KI5C8!ef&T|ug`kg3YY6lR)%i5P=LBfgA@QE@lA|DGb33nv8xc8Hzx{2;!Hienx(7s(x`| zUU5NYs(wIGepYI7NwI!%Mrv_!d{Sa^c4}UVetIHMO?-T2US>&ryk0@&Ee@O9{FKt1 OR6CGy#Y{kgg#iGBI3T_N literal 0 HcmV?d00001 diff --git a/game/__pycache__/admin.cpython-310.pyc b/game/__pycache__/admin.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ab1feefffbfd6686ca2948200acadb8949f819b8 GIT binary patch literal 187 zcmd1j<>g`kg3YY6lk9=?V-N=!FabFZKwK;UBvKes7;_kM8KW2(8B&;n88n$+0!0}# z8E>&BrsQVk`Drpm@ug%X=B4NBCFkdr6lEqAfecv5P{a(Rz{D>j{fzwFRQ=+_yyAk) zRQ-UW{H)aEl4AYjjMU=d_@u<-?9{vz{q#hj8nB^y1(mlrY;yBcN^?@}7=gwVgNzhl F002>7EEE6$ literal 0 HcmV?d00001 diff --git a/game/__pycache__/apps.cpython-310.pyc b/game/__pycache__/apps.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4d2e8aff70a670a1c12edf554d85a10882949709 GIT binary patch literal 421 zcmYjNy-ve05I)BV3jJA7S0vUfiP#ZpL84oQ#FoW!a&DTE#3615SYhN1cmihL#w!!A zz{I(!L{IYP`}w{*`}A}=066@eBQlvkss|MLcKOgS4~4G+I|OERwE1ZMmXpm=4p literal 0 HcmV?d00001 diff --git a/game/__pycache__/models.cpython-310.pyc b/game/__pycache__/models.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9cac6a57429c4f626552da64534cef4df7a50785 GIT binary patch literal 184 zcmd1j<>g`kg3YY6lPrPsV-N=!FabFZKwK;UBvKes7;_kM8KW2(8B&;n88n$+0!0}# z8E>)W=BK3Q6#Hp1-QrBiO3X{o*Gow%0%=~!P{abHz{D?O{fzwFRQ=+_yyAk)RQ-UW z{H)aEl4AYjjMU=d_@u<-?9{vz{q#hj8i;{<1(mlrY=G?2oK!nTpgF}LGX)p`*a9n9 literal 0 HcmV?d00001 diff --git a/game/admin.py b/game/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/game/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/game/apps.py b/game/apps.py new file mode 100644 index 0000000..8ad49cb --- /dev/null +++ b/game/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class GameConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'game' diff --git a/game/migrations/__init__.py b/game/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/game/migrations/__pycache__/__init__.cpython-310.pyc b/game/migrations/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..374cda57e94a4c81749cfcdef5aa8c3d90f74d37 GIT binary patch literal 157 zcmd1j<>g`kg3YY6lR)%i5P=LBfgA@QE@lA|DGb33nv8xc8Hzx{2;!H6enx(7s(x`| zUU5NYs(wIGepYI7NwI!%Mrv_!d{Sa^c4}UVetIHMO>Sm-QDRAEeqOPDe0*kJW=VX! ZUP0w84x8Nkl+v73JCMo6OhAH#0RTEMB{cv5 literal 0 HcmV?d00001 diff --git a/game/models.py b/game/models.py new file mode 100644 index 0000000..7f97516 --- /dev/null +++ b/game/models.py @@ -0,0 +1,57 @@ +import uuid + +from django.core.validators import MinValueValidator, MaxValueValidator +from django.db import models + +HER0_TYPES = [("WIZARD", "wizard"), ("ARCHER", "archer"), ("WARRIOR", "warrior")] + + +class Player(models.Model): + """base model to handle and store users""" + + # TODO: connect real TON wallet + ton_wallet = models.CharField(max_length=50, verbose_name="TON wallet") + name = models.CharField(max_length=100, blank=True) + added = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return self.name + + class Meta: + indexes = [models.Index(fields=["ton_wallet"])] + ordering = ["-added"] + verbose_name = "player" + verbose_name_plural = "players" + + +class Hero(models.Model): + """Model to store heroes and their stats, connected to player""" + + uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True) + player = models.ForeignKey( + Player, + on_delete=models.CASCADE, + related_name="heroes", + related_query_name="hero", + ) + added = models.DateTimeField(auto_now_add=True) + + type = models.CharField(blank=False, choices=HER0_TYPES, max_length=1) + idle_img = models.ImageField(upload_to="uploads/idle", blank=False) + attack_img = models.ImageField(upload_to="uploads/attack", blank=False) + die_img = models.ImageField(upload_to="uploads/die", blank=False) + health = models.IntegerField( + validators=[MinValueValidator(0), MaxValueValidator(10)], blank=False + ) + speed = models.IntegerField( + validators=[MinValueValidator(0), MaxValueValidator(10)], blank=False + ) + + def __str__(self): + return f"{self.type} {self.player.name}" + + class Meta: + indexes = [models.Index(fields=["uuid"])] + ordering = ["-added"] + verbose_name = "hero" + verbose_name_plural = "heroes" diff --git a/game/tests.py b/game/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/game/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/game/views.py b/game/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/game/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..9d7d2e2 --- /dev/null +++ b/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'chess_backend.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main()