fix: max limit on list name
Docker Build / build (push) Has been cancelled
Python Lint CI / ruff (push) Has been cancelled
Python Lint CI / ruff-format-check (push) Has been cancelled
Python Lint CI / ty (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
TS Lint / Oxlint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled
Docker Build / build (push) Has been cancelled
Python Lint CI / ruff (push) Has been cancelled
Python Lint CI / ruff-format-check (push) Has been cancelled
Python Lint CI / ty (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
TS Lint / Oxlint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled
This commit is contained in:
@@ -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),
|
||||
),
|
||||
]
|
||||
+1
-1
@@ -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,
|
||||
|
||||
+2
-2
@@ -58,13 +58,13 @@ class Server(gunicorn.app.base.BaseApplication):
|
||||
|
||||
@self.app.route("/api/lists/<list_name>/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/<list_name>/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)
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user