about summary refs log tree commit diff
path: root/src/API.hs
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-08-02T15·30+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-08-02T15·30+0100
commite9e84f6a08c0711c498c7f1f0c9aefc39520c7a7 (patch)
treebde2d3e291d59d134d230e9ff446a47a0f65dc37 /src/API.hs
parent25334080b9bcdf238f75069feb92fba65896da5e (diff)
Support POST /accept-invitation
Allow users to accept invitations that we email to them.

TL;DR:
- I learned how to write FromHttpApiData instances, which allows me to
  parse/validate data at the edges of my application; this substantially cleans
  up my Handler code.
Diffstat (limited to 'src/API.hs')
-rw-r--r--src/API.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/API.hs b/src/API.hs
index caf42727db86..3c311591c210 100644
--- a/src/API.hs
+++ b/src/API.hs
@@ -21,7 +21,7 @@ type API =
            :> Post '[JSON] NoContent
       :<|> "verify"
            :> QueryParam' '[Required] "username" Text
-           :> QueryParam' '[Required] "secret" Text
+           :> QueryParam' '[Required] "secret" T.RegistrationSecret
            :> Get '[JSON] NoContent
       -- accounts: Read
       -- accounts: Update
@@ -71,3 +71,6 @@ type API =
            :> SessionCookie
            :> ReqBody '[JSON] T.InviteUserRequest
            :> Post '[JSON] NoContent
+      :<|> "accept-invitation"
+           :> ReqBody '[JSON] T.AcceptInvitationRequest
+           :> Get '[JSON] NoContent