Fix bug in POST measures API.
This commit is contained in:
parent
9d8ad6bf74
commit
5887368ed1
@ -389,18 +389,22 @@ proc start*(ctx: PMApiContext): void =
|
||||
|
||||
let slug =
|
||||
if jsonBody.hasKey("slug"): jsonBody["slug"].getStr.nameToSlug
|
||||
else: jsonBody["slug"].getStr.nameToSlug
|
||||
else: jsonBody["name"].getStr.nameToSlug
|
||||
|
||||
let name =
|
||||
if jsonBody.hasKey("name"): jsonBody["name"].getStr
|
||||
else: jsonBody["slug"].getStr.capitalize
|
||||
|
||||
let config =
|
||||
if jsonBody.hasKey("config"): jsonBody["config"]
|
||||
else: newJObject()
|
||||
|
||||
var newMeasure = Measure(
|
||||
userId: session.user.id,
|
||||
slug: slug,
|
||||
name: name,
|
||||
description: jsonBody.getIfExists("description").getStr(""),
|
||||
config: jsonBody.getOrFail("config"))
|
||||
config: config)
|
||||
|
||||
resp($(%ctx.db.createMeasure(newMeasure)), JSON)
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6Imp3dCJ9.eyJleHAiOjE1NTIzMjYxODMsInN1YiI6IjA3NWJjYzhmLWE4N2QtNDRjZS04MDk5LWQ3ZGExZjYxYTc1YSIsImlhdCI6MTU1MjIzOTc4M30.RjE0MjYzMkFDOTc4RjZFNTYyMDVBMTY5MjExNkJGQ0QzNkQ1QjZFNzVCODBDMThENTc1M0Y0MjhDMkNFMjE3RA
|
@ -1 +0,0 @@
|
||||
auth-token-jdb.txt
|
@ -1 +0,0 @@
|
||||
../src/util/bash/client.sh
|
Loading…
x
Reference in New Issue
Block a user