mirror of
https://github.com/glimpse-app/server.git
synced 2025-04-02 10:52:45 -04:00
get file list using jsony
This commit is contained in:
parent
9164a83e9c
commit
c0214a4e6d
1 changed files with 7 additions and 4 deletions
|
@ -39,12 +39,15 @@ proc createDownloadRoutes*() =
|
||||||
if not db.validToken(user, H"Authorization"):
|
if not db.validToken(user, H"Authorization"):
|
||||||
respErr "Invalid token.\n"
|
respErr "Invalid token.\n"
|
||||||
|
|
||||||
var listOfFiles = @[newFile()]
|
var seqOfFiles = @[newFile()]
|
||||||
try:
|
try:
|
||||||
db.select(listOfFiles, """"File".owner = $1""", user.id)
|
db.select(seqOfFiles, """"File".owner = $1""", user.id)
|
||||||
except NotFoundError:
|
except NotFoundError:
|
||||||
respErr Http404, "No file exists.\n"
|
respErr Http404, "No file exists.\n"
|
||||||
|
|
||||||
info "List user's file.\n" & reqInfo
|
var seqOfFileInfo = @[getFileInfo()]
|
||||||
resp200 listOfFiles.toJson() # TODO: create new type without unneeded members, read data to it then resp as json. if all else fails -> edit File type to not include owner json in it? Maybe make user.password private?
|
for file in seqOfFiles:
|
||||||
|
seqOfFileInfo.add(getFileInfo(file))
|
||||||
|
|
||||||
|
info "List user's file.\n" & reqInfo
|
||||||
|
resp200 seqOfFileInfo.toJson()
|
||||||
|
|
Loading…
Add table
Reference in a new issue