diff options
author | KierĂ¡n Meinhardt <kmein@posteo.de> | 2024-10-11 17:36:37 +0200 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-10-11 17:41:40 +0200 |
commit | 32f008b8693340ec4d9560159de6bed10add6cf2 (patch) | |
tree | 7f6c559121c29a378dfd9ea23fdfc504464433f6 /backend/lib/ACMS/API/REST | |
parent | 3120f69126765d13715ec249c98587b30cef29c4 (diff) |
return UUID on item creation
Diffstat (limited to 'backend/lib/ACMS/API/REST')
-rw-r--r-- | backend/lib/ACMS/API/REST/Collection.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/backend/lib/ACMS/API/REST/Collection.hs b/backend/lib/ACMS/API/REST/Collection.hs index 375b20c..c22b6ba 100644 --- a/backend/lib/ACMS/API/REST/Collection.hs +++ b/backend/lib/ACMS/API/REST/Collection.hs @@ -41,16 +41,16 @@ update c i o = & httpLBS >>= A.throwDecode . getResponseBody -create :: T.Text -> A.Object -> IO () +create :: T.Text -> A.Object -> IO U.UUID create c o = do uuid <- U.nextRandom let i = U.toText uuid <> ".json" - "http://localhost:8081" + response <- "http://localhost:8081" & setRequestMethod "POST" & setRequestBodyLBS (LB.fromString (printf "INSERT %s INTO %s" (LB.toString (A.encode (AM.insert "$fileName" (A.String i) o))) c)) & httpLBS - >>= A.throwDecode . getResponseBody + uuid <$ A.throwDecode @() (getResponseBody response) delete :: T.Text -> T.Text -> IO [A.Object] delete c i = |