From ed4e15e8e5008c6158d8e07b87f9f1abd515edc1 Mon Sep 17 00:00:00 2001 From: saml33 Date: Thu, 23 Dec 2021 11:04:57 +1100 Subject: [PATCH] add created time --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index d99dc4f..8529eee 100644 --- a/src/index.ts +++ b/src/index.ts @@ -134,9 +134,10 @@ router.get("/alerts/:mangoAccountPk", async (ctx, next) => { router.post("/updates", async (ctx, next) => { try { const req: any = ctx.request.body + const update = { ...req.update, date: Date.now() } await validateUpdatePassword(req.password) ctx.body = { status: "success" } - ctx.db.collection("updates").insertOne(req.update) + ctx.db.collection("updates").insertOne(update) } catch (e: any) { let errorMessage = "Something went wrong" if (e.name == "UserError") {