Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WPB-8887] wire-subsystems: implement the GetBy* account queries, includes InvitationCodeStore. #4218

Merged
merged 102 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 97 commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
20e4f5e
[wip] initial impl for GetBy* account queries as Effect and interpreter
elland Aug 22, 2024
59f1995
[feat] implement mock interpreters
MangoIV Aug 20, 2024
1bf730e
[chore] format
MangoIV Aug 20, 2024
87ffbb6
[wip] wrap up the invitationcodestore
elland Aug 22, 2024
136418a
Typo
elland Aug 22, 2024
2027fed
Fixed overcorrection.
elland Aug 22, 2024
28f5665
Cleaning.
elland Aug 22, 2024
81eb543
Clean getFields.
elland Aug 22, 2024
0eb772e
Moved invitation info to Store
elland Aug 22, 2024
fdad7ac
In-memory store for invitation info.
elland Aug 22, 2024
96c0b01
Account for inviteeUrl visibility.
elland Aug 26, 2024
64660b3
Cleaned extensions.
elland Aug 26, 2024
4020568
Fix ad-hoc deletion logic for invited users.
elland Aug 26, 2024
243ad32
Updated wire-subsystem nix.
elland Aug 26, 2024
08e15ac
[chore] remove some unnecessary types
MangoIV Aug 26, 2024
1fd3321
[chore] move count invitations to InvitationCodeStore
MangoIV Aug 26, 2024
c56f7c7
[wip] move lookupInvitations paginaged to InvitationCodeStore
MangoIV Aug 26, 2024
13eddee
Moved InsertInvitation to InvitationCodeStore, moved Timeout.
elland Aug 27, 2024
4591c39
[fix] missing SELECT in cql.
elland Aug 27, 2024
47e7ea1
Improved comment.
elland Aug 27, 2024
c9333f0
Added deletion to InvitationCodeStore.
elland Aug 27, 2024
58c3078
Regen nix derivations.
elland Aug 27, 2024
e510fd4
Added changelog.
elland Aug 29, 2024
27b572e
Removed indices from cql.
elland Aug 29, 2024
61ec10e
Update libs/wire-api/src/Wire/API/Team/Invitation.hs
fisx Aug 29, 2024
c32143b
Update libs/wire-subsystems/src/Wire/InvitationCodeStore/Cassandra.hs
fisx Aug 29, 2024
fa97637
Update libs/wire-subsystems/src/Wire/InvitationCodeStore.hs
elland Aug 29, 2024
ab1a1ed
Cleaned up + review feedback.
elland Aug 29, 2024
e948768
Renamed effect function.
elland Aug 29, 2024
301c39d
Moved Timeout.
elland Aug 29, 2024
86a9641
Update changelog.d/5-internal/wpb-8887
elland Sep 2, 2024
34061ea
Renamed lookupAccounts to getUsers.
elland Sep 2, 2024
bfb00e1
Added comments to similarly named functions.
elland Sep 2, 2024
27f859f
Restore behaviour for getInvitation.
elland Sep 2, 2024
fbd48cb
Make route names unique.
fisx Sep 2, 2024
5a5d9ee
weeder.
fisx Sep 2, 2024
a581e6c
one more helper function in UserSubsystem.
fisx Sep 2, 2024
954394d
Get local domain from api in some more places. [WIP]
fisx Sep 2, 2024
90ad39c
Cleaned up.
elland Sep 3, 2024
f6c0f9b
Lint
elland Sep 3, 2024
ac6e48d
WIP: Remove extra Timeout type
elland Sep 3, 2024
28398db
Tweak changelog.
fisx Sep 3, 2024
3d3ee05
Simplify UserSubsystem operations set (resolves TODO).
fisx Sep 3, 2024
b28e04a
Fix user activation, add include pending activation to GetBy.
elland Sep 3, 2024
f26be09
nix
elland Sep 3, 2024
61a1e82
Apply suggestions from code review
elland Sep 3, 2024
7451319
Fix getBy usage.
elland Sep 3, 2024
90d95e0
Fix password tests.
elland Sep 4, 2024
9787b42
Fixed bugs and added GetBy tests.
elland Sep 4, 2024
4aaf25e
Removed unnecessary filter.
elland Sep 5, 2024
629b882
Fixed another logic error in invitation pending.
elland Sep 5, 2024
dc74199
Removed Wwarns, added a type to document the insert effect.
elland Sep 5, 2024
02ed2fa
Merge remote-tracking branch 'origin/develop' into mangoiv/wpb-8887
fisx Sep 5, 2024
c2ee5df
wip (fix errors from merge)
fisx Sep 5, 2024
c6afad5
Update libs/wire-subsystems/src/Wire/PasswordResetCodeStore/Cassandra.hs
fisx Sep 5, 2024
561a361
Make it compile again
mdimjasevic Sep 5, 2024
f7f76cd
Fix a Cassandra query for StoredUser
mdimjasevic Sep 5, 2024
5c500d4
Hi ci
elland Sep 9, 2024
29fcb2e
Apply feedback / cleanup.
elland Sep 9, 2024
db1491a
Removed export from Cassandra interpreter, use Effect.
elland Sep 9, 2024
163fc18
[chore] Improved order of checks for PR sanitising.
elland Sep 9, 2024
4578fe4
Fixed bug in filtering users.
elland Sep 9, 2024
ee0a946
Merge branch 'develop' into mangoiv/wpb-8887
elland Sep 9, 2024
d5b704d
Fix user lookup by passing include pending invitations
elland Sep 10, 2024
78b8660
Revert "WIP: Remove extra Timeout type"
elland Sep 10, 2024
7b93beb
[fix] adhere to the old behaviour of the getby query
MangoIV Sep 10, 2024
3254a77
Polish getBy query (not changing behavior).
fisx Sep 10, 2024
eb068f3
hi ci
elland Sep 11, 2024
66c9548
Attempt to fix tests.
elland Sep 11, 2024
33473b2
[fix] revert to old behaviour in Brig/API/User
MangoIV Sep 11, 2024
526d16d
Fixed invinite loop when deleting users.
elland Sep 11, 2024
4215146
Fixed semantics, expand for detail ->
elland Sep 11, 2024
bb4ca46
Fix self/delete.
elland Sep 11, 2024
3798401
Merge remote-tracking branch 'origin/develop' into mangoiv/wpb-8887
elland Sep 12, 2024
5f93ba7
Added property tests for getBy semantics.
elland Sep 12, 2024
cebf28c
Extracted by emails from GetBy, more tests!
elland Sep 12, 2024
8b3393b
rm overly ambitious TODO.
fisx Sep 12, 2024
b720716
rm trailing whitespace.
fisx Sep 12, 2024
872329f
rm self-evident FIXME.
fisx Sep 12, 2024
ebebba8
Give better names to two UserSubsystem operations.
fisx Sep 12, 2024
a18ffd6
nit-pick.
fisx Sep 12, 2024
cf7ec8b
resolve FUTUREWORK.
fisx Sep 12, 2024
f9e829b
Fix / polish haddock in UserSubsystem.
fisx Sep 12, 2024
16858c6
Tweak legacy integration test.
fisx Sep 12, 2024
962203c
Mark (occasionally) failing test case.
fisx Sep 12, 2024
b8cf6bc
Make function pure.
elland Sep 12, 2024
c3639ad
Replaced coerce with unsafe perform IO.
elland Sep 12, 2024
012ee66
Revert accidental change to log levels.
elland Sep 12, 2024
e79db04
Simplify UserStore.
fisx Sep 12, 2024
948fd9b
Remove spurious FUTUREWORK.
fisx Sep 12, 2024
d73f38d
No!
fisx Sep 12, 2024
342ece2
Extend prop test coverage.
fisx Sep 12, 2024
7f7eaa9
rm bogus FUTUREWORK.
fisx Sep 12, 2024
3eb60ca
Haddocks.
fisx Sep 12, 2024
fa76f75
Weed out the weeed
elland Sep 12, 2024
7188ee5
Merge remote-tracking branch 'refs/remotes/origin/mangoiv/wpb-8887' i…
elland Sep 12, 2024
f7034e6
Regen nix.
elland Sep 12, 2024
c0aef87
rm some highly dubious weed.
fisx Sep 12, 2024
d1dd8e9
Merge remote-tracking branch 'refs/remotes/origin/mangoiv/wpb-8887' i…
fisx Sep 12, 2024
2879694
Fix compiler warnings.
fisx Sep 12, 2024
1e61e31
Merge remote-tracking branch 'origin/develop' into mangoiv/wpb-8887
fisx Sep 12, 2024
6b5637c
hi ci
fisx Sep 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ lint-all: formatc hlint-check-all lint-common
# The extra 'hlint-check-pr' has been witnessed to be necessary due to
# some bu in `hlint-inplace-pr`. Details got lost in history.
.PHONY: lint-all-shallow
lint-all-shallow: formatf hlint-inplace-pr hlint-check-pr lint-common
lint-all-shallow: lint-common formatf hlint-inplace-pr hlint-check-pr

