From 6c10a78dfe4343b813a0a6b306131ea47daf2ec7 Mon Sep 17 00:00:00 2001 From: array-in-a-matrix Date: Wed, 24 Jul 2024 19:26:36 -0400 Subject: [PATCH] return JSON with updated file info --- src/routes/update.nim | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/routes/update.nim b/src/routes/update.nim index d2b2f2a..02c9d4e 100644 --- a/src/routes/update.nim +++ b/src/routes/update.nim @@ -1,4 +1,4 @@ -import std/[strutils, os] +import std/[strutils, os, with] import jester import norm/postgres import ../types/[users, files] @@ -50,4 +50,13 @@ proc createUpdateRoutes*() = file.path = newPath file.name = newName db.update(file) - resp Http200, "[{}]\n", "application/json" + + var fileInfo: string + with fileInfo: + add "[{" + add("\"name\": \"" & file.name & "\",") + add("\"tags\": \"" & file.tags & "\"") + add "}]" + + + resp Http200, fileInfo & "\n", "application/json"