Prefer NoContent response to Bool
When I first wrote this handler I wasn't aware of the NoContent response option.
This commit is contained in:
parent
52ac4d79bd
commit
2f73d1db6c
2 changed files with 3 additions and 3 deletions
|
@ -17,4 +17,4 @@ type API = "user"
|
|||
:> Get '[JSON] (Maybe T.Account)
|
||||
:<|> "trip"
|
||||
:> ReqBody '[JSON] T.Trip
|
||||
:> Post '[JSON] Bool
|
||||
:> Post '[JSON] NoContent
|
||||
|
|
|
@ -42,11 +42,11 @@ server dbFile = userAddH
|
|||
[x] -> pure (Just x)
|
||||
_ -> pure Nothing
|
||||
|
||||
createTrip :: T.Trip -> IO Bool
|
||||
createTrip :: T.Trip -> IO NoContent
|
||||
createTrip trip = withConnection dbFile $ \conn -> do
|
||||
execute conn "INSERT INTO Trips (username,destination,startDate,endDate,comment) VALUES (?,?,?,?,?)"
|
||||
(trip & T.tripFields)
|
||||
pure True
|
||||
pure NoContent
|
||||
|
||||
mkApp :: FilePath -> IO Application
|
||||
mkApp dbFile = do
|
||||
|
|
Loading…
Reference in a new issue