.PHONY: lint-common
lint-common: check-local-nix-derivations treefmt-check # weeder (does not work on CI yet)
Expand Down
1 change: 1 addition & 0 deletions changelog.d/5-internal/wpb-8887
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New user subsystem operation `getAccountsBy` for complex account lookups.
4 changes: 2 additions & 2 deletions integration/test/Test/Spar.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ testSparUserCreationInvitationTimeout = do
res.status `shouldMatchInt` 409

-- However, if we wait until the invitation timeout has passed
-- (assuming it is configured to 10s locally and in CI)...
liftIO $ threadDelay (11_000_000)
-- It's currently configured to 1s local/CI.
liftIO $ threadDelay (2_000_000)

-- ...we should be able to create the user again
retryT $ bindResponse (createScimUser OwnDomain tok scimUser) $ \res -> do
Expand Down
1 change: 0 additions & 1 deletion libs/brig-types/src/Brig/Types/User.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module Brig.Types.User
( ManagedByUpdate (..),
RichInfoUpdate (..),
PasswordResetPair,
HavePendingInvitations (..),
)
where

Expand Down
2 changes: 2 additions & 0 deletions libs/cassandra-util/cassandra-util.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ library
Cassandra.Helpers
Cassandra.MigrateSchema
Cassandra.Options
Cassandra.QQ
Cassandra.Schema
Cassandra.Settings
Cassandra.Util
Expand Down Expand Up @@ -87,6 +88,7 @@ library
, optparse-applicative >=0.10
, retry
, split >=0.2
, template-haskell
, text >=0.11
, time >=1.4
, tinylog >=0.7
Expand Down
2 changes: 2 additions & 0 deletions libs/cassandra-util/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
, optparse-applicative
, retry
, split
, template-haskell
, text
, time
, tinylog
Expand All @@ -44,6 +45,7 @@ mkDerivation {
optparse-applicative
retry
split
template-haskell
text
time
tinylog
Expand Down
1 change: 1 addition & 0 deletions libs/cassandra-util/src/Cassandra.hs
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,4 @@ import Cassandra.Exec as C
x1,
x5,
)
import Cassandra.QQ as C (sql)
18 changes: 18 additions & 0 deletions libs/cassandra-util/src/Cassandra/QQ.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{-# LANGUAGE TemplateHaskellQuotes #-}

module Cassandra.QQ (sql) where

import Imports
import Language.Haskell.TH
import Language.Haskell.TH.Quote (QuasiQuoter (..))

-- | a simple quasi quoter to allow for tree-sitter syntax highlight injection.
-- This uses the name sql because that is known to tree-sitter, unlike cql
sql :: QuasiQuoter
sql =
QuasiQuoter
{ quotePat = error "Cassandra.QQ: sql quasiquoter cannot be used as pattern",
quoteType = error "Cassandra.QQ: sql quasiquoter cannot be used as type",
quoteDec = error "Cassandra.QQ: sql quasiquoter cannot be used as declaration",
quoteExp = appE [|fromString|] . stringE
}
4 changes: 0 additions & 4 deletions libs/imports/src/Imports.hs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ module Imports
-- * Extra Helpers
whenM,
unlessM,
catMaybesToList,

-- * Functor
(<$$>),
Expand Down Expand Up @@ -385,6 +384,3 @@ infix 4 <$$>
(<$$$>) = fmap . fmap . fmap

infix 4 <$$$>

catMaybesToList :: Maybe (Maybe a) -> [a]
catMaybesToList = catMaybes . maybeToList
2 changes: 2 additions & 0 deletions libs/types-common/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
, quickcheck-instances
, random
, schema-profunctor
, scientific
, servant-server
, string-conversions
, tagged
Expand Down Expand Up @@ -96,6 +97,7 @@ mkDerivation {
quickcheck-instances
random
schema-profunctor
scientific
servant-server
tagged
tasty
Expand Down
14 changes: 14 additions & 0 deletions libs/types-common/src/Data/HavePendingInvitations.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Data.HavePendingInvitations where

import Imports
import Wire.Arbitrary

data HavePendingInvitations
= WithPendingInvitations
| NoPendingInvitations
deriving (Eq, Show, Ord, Generic)
deriving (Arbitrary) via GenericUniform HavePendingInvitations

fromBool :: Bool -> HavePendingInvitations
fromBool True = WithPendingInvitations
fromBool False = NoPendingInvitations
5 changes: 5 additions & 0 deletions libs/types-common/src/Data/Qualified.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module Data.Qualified
tUnqualified,
tDomain,
tUntagged,
tSplit,
qTagUnsafe,
Remote,
toRemoteUnsafe,
Expand Down Expand Up @@ -92,6 +93,10 @@ tUnqualified = qUnqualified . tUntagged
tDomain :: QualifiedWithTag t a -> Domain
tDomain = qDomain . tUntagged

-- | perform 'qUnqualified' and 'tDomain' at once. Useful in ViewPatterns.
tSplit :: QualifiedWithTag t a -> (Domain, a)
tSplit (tUntagged -> q) = (q.qDomain, q.qUnqualified)

-- | A type representing a 'Qualified' value where the domain is guaranteed to
-- be remote.
type Remote = QualifiedWithTag 'QRemote
Expand Down
32 changes: 32 additions & 0 deletions libs/types-common/src/Util/Timeout.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module Util.Timeout
( Timeout (..),
module Data.Time.Clock,
)
where

import Data.Aeson
import Data.Aeson.Types
import Data.Scientific
import Data.Time.Clock
import Imports

newtype Timeout = Timeout
{ timeoutDiff :: NominalDiffTime
}
deriving newtype (Eq, Enum, Ord, Num, Real, Fractional, RealFrac, Show)

instance Read Timeout where
readsPrec i s =
case readsPrec i s of
[(x :: Int, s')] -> [(Timeout (fromIntegral x), s')]
_ -> []

instance FromJSON Timeout where
parseJSON (Number n) =
let defaultV = 3600
bounded = toBoundedInteger n :: Maybe Int64
in pure $
Timeout $
fromIntegral @Int $
maybe defaultV fromIntegral bounded
parseJSON v = typeMismatch "activationTimeout" v
3 changes: 3 additions & 0 deletions libs/types-common/types-common.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ library
Data.Domain
Data.ETag
Data.Handle
Data.HavePendingInvitations
Data.Id
Data.Json.Util
Data.LegalHold
Expand All @@ -38,6 +39,7 @@ library
Util.Options
Util.Options.Common
Util.Test
Util.Timeout
Wire.Arbitrary

other-modules: Paths_types_common
Expand Down Expand Up @@ -125,6 +127,7 @@ library
, quickcheck-instances >=0.3.16
, random >=1.1
, schema-profunctor
, scientific
, servant-server
, tagged >=0.8
, tasty >=0.11
Expand Down
2 changes: 1 addition & 1 deletion libs/wire-api/src/Wire/API/Routes/Internal/Brig/OAuth.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type OAuthAPI =
:> Post '[JSON] OAuthClientCredentials
)
:<|> Named
"get-oauth-client"
"i-get-oauth-client"
( Summary "Get OAuth client by id"
:> CanThrow 'OAuthFeatureDisabled
:> CanThrow 'OAuthClientNotFound
Expand Down
2 changes: 1 addition & 1 deletion libs/wire-api/src/Wire/API/Routes/Internal/Galley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ type IMiscAPI =
(RespondEmpty 200 "OK")
)
:<|> Named
"add-bot"
"i-add-bot"
( -- This endpoint can lead to the following events being sent:
-- - MemberJoin event to members
CanThrow ('ActionDenied 'AddConversationMember)
Expand Down
8 changes: 4 additions & 4 deletions libs/wire-api/src/Wire/API/Routes/Public/Brig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ type UserAPI =
"get-rich-info"
( Summary "Get a user's rich info"
:> CanThrow 'InsufficientTeamPermissions
:> ZUser
:> ZLocalUser
:> "users"
:> CaptureUserId "uid"
:> "rich-info"
Expand Down Expand Up @@ -322,7 +322,7 @@ type SelfAPI =
:> CanThrow 'MissingAuth
:> CanThrow 'DeleteCodePending
:> CanThrow 'OwnerDeletingSelf
:> ZUser
:> ZLocalUser
:> "self"
:> ReqBody '[JSON] DeleteUser
:> MultiVerb 'DELETE '[JSON] DeleteSelfResponses (Maybe Timeout)
Expand Down Expand Up @@ -743,7 +743,7 @@ type UserClientAPI =
:> CanThrow 'MalformedPrekeys
:> CanThrow 'CodeAuthenticationFailed
:> CanThrow 'CodeAuthenticationRequired
:> ZUser
:> ZLocalUser
:> ZConn
:> "clients"
:> ReqBody '[JSON] NewClient
Expand All @@ -766,7 +766,7 @@ type UserClientAPI =
:> CanThrow 'MalformedPrekeys
:> CanThrow 'CodeAuthenticationFailed
:> CanThrow 'CodeAuthenticationRequired
:> ZUser
:> ZLocalUser
:> ZConn
:> "clients"
:> ReqBody '[JSON] NewClient
Expand Down
12 changes: 6 additions & 6 deletions libs/wire-api/src/Wire/API/Routes/Public/Brig/OAuth.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type OAuthAPI =
( Summary "Get OAuth client information"
:> CanThrow 'OAuthFeatureDisabled
:> CanThrow 'OAuthClientNotFound
:> ZUser
:> ZLocalUser
:> "oauth"
:> "clients"
:> Capture' '[Description "The ID of the OAuth client"] "OAuthClientId" OAuthClientId
Expand All @@ -55,7 +55,7 @@ type OAuthAPI =
"create-oauth-auth-code"
( Summary "Create an OAuth authorization code"
:> Description "Currently only supports the 'code' response type, which corresponds to the authorization code flow."
:> ZUser
:> ZLocalUser
:> "oauth"
:> "authorization"
:> "codes"
Expand Down Expand Up @@ -99,7 +99,7 @@ type OAuthAPI =
"get-oauth-applications"
( Summary "Get OAuth applications with account access"
:> Description "Get all OAuth applications with active account access for a user."
:> ZUser
:> ZLocalUser
:> "oauth"
:> "applications"
:> MultiVerb1
Expand All @@ -110,7 +110,7 @@ type OAuthAPI =
:<|> Named
"revoke-oauth-account-access-v6"
( Summary "Revoke account access from an OAuth application"
:> ZUser
:> ZLocalUser
:> Until 'V7
:> "oauth"
:> "applications"
Expand All @@ -125,7 +125,7 @@ type OAuthAPI =
"revoke-oauth-account-access"
( Summary "Revoke account access from an OAuth application"
:> CanThrow 'AccessDenied
:> ZUser
:> ZLocalUser
:> From 'V7
:> "oauth"
:> "applications"
Expand All @@ -142,7 +142,7 @@ type OAuthAPI =
"delete-oauth-refresh-token"
( Summary "Revoke an active OAuth session"
:> Description "Revoke an active OAuth session by providing the refresh token ID."
:> ZUser
:> ZLocalUser
:> CanThrow 'AccessDenied
:> CanThrow 'OAuthClientNotFound
:> "oauth"
Expand Down
39 changes: 20 additions & 19 deletions libs/wire-api/src/Wire/API/Team/Invitation.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE StrictData #-}

-- This file is part of the Wire Server implementation.
Expand Down Expand Up @@ -67,27 +68,27 @@ instance ToSchema InvitationRequest where
InvitationRequest
<$> locale
.= optFieldWithDocModifier "locale" (description ?~ "Locale to use for the invitation.") (maybeWithDefault A.Null schema)
<*> role
<*> (.role)
.= optFieldWithDocModifier "role" (description ?~ "Role of the invitee (invited user).") (maybeWithDefault A.Null schema)
<*> inviteeName
<*> (.inviteeName)
.= optFieldWithDocModifier "name" (description ?~ "Name of the invitee (1 - 128 characters).") (maybeWithDefault A.Null schema)
<*> inviteeEmail
<*> (.inviteeEmail)
.= fieldWithDocModifier "email" (description ?~ "Email of the invitee.") schema

--------------------------------------------------------------------------------
-- Invitation

data Invitation = Invitation
{ inTeam :: TeamId,
inRole :: Role,
inInvitation :: InvitationId,
inCreatedAt :: UTCTimeMillis,
{ team :: TeamId,
role :: Role,
invitationId :: InvitationId,
createdAt :: UTCTimeMillis,
-- | this is always 'Just' for new invitations, but for
-- migration it is allowed to be 'Nothing'.
inCreatedBy :: Maybe UserId,
inInviteeEmail :: EmailAddress,
inInviteeName :: Maybe Name,
inInviteeUrl :: Maybe (URIRef Absolute)
createdBy :: Maybe UserId,
inviteeEmail :: EmailAddress,
inviteeName :: Maybe Name,
inviteeUrl :: Maybe (URIRef Absolute)
}
deriving stock (Eq, Show, Generic)
deriving (Arbitrary) via (GenericUniform Invitation)
Expand All @@ -99,22 +100,22 @@ instance ToSchema Invitation where
"Invitation"
(description ?~ "An invitation to join a team on Wire")
$ Invitation
<$> inTeam
<$> (.team)
.= fieldWithDocModifier "team" (description ?~ "Team ID of the inviting team") schema
<*> inRole
<*> (.role)
-- clients, when leaving "role" empty, can leave the default role choice to us
.= (fromMaybe defaultRole <$> optFieldWithDocModifier "role" (description ?~ "Role of the invited user") schema)
<*> inInvitation
<*> (.invitationId)
.= fieldWithDocModifier "id" (description ?~ "UUID used to refer the invitation") schema
<*> inCreatedAt
<*> (.createdAt)
.= fieldWithDocModifier "created_at" (description ?~ "Timestamp of invitation creation") schema
<*> inCreatedBy
<*> (.createdBy)
.= optFieldWithDocModifier "created_by" (description ?~ "ID of the inviting user") (maybeWithDefault A.Null schema)
<*> inInviteeEmail
<*> (.inviteeEmail)
.= fieldWithDocModifier "email" (description ?~ "Email of the invitee") schema
<*> inInviteeName
<*> (.inviteeName)
.= optFieldWithDocModifier "name" (description ?~ "Name of the invitee (1 - 128 characters)") (maybeWithDefault A.Null schema)
<*> (fmap (TE.decodeUtf8 . serializeURIRef') . inInviteeUrl)
<*> (fmap (TE.decodeUtf8 . serializeURIRef') . inviteeUrl)
.= optFieldWithDocModifier "url" (description ?~ "URL of the invitation link to be sent to the invitee") (maybeWithDefault A.Null urlSchema)
where
urlSchema = parsedText "URIRef Absolute" (runParser (uriParser strictURIParserOptions) . TE.encodeUtf8)
Expand Down
Loading
Loading