diff --git a/app/migrations/0001_initial.py b/app/migrations/0001_initial.py index 2e9a5e7..17da4be 100644 --- a/app/migrations/0001_initial.py +++ b/app/migrations/0001_initial.py @@ -4,18 +4,23 @@ from uuid import uuid4 from tortoise import fields class Migration(migrations.Migration): + initial = True operations = [ ops.CreateModel( - name='Comment', + name='Task', fields=[ ('id', fields.UUIDField(primary_key=True, default=uuid4, unique=True, db_index=True)), ('created_at', fields.DatetimeField(auto_now=False, auto_now_add=True)), ('updated_at', fields.DatetimeField(auto_now=True, auto_now_add=False)), - ('content', fields.TextField(unique=False)), + ('list_name', fields.CharField(db_index=True, max_length=32)), + ('name', fields.TextField(unique=False)), + ('reset_cron', fields.CharField(null=True, max_length=32)), + ('check_date', fields.DatetimeField(null=True, auto_now=False, auto_now_add=False)), + ('previous_check_date', fields.DatetimeField(null=True, auto_now=False, auto_now_add=False)), ], - options={'table': 'comment', 'app': 'models', 'pk_attr': 'id'}, + options={'table': 'task', 'app': 'models', 'pk_attr': 'id'}, bases=['AbstractModel'], ), ] diff --git a/app/migrations/0002_auto_20260703_1716.py b/app/migrations/0002_auto_20260703_1716.py deleted file mode 100644 index 3e35ad3..0000000 --- a/app/migrations/0002_auto_20260703_1716.py +++ /dev/null @@ -1,27 +0,0 @@ -from tortoise import migrations -from tortoise.migrations import operations as ops -from uuid import uuid4 -from tortoise import fields - -class Migration(migrations.Migration): - dependencies = [('models', '0001_initial')] - - initial = False - - operations = [ - ops.CreateModel( - name='Task', - fields=[ - ('id', fields.UUIDField(primary_key=True, default=uuid4, unique=True, db_index=True)), - ('created_at', fields.DatetimeField(auto_now=False, auto_now_add=True)), - ('updated_at', fields.DatetimeField(auto_now=True, auto_now_add=False)), - ('list_name', fields.CharField(db_index=True, max_length=32)), - ('name', fields.TextField(unique=False)), - ('reset_cron', fields.CharField(null=True, max_length=32)), - ('check_date', fields.DatetimeField(null=True, auto_now=False, auto_now_add=False)), - ('previous_check_date', fields.DatetimeField(null=True, auto_now=False, auto_now_add=False)), - ], - options={'table': 'task', 'app': 'models', 'pk_attr': 'id'}, - bases=['AbstractModel'], - ), - ] diff --git a/app/models/__init__.py b/app/models/__init__.py index 7a9c600..88d13e6 100644 --- a/app/models/__init__.py +++ b/app/models/__init__.py @@ -1,2 +1 @@ -from .comment import Comment # noqa: F401 from .task import Task # noqa: F401 diff --git a/app/models/comment.py b/app/models/comment.py deleted file mode 100644 index e2759fb..0000000 --- a/app/models/comment.py +++ /dev/null @@ -1,7 +0,0 @@ -import tortoise - -from app.models.base import AbstractModel - - -class Comment(AbstractModel): - content = tortoise.fields.TextField(null=False) diff --git a/app/server.py b/app/server.py index 0d82d09..869fc0b 100644 --- a/app/server.py +++ b/app/server.py @@ -8,7 +8,7 @@ import gunicorn.app.base import tortoise from app import PKG_NAME -from app.models import Comment, Task +from app.models import Task if typing.TYPE_CHECKING: from app.params import Parameters @@ -41,16 +41,6 @@ class Server(gunicorn.app.base.BaseApplication): def index() -> str: return flask.render_template("index.html") - @self.app.route("/api/comments", methods=["GET"]) - async def get_comments() -> list: - return await Comment.all().order_by("created_at").values() - - @self.app.route("/api/comments", methods=["POST"]) - async def post_comment() -> tuple[str, int]: - data = flask.request.get_json() - await Comment.create(content=data["content"]) - return ("", 204) - @self.app.route("/api/lists//tasks", methods=["GET"]) async def get_tasks(list_name: str) -> list: return await Task.filter(list_name=list_name).values() diff --git a/resources/ts/api/comments.ts b/resources/ts/api/comments.ts deleted file mode 100644 index 2a28af3..0000000 --- a/resources/ts/api/comments.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Comment } from "@/types"; - -export async function getComments(): Promise { - const response = await fetch("/api/comments"); - return await response.json(); -} - -export async function postComment(content: string): Promise { - await fetch("/api/comments", { - method: "POST", - body: JSON.stringify({ content }), - headers: { "Content-Type": "application/json" }, - }); -}