-## Setup:
+## RegexRace
+Регулярки в языках программирования это очень мощный инструмент,
+но к сожалению у многих он хромает.
+
+**RegexRace** имеет 2 режима:
+1) Обучающий режим. Блок с теорией позволяющий подятнуть базу по регуляркам
+
+
+2) Рейтинговый режим - позволяет пользователям соревноваться в написании регулярок на перегонки.
+
+
+# Setup:
- `git clone https://github.com/codequest-team/codequest.git`
- `cd codequest`
-- In the root of the project create `.env` file (and substitute your values if necessary):
+- copy .envs and substitute your values if necessary:
+ ```bash
+ cp -r .envs_example .envs
+ ```
+- generate docker-compose with `docker-compose.sh` (param `dev` for local lauch)
+ ```bash
+ ./docker-compose.sh dev
+ ```
+ or
+ ```bash
+ ./docker-compose.sh prod
```
- echo 'JWT_SECRET_KEY="e7c83a28f8b8d597afedf2134979ed8ae9f472d1"' > .env
+- run project
+ ```bash
+ docker-compose up --build
```
-- `docker-compose up --build`
diff --git a/auth-ms/poetry.lock b/auth-ms/poetry.lock
index 7bc220f..da30696 100644
--- a/auth-ms/poetry.lock
+++ b/auth-ms/poetry.lock
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand.
+# This file is automatically @generated by Poetry 1.4.1 and should not be changed by hand.
[[package]]
name = "alembic"
@@ -241,6 +241,27 @@ files = [
docs = ["Sphinx", "docutils (<0.18)"]
test = ["objgraph", "psutil"]
+[[package]]
+name = "gunicorn"
+version = "20.1.0"
+description = "WSGI HTTP Server for UNIX"
+category = "main"
+optional = false
+python-versions = ">=3.5"
+files = [
+ {file = "gunicorn-20.1.0-py3-none-any.whl", hash = "sha256:9dcc4547dbb1cb284accfb15ab5667a0e5d1881cc443e0677b4882a4067a807e"},
+ {file = "gunicorn-20.1.0.tar.gz", hash = "sha256:e0a968b5ba15f8a328fdfd7ab1fcb5af4470c28aaf7e55df02a99bc13138e6e8"},
+]
+
+[package.dependencies]
+setuptools = ">=3.0"
+
+[package.extras]
+eventlet = ["eventlet (>=0.24.1)"]
+gevent = ["gevent (>=1.4.0)"]
+setproctitle = ["setproctitle"]
+tornado = ["tornado (>=0.2)"]
+
[[package]]
name = "isort"
version = "5.12.0"
@@ -569,6 +590,23 @@ files = [
[package.extras]
cli = ["click (>=5.0)"]
+[[package]]
+name = "setuptools"
+version = "67.6.1"
+description = "Easily download, build, install, upgrade, and uninstall Python packages"
+category = "main"
+optional = false
+python-versions = ">=3.7"
+files = [
+ {file = "setuptools-67.6.1-py3-none-any.whl", hash = "sha256:e728ca814a823bf7bf60162daf9db95b93d532948c4c0bea762ce62f60189078"},
+ {file = "setuptools-67.6.1.tar.gz", hash = "sha256:257de92a9d50a60b8e22abfcbb771571fde0dbf3ec234463212027a4eeecbe9a"},
+]
+
+[package.extras]
+docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"]
+testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8 (<5)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"]
+testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"]
+
[[package]]
name = "six"
version = "1.16.0"
@@ -704,4 +742,4 @@ watchdog = ["watchdog"]
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
-content-hash = "dbccbcb54f85d3d0a6cb8158d839a77d5a6bcfccf8f735d8bf9d44ea51302e1f"
+content-hash = "bb597b39ae9cbcbaad4012a1afc27b27d0cc3a25f77bf487a601ebe470c90022"
diff --git a/auth-ms/pyproject.toml b/auth-ms/pyproject.toml
index b5eba52..2cd0a55 100644
--- a/auth-ms/pyproject.toml
+++ b/auth-ms/pyproject.toml
@@ -15,6 +15,7 @@ flask-cors = "^3.0.10"
flask-sqlalchemy = "^3.0.3"
psycopg2 = "^2.9.5"
flask-migrate = "^4.0.4"
+gunicorn = "^20.1.0"
[tool.poetry.group.dev.dependencies]
diff --git a/auth-ms/services.py b/auth-ms/services.py
deleted file mode 100644
index c543f58..0000000
--- a/auth-ms/services.py
+++ /dev/null
@@ -1,162 +0,0 @@
-from datetime import datetime
-from functools import wraps
-from typing import Literal, TypedDict
-
-import jwt # type: ignore
-from flask import jsonify, request
-
-from app import app, db
-from models import User
-
-
-class JwtAccessPayload(TypedDict):
- id: str
- username: str
- exp: datetime
- token_type: Literal["access"]
-
-
-class JwtRefreshPayload(TypedDict):
- id: str
- exp: datetime
- token_type: Literal["refresh"]
-
-
-def get_user_by_username(username) -> User:
- return User.query.filter(User.username == username.lower()).first()
-
-
-def get_user_by_id(id) -> User:
- return User.query.filter(User.id == id).first()
-
-
-def update_refresh_token(id, refresh_token) -> bool:
- try:
- user = get_user_by_id(id)
- user.refresh_token = refresh_token
- db.session.add(user)
- db.session.commit()
- return True
- except Exception as e:
- print("Выберите режим игры
+{{ currentTaskTitle }}
+ +Задача
+ +Текст
+ {{ currentTask.text }} +Ожидаемый результат
+ {{ currentTask.expectedResult }} +Регулярное выражение
+Результат
+Лобби создано! Отправьте ссылку друзьям и дождитесь их подключения.
+
+ {{ url }}
+