diff --git a/app/migrations/0002_auto_20260714_1541.py b/app/migrations/0002_auto_20260714_1541.py new file mode 100644 index 0000000..a3d4764 --- /dev/null +++ b/app/migrations/0002_auto_20260714_1541.py @@ -0,0 +1,21 @@ +from tortoise import migrations +from tortoise.migrations import operations as ops +from tortoise import fields + +class Migration(migrations.Migration): + dependencies = [('models', '0001_initial')] + + initial = False + + operations = [ + ops.AlterField( + model_name='Task', + name='list_name', + field=fields.CharField(db_index=True, max_length=128), + ), + ops.AlterField( + model_name='Task', + name='reset_cron', + field=fields.CharField(null=True, max_length=64), + ), + ] diff --git a/app/models/task.py b/app/models/task.py index 2dee4e4..980d7f9 100644 --- a/app/models/task.py +++ b/app/models/task.py @@ -10,7 +10,7 @@ CRONTAB_REGEX = r"^(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@eve class Task(AbstractModel): - list_name = tortoise.fields.CharField(max_length=32, db_index=True, null=False) + list_name = tortoise.fields.CharField(max_length=128, db_index=True, null=False) name = tortoise.fields.TextField(null=False) reset_cron = tortoise.fields.CharField( max_length=64, diff --git a/app/server.py b/app/server.py index d26d16e..71d3078 100644 --- a/app/server.py +++ b/app/server.py @@ -58,13 +58,13 @@ class Server(gunicorn.app.base.BaseApplication): @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() + return await Task.filter(list_name=list_name[:128]).values() @self.app.route("/api/lists//tasks", methods=["POST"]) async def post_task(list_name: str) -> typing.Any: data = flask.request.get_json() logging.getLogger(self.__class__.__name__).info("%s", data) - data["list_name"] = list_name + data["list_name"] = list_name[:128] parsed_data = Task.validate_create(data) if parsed_data is None: flask.abort(400) diff --git a/resources/ts/views/ListView.vue b/resources/ts/views/ListView.vue index 8af3499..6bebda3 100644 --- a/resources/ts/views/ListView.vue +++ b/resources/ts/views/ListView.vue @@ -150,12 +150,12 @@ function updateTitle() { } onBeforeMount(() => { - list.value = route.params.list as string; + list.value = (route.params.list as string).slice(0, 128); fetchTasks(); }); onBeforeRouteUpdate((to) => { - list.value = to.params.list as string; + list.value = (to.params.list as string).slice(0, 128); fetchTasks(); });