From 9ff7f359122a5feb039ee2ec03cffbaa93875fd6 Mon Sep 17 00:00:00 2001 From: array-in-a-matrix Date: Wed, 7 Aug 2024 20:27:08 -0400 Subject: [PATCH] return file count --- src/routes/upload.nim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/routes/upload.nim b/src/routes/upload.nim index 42c9087..6b2c566 100644 --- a/src/routes/upload.nim +++ b/src/routes/upload.nim @@ -1,4 +1,4 @@ -import std/[strutils, os, json] +import std/[strutils, os, json, with] import jester import norm/[model, postgres] import ../types/[users, files] @@ -53,4 +53,9 @@ proc createUploadRoutes*(cfg: Cfg) = # write the file from memory writeFile(filePath, fileData) - resp Http200, "[]\n", "application/json" + var userFileCount: string + with userFileCount: + add "[{" + add("\"fileCount\": \"" & $user.fileCount & "\"") + add "}]" + resp Http200, userFileCount & "\n", "application/json"