aboutsummaryrefslogtreecommitdiffstats
path: root/backend/lib
diff options
context:
space:
mode:
Diffstat (limited to 'backend/lib')
-rw-r--r--backend/lib/ACMS/API/REST/Collection.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/backend/lib/ACMS/API/REST/Collection.hs b/backend/lib/ACMS/API/REST/Collection.hs
index bfbd637..ed0ae9a 100644
--- a/backend/lib/ACMS/API/REST/Collection.hs
+++ b/backend/lib/ACMS/API/REST/Collection.hs
@@ -8,6 +8,8 @@ import Data.Function ((&))
import Data.Text qualified as T
import Network.HTTP.Simple
import Text.Printf (printf)
+import Data.UUID qualified as U
+import Data.UUID.V4 qualified as U
type CollectionName = T.Text
@@ -37,8 +39,10 @@ update c i o =
& httpLBS
>>= A.throwDecode . getResponseBody
-create :: T.Text -> T.Text -> A.Object -> IO ()
-create c i o =
+create :: T.Text -> A.Object -> IO ()
+create c o = do
+ uuid <- U.nextRandom
+ let i = U.toText uuid <> ".json"
"http://localhost:8081"
& setRequestMethod "POST"
& setRequestBodyLBS