Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c7d38fc15 | ||
|
|
350da88802 | ||
|
|
29cdf7bb7e | ||
|
|
105a879948 | ||
|
|
1b972ad65b |
+1
-1
@@ -7,6 +7,7 @@ COPY *.json bun.lock ./
|
|||||||
RUN bun ci
|
RUN bun ci
|
||||||
|
|
||||||
COPY *.ts index.html ./
|
COPY *.ts index.html ./
|
||||||
|
COPY public ./public
|
||||||
COPY resources ./resources
|
COPY resources ./resources
|
||||||
|
|
||||||
RUN bun run build
|
RUN bun run build
|
||||||
@@ -24,7 +25,6 @@ RUN uv pip install . --system
|
|||||||
|
|
||||||
ENV APP_ENV=production
|
ENV APP_ENV=production
|
||||||
ENV PORT=5000
|
ENV PORT=5000
|
||||||
EXPOSE ${PORT}
|
|
||||||
ENV BIND=0.0.0.0
|
ENV BIND=0.0.0.0
|
||||||
|
|
||||||
COPY --from=front-end /app/dist ./dist
|
COPY --from=front-end /app/dist ./dist
|
||||||
|
|||||||
@@ -155,7 +155,8 @@ docker-build: ## docker build
|
|||||||
|
|
||||||
.PHONY: docker-run
|
.PHONY: docker-run
|
||||||
docker-run: ## docker run
|
docker-run: ## docker run
|
||||||
$(DOCKER) run -p $(PORT):5000 -v db.sqlite:/app/db.sqlite $(DOCKER_TAG)
|
touch db.sqlite
|
||||||
|
$(DOCKER) run -p $(PORT):5000 -v $(PWD)/db.sqlite:/app/db.sqlite $(DOCKER_TAG)
|
||||||
|
|
||||||
.PHONY: tortoise-%
|
.PHONY: tortoise-%
|
||||||
tortoise-%: .venv ## tortoise (command)
|
tortoise-%: .venv ## tortoise (command)
|
||||||
|
|||||||
@@ -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):
|
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)
|
name = tortoise.fields.TextField(null=False)
|
||||||
reset_cron = tortoise.fields.CharField(
|
reset_cron = tortoise.fields.CharField(
|
||||||
max_length=64,
|
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"])
|
@self.app.route("/api/lists/<list_name>/tasks", methods=["GET"])
|
||||||
async def get_tasks(list_name: str) -> list:
|
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"])
|
@self.app.route("/api/lists/<list_name>/tasks", methods=["POST"])
|
||||||
async def post_task(list_name: str) -> typing.Any:
|
async def post_task(list_name: str) -> typing.Any:
|
||||||
data = flask.request.get_json()
|
data = flask.request.get_json()
|
||||||
logging.getLogger(self.__class__.__name__).info("%s", data)
|
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)
|
parsed_data = Task.validate_create(data)
|
||||||
if parsed_data is None:
|
if parsed_data is None:
|
||||||
flask.abort(400)
|
flask.abort(400)
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tout-doux",
|
"name": "tout-doux",
|
||||||
"version": "1.0.0",
|
"version": "1.0.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "tout-doux"
|
name = "tout-doux"
|
||||||
version = "1.0.0"
|
version = "1.0.2"
|
||||||
description = ""
|
description = ""
|
||||||
requires-python = ">=3.14"
|
requires-python = ">=3.14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
@@ -150,12 +150,12 @@ function updateTitle() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
list.value = route.params.list as string;
|
list.value = (route.params.list as string).slice(0, 128);
|
||||||
fetchTasks();
|
fetchTasks();
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeRouteUpdate((to) => {
|
onBeforeRouteUpdate((to) => {
|
||||||
list.value = to.params.list as string;
|
list.value = (to.params.list as string).slice(0, 128);
|
||||||
fetchTasks();
|
fetchTasks();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ asyncpg = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tout-doux"
|
name = "tout-doux"
|
||||||
version = "1.0.0"
|
version = "1.0.2"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "flask", extra = ["async"] },
|
{ name = "flask", extra = ["async"] },
|
||||||
|
|||||||
Reference in New Issue
Block a user