From 36dff3d99a5f0edb94c60600c7e94113db988586 Mon Sep 17 00:00:00 2001 From: magmaus3 Date: Fri, 18 Nov 2022 17:51:24 +0100 Subject: [PATCH] Init --- Dockerfile | 9 + README.rst | 0 customiwmserver/__init__.py | 1 + customiwmserver/__main__.py | 3 + customiwmserver/data_types.py | 281 +++++++++++++++++++ customiwmserver/database.py | 43 +++ customiwmserver/main.py | 411 ++++++++++++++++++++++++++++ docker-compose.yml | 32 +++ poetry.lock | 489 ++++++++++++++++++++++++++++++++++ pyproject.toml | 22 ++ tests/__init__.py | 0 tests/test_customiwmserver.py | 5 + 12 files changed, 1296 insertions(+) create mode 100644 Dockerfile create mode 100644 README.rst create mode 100644 customiwmserver/__init__.py create mode 100644 customiwmserver/__main__.py create mode 100644 customiwmserver/data_types.py create mode 100644 customiwmserver/database.py create mode 100644 customiwmserver/main.py create mode 100644 docker-compose.yml create mode 100644 poetry.lock create mode 100644 pyproject.toml create mode 100644 tests/__init__.py create mode 100644 tests/test_customiwmserver.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..55129b1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.11 + +WORKDIR /app + +COPY . . + +RUN pip install . + +CMD python3 -m customiwmserver diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..e69de29 diff --git a/customiwmserver/__init__.py b/customiwmserver/__init__.py new file mode 100644 index 0000000..3dc1f76 --- /dev/null +++ b/customiwmserver/__init__.py @@ -0,0 +1 @@ +__version__ = "0.1.0" diff --git a/customiwmserver/__main__.py b/customiwmserver/__main__.py new file mode 100644 index 0000000..471086d --- /dev/null +++ b/customiwmserver/__main__.py @@ -0,0 +1,3 @@ +import uvicorn +if __name__ == "__main__": + uvicorn.run("customiwmserver.main:app", host="0.0.0.0", port=8001, reload=True) diff --git a/customiwmserver/data_types.py b/customiwmserver/data_types.py new file mode 100644 index 0000000..c290bd4 --- /dev/null +++ b/customiwmserver/data_types.py @@ -0,0 +1,281 @@ +from pydantic import BaseModel +from typing import List, Optional, Union + + +class User(BaseModel): + """Pydantic model for user data. + Created from the user response (`/api/v1/user/x`), + some values might be unused.""" + + Admin: bool = True + Banned: bool = False + BulletSpr: int = 0 + CapeColor: int = 0 + Costume: int = 0 + Country: int = 0 + CreatedAt: str = "2020-02-14T10:03:40Z" + DeathEffect: int = 0 + DeletedAt: Optional[str] = None + FacialExpression: int = 0 + Followed: bool = False + FollowerColor: int = 0 + FollowerSpr: int = 0 + GunSpr: int = 0 + HairColor: int = 0 + HairSpr: int = 0 + HatColor: int = 0 + HatColorInv: int = 0 + HatSpr: int = 0 + ID: int = 0 + NumMapsClear: int = 0 + NumMapsCreated: int = 0 + NumSpeedrunRecords: int = 0 + PantsColor: int = 0 + RecordEndurance0: int = 0 + RecordEndurance1: int = 0 + RecordEndurance2: int = 0 + RecordEndurance3: int = 0 + RecordExplorer: int = 0 + RecordHardcore: int = 0 + RecordRoulette: int = 0 + RecordScribble0: int = 0 + RecordScribble1: int = 0 + RecordScribble2: int = 0 + RecordScribble3: int = 0 + SaveEffect: int = 0 + ShirtColor: int = 0 + ShoesColor: int = 0 + SkinColor: int = 0 + SwordSpr: int = 0 + TextSnd: int = 0 + Unlocks: str = "" + UpdatedAt: str = "2020-03-26T05:22:32Z" + Username: str = "magmaus3" + Email: str = "user@example.com" + + +class Notification(BaseModel): + """Pydantic model for Notifications + + Available notification types: + - 0: took your record on with time