diff options
author | William Carroll <wpcarro@gmail.com> | 2020-07-28T09·13+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-07-28T09·13+0100 |
commit | 0637da36ccac7e609041bc8999e3da348171f95f (patch) | |
tree | bc8c7b4422ff5dd4d7aa4523abd6d2c9f5765ccc /src/Types.hs | |
parent | 2f73d1db6c2ec107a9af1572f023b6c95133229c (diff) |
Support GET /trips
In the spirit of support CRUDL, I added a GET /trips, which lists all of the trips in the Trips table.
Diffstat (limited to 'src/Types.hs')
-rw-r--r-- | src/Types.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Types.hs b/src/Types.hs index 14536ae8c3ba..112b17c53ab2 100644 --- a/src/Types.hs +++ b/src/Types.hs @@ -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 |