From 3d41e28342a4f1e20e280a903a5d7b0670d95b54 Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Thu, 20 May 2021 11:38:30 +0200 Subject: [PATCH] Minor changes to types --- src/back/collections/tasks.ts | 7 ++++++- src/back/index.ts | 2 +- src/back/routes/tasks.ts | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) 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);