diff --git a/src/back/collections/tasks.ts b/src/back/collections/tasks.ts index 86ce186..cc30676 100644 --- a/src/back/collections/tasks.ts +++ b/src/back/collections/tasks.ts @@ -3,7 +3,12 @@ import { Collection, FieldTypes, Policies } from "sealious"; const tasks = new (class extends Collection { fields = { title: new FieldTypes.Text(), - done: new FieldTypes.Boolean(), + done: new (class extends FieldTypes.Boolean { + hasDefaultValue = () => true; + async getDefaultValue() { + return false; + } + })(), }; defaultPolicy = new Policies.Public(); })(); diff --git a/src/back/index.ts b/src/back/index.ts index 283698e..cd6d9ea 100644 --- a/src/back/index.ts +++ b/src/back/index.ts @@ -15,7 +15,7 @@ declare module "koa" { } const app = new TheApp(); -app.start(); +void app.start(); const router = app.HTTPServer.router; router.use("/", homepage.routes()); diff --git a/src/back/routes/tasks.ts b/src/back/routes/tasks.ts index eb4b250..77a5905 100644 --- a/src/back/routes/tasks.ts +++ b/src/back/routes/tasks.ts @@ -13,6 +13,7 @@ router.post( .make({ title: ctx.$body.title as string, done: false, + is_active: false, }) .save(ctx.$context); ctx.body = await MainView(ctx.$context);