diff options
author | William Carroll <wpcarro@gmail.com> | 2020-07-28T09·57+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-07-28T09·57+0100 |
commit | 2398f1bd40235ce4ff031dccbde4d04b32395292 (patch) | |
tree | 68a43d3ee98f7eb3815b7f79af6d789eb60fe1c3 /src/API.hs | |
parent | 6d9e76313d1f89dcf4c1adb7bfabd811a65bd83a (diff) |
Distinguish b/w Account and User
Additionally: supporting more CRUDL methods for the Accounts and Trips tables.
Diffstat (limited to 'src/API.hs')
-rw-r--r-- | src/API.hs | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/API.hs b/src/API.hs index 545aa25be777..95b9f14a399c 100644 --- a/src/API.hs +++ b/src/API.hs @@ -9,20 +9,31 @@ import Servant.API import qualified Types as T -------------------------------------------------------------------------------- -type API = "user" +type API = + -- accounts: Create + "accounts" :> ReqBody '[JSON] T.Account :> Post '[JSON] (Maybe T.Session) - :<|> "user" - :> Capture "name" Text - :> Get '[JSON] (Maybe T.Account) - -- Create + -- accounts: Read + -- accounts: Update + -- accounts: Delete + :<|> "accounts" + :> QueryParam' '[Required] "username" Text + :> Delete '[JSON] NoContent + -- accounts: List + :<|> "accounts" + :> Get '[JSON] [T.User] + + -- trips: Create :<|> "trips" :> ReqBody '[JSON] T.Trip :> Post '[JSON] NoContent - -- Read - :<|> "trips" - :> Get '[JSON] [T.Trip] - -- Delete + -- trips: Read + -- trips: Update + -- trips: Delete :<|> "trips" :> ReqBody '[JSON] T.TripPK :> Delete '[JSON] NoContent + -- trips: List + :<|> "trips" + :> Get '[JSON] [T.Trip] |