From 792cfa81bb539e6bd09f86263d27f7d7d3c66de8 Mon Sep 17 00:00:00 2001 From: GeneralYosif Date: Fri, 13 Mar 2026 00:57:58 +0200 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=D1=81=D1=8A=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D0=B4=D0=B5=D0=BD=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20quest.py?= =?UTF-8?q?=20-=20=D0=B8=D0=BD=D0=B6=D0=B5=D0=BA=D1=82=D0=B8=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=20=D0=BC=D1=83=20=D0=B5=20=D0=BA=D0=BE=D0=B4=D0=B0,=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=B9=D1=82=D0=BE=20=D1=81=D0=B5=20=D0=B8=D0=B7?= =?UTF-8?q?=D0=B8=D1=81=D0=BA=D0=B2=D0=B0=D1=88=D0=B5=20-=20=D0=BD=D0=B0?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=BE=D0=B5=D0=BD=20=D1=81=20=D0=BD=D1=83?= =?UTF-8?q?=D0=B6=D0=BD=D0=B8=D1=82=D0=B5=20=D0=B7=D0=B0=20=D0=B8=D0=BC?= =?UTF-8?q?=D0=BF=D0=BE=D1=80=D1=82=D0=B8=D1=80=D0=B0=D0=BD=D0=B5=20=D0=BD?= =?UTF-8?q?=D0=B5=D1=89=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/models/quest.py | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 backend/models/quest.py diff --git a/backend/models/quest.py b/backend/models/quest.py new file mode 100644 index 0000000..d0bbdfa --- /dev/null +++ b/backend/models/quest.py @@ -0,0 +1,51 @@ +from ..extensions import db +import uuid + + +class Quest(db.Model): + __tablename__ = "coding_quests" + id = db.Column(db.String(36), primary_key=True, default=lambda: str(uuid.uuid4())) + language = db.Column(db.String(50), nullable=False) + difficulty = db.Column(db.String(50), nullable=False) + quest_name = db.Column(db.String(255), nullable=False) + solved_times = db.Column(db.Integer, default=0, nullable=True) + quest_author = db.Column(db.String(255), nullable=False) + created_at = db.Column( + db.DateTime, default=db.func.current_timestamp(), nullable=False + ) + updated_at = db.Column( + db.DateTime, + default=db.func.current_timestamp(), + onupdate=db.func.current_timestamp(), + nullable=False, + ) + condition = db.Column(db.Text, nullable=False) + function_template = db.Column(db.Text, nullable=False) + + # Quest inputs, where input_0 is the null test + input_0 = db.Column(db.Text, nullable=True) # Input for the quest + input_1 = db.Column(db.Text, nullable=True) # Input for the quest + input_2 = db.Column(db.Text, nullable=True) # Input for the quest + input_3 = db.Column(db.Text, nullable=True) # Input for the quest + input_4 = db.Column(db.Text, nullable=True) # Input for the quest + input_5 = db.Column(db.Text, nullable=True) # Input for the quest + input_6 = db.Column(db.Text, nullable=True) # Input for the quest + input_7 = db.Column(db.Text, nullable=True) # Input for the quest + input_8 = db.Column(db.Text, nullable=True) # Input for the quest + input_9 = db.Column(db.Text, nullable=True) # Input for the quest + + # Quest outputs, where output_0 is the null test + output_0 = db.Column(db.Text, nullable=True) # Output for the quest + output_1 = db.Column(db.Text, nullable=True) # Output for the quest + output_2 = db.Column(db.Text, nullable=True) # Output for the quest + output_3 = db.Column(db.Text, nullable=True) # Output for the quest + output_4 = db.Column(db.Text, nullable=True) # Output for the quest + output_5 = db.Column(db.Text, nullable=True) # Output for the quest + output_6 = db.Column(db.Text, nullable=True) # Output for the quest + output_7 = db.Column(db.Text, nullable=True) # Output for the quest + output_8 = db.Column(db.Text, nullable=True) # Output for the quest + output_9 = db.Column(db.Text, nullable=True) # Output for the quest + + example_solution = db.Column( + db.Text, nullable=True + ) # Example solution for the quest From 1e23b4aea235c7ebec6ad45754822d3e76620c88 Mon Sep 17 00:00:00 2001 From: GeneralYosif Date: Fri, 13 Mar 2026 01:18:06 +0200 Subject: [PATCH 2/5] imported Quest class in app.py - added a comment for ruff to ignore it, because this is not used as of this pull request - forgot to use english in the previous commit, sorry :) --- backend/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/app.py b/backend/app.py index 6a2ef72..abc2859 100644 --- a/backend/app.py +++ b/backend/app.py @@ -1,7 +1,8 @@ from backend.config import Config from backend.extensions import db, jwt, migrate from flask import Flask - +from .models.quest import Quest # noqa: F401 +#коментара горе казва на ruff да мълчи def create_app(config_object=None): app = Flask(__name__) From 58965d12654e9b826b93ad54b9ad04d05f7fae65 Mon Sep 17 00:00:00 2001 From: GeneralYosif Date: Fri, 13 Mar 2026 01:48:04 +0200 Subject: [PATCH 3/5] removed uselees import fot Quest class in app.py --- backend/app.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/backend/app.py b/backend/app.py index abc2859..e80a602 100644 --- a/backend/app.py +++ b/backend/app.py @@ -1,8 +1,6 @@ from backend.config import Config from backend.extensions import db, jwt, migrate from flask import Flask -from .models.quest import Quest # noqa: F401 -#коментара горе казва на ruff да мълчи def create_app(config_object=None): app = Flask(__name__) From d1f4df561dd7f88518f7f86fec9ed5fb074a4f74 Mon Sep 17 00:00:00 2001 From: GeneralYosif Date: Sun, 15 Mar 2026 17:26:31 +0200 Subject: [PATCH 4/5] executed orders given when blocking the merge --- backend/app.py | 1 + backend/models/quest.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/app.py b/backend/app.py index e80a602..6a2ef72 100644 --- a/backend/app.py +++ b/backend/app.py @@ -2,6 +2,7 @@ from backend.extensions import db, jwt, migrate from flask import Flask + def create_app(config_object=None): app = Flask(__name__) diff --git a/backend/models/quest.py b/backend/models/quest.py index d0bbdfa..491b54b 100644 --- a/backend/models/quest.py +++ b/backend/models/quest.py @@ -23,7 +23,7 @@ class Quest(db.Model): function_template = db.Column(db.Text, nullable=False) # Quest inputs, where input_0 is the null test - input_0 = db.Column(db.Text, nullable=True) # Input for the quest + input_0 = db.Column(db.Text, nullable=False) # Input for the quest input_1 = db.Column(db.Text, nullable=True) # Input for the quest input_2 = db.Column(db.Text, nullable=True) # Input for the quest input_3 = db.Column(db.Text, nullable=True) # Input for the quest @@ -35,7 +35,7 @@ class Quest(db.Model): input_9 = db.Column(db.Text, nullable=True) # Input for the quest # Quest outputs, where output_0 is the null test - output_0 = db.Column(db.Text, nullable=True) # Output for the quest + output_0 = db.Column(db.Text, nullable=False) # Output for the quest output_1 = db.Column(db.Text, nullable=True) # Output for the quest output_2 = db.Column(db.Text, nullable=True) # Output for the quest output_3 = db.Column(db.Text, nullable=True) # Output for the quest From 2ca2f926b5afa1d6f51866a1eeefe67d76b6d80a Mon Sep 17 00:00:00 2001 From: GeneralYosif Date: Sun, 15 Mar 2026 17:35:53 +0200 Subject: [PATCH 5/5] forgot to -git add .- --- backend/app.py | 1 - backend/routes/auth_routes.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/app.py b/backend/app.py index cae34c4..fea404c 100644 --- a/backend/app.py +++ b/backend/app.py @@ -4,7 +4,6 @@ from backend.extensions import cors, db, jwt, migrate - def create_app(config_object=None): app = Flask(__name__) diff --git a/backend/routes/auth_routes.py b/backend/routes/auth_routes.py index 348649c..50a9793 100644 --- a/backend/routes/auth_routes.py +++ b/backend/routes/auth_routes.py @@ -127,7 +127,7 @@ def login(): ), 200, ) - + # Tokens are stored in HttpOnly cookies — never exposed to JavaScript set_access_cookies(response, access_token) set_refresh_cookies(response, refresh_token)