return UUID on item creation
This commit is contained in:
@@ -39,16 +39,16 @@ update c i o =
|
|||||||
& httpLBS
|
& httpLBS
|
||||||
>>= A.throwDecode . getResponseBody
|
>>= A.throwDecode . getResponseBody
|
||||||
|
|
||||||
create :: T.Text -> A.Object -> IO ()
|
create :: T.Text -> A.Object -> IO U.UUID
|
||||||
create c o = do
|
create c o = do
|
||||||
uuid <- U.nextRandom
|
uuid <- U.nextRandom
|
||||||
let i = U.toText uuid <> ".json"
|
let i = U.toText uuid <> ".json"
|
||||||
"http://localhost:8081"
|
response <- "http://localhost:8081"
|
||||||
& setRequestMethod "POST"
|
& setRequestMethod "POST"
|
||||||
& setRequestBodyLBS
|
& setRequestBodyLBS
|
||||||
(LB.fromString (printf "INSERT %s INTO %s" (LB.toString (A.encode (AM.insert "$fileName" (A.String i) o))) c))
|
(LB.fromString (printf "INSERT %s INTO %s" (LB.toString (A.encode (AM.insert "$fileName" (A.String i) o))) c))
|
||||||
& httpLBS
|
& httpLBS
|
||||||
>>= A.throwDecode . getResponseBody
|
uuid <$ A.throwDecode @() (getResponseBody response)
|
||||||
|
|
||||||
delete :: T.Text -> T.Text -> IO [A.Object]
|
delete :: T.Text -> T.Text -> IO [A.Object]
|
||||||
delete c i =
|
delete c i =
|
||||||
|
|||||||
Reference in New Issue
Block a user