Support GET /trips

In the spirit of support CRUDL, I added a GET /trips, which lists all of the
trips in the Trips table.
This commit is contained in:
William Carroll 2020-07-28 10:13:38 +01:00
parent 2f73d1db6c
commit 0637da36cc
3 changed files with 15 additions and 0 deletions

View file

@ -192,6 +192,13 @@ data Trip = Trip
, tripComment :: Comment
} deriving (Eq, Show, Generic)
instance FromRow Trip where
fromRow = Trip <$> field
<*> field
<*> field
<*> field
<*> field
-- | Return the tuple representation of a Trip record for SQL.
tripFields :: Trip -> (Username, Destination, Date, Date, Comment)
tripFields (Trip{ tripUsername