about summary refs log tree commit diff
path: root/src/API.hs
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-07-28T09·14+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-07-28T09·14+0100
commit6d9e76313d1f89dcf4c1adb7bfabd811a65bd83a (patch)
tree65b41771610fb43c4f6cc81c6b958c9acf5ee4bf /src/API.hs
parent0637da36ccac7e609041bc8999e3da348171f95f (diff)
Partially support DELETE /trips
Allow a user to delete a trip entry from the Trips table using the Primary
Key. While this type-checks and compiles, it doesn't appear to be working as
intended. Perhaps I should use an auto-incrementing integer as the Primary
Key. I'm not sure how I want to handle this, so I'm punting for now.
Diffstat (limited to 'src/API.hs')
-rw-r--r--src/API.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/API.hs b/src/API.hs
index a42bf804b471..545aa25be777 100644
--- a/src/API.hs
+++ b/src/API.hs
@@ -14,10 +14,15 @@ type API = "user"
            :> Post '[JSON] (Maybe T.Session)
       :<|> "user"
            :> Capture "name" Text
-           :> Get  '[JSON] (Maybe T.Account)
-      :<|> "trip"
+           :> Get '[JSON] (Maybe T.Account)
+      -- Create
+      :<|> "trips"
            :> ReqBody '[JSON] T.Trip
            :> Post '[JSON] NoContent
       -- Read
       :<|> "trips"
            :> Get '[JSON] [T.Trip]
+      -- Delete
+      :<|> "trips"
+           :> ReqBody '[JSON] T.TripPK
+           :> Delete '[JSON] NoContent