-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WPB-8887] wire-subsystems: implement the GetBy* account queries, inc…
…ludes InvitationCodeStore. (#4218) * [wip] initial impl for GetBy* account queries as Effect and interpreter - new Effect operation GetAccountBy in UserSubsystem - new record GetBy - new stores ActivationCodeStore and InvitationCodeStore - new sql quasiquoter in cassandra-util - some more Ord instances derived - new function tSplit for the use with ViewPatterns * Account for inviteeUrl visibility. * Renamed lookupAccounts to getUsers. * Make route names unique. * weeder. * Get local domain from api in some more places. * Simplify UserSubsystem operations set. * Tweak legacy integration test. --------- Co-authored-by: Igor Ranieri <[email protected]> Co-authored-by: Matthias Fischmann <[email protected]> Co-authored-by: Marko Dimjašević <[email protected]> Co-authored-by: Mango The Fourth <[email protected]>
- Loading branch information
1 parent
b755a6d
commit f1bc7b9
Showing
102 changed files
with
2,477 additions
and
1,642 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
New user subsystem operation `getAccountsBy` for complex account lookups. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,3 +91,4 @@ import Cassandra.Exec as C | |
x1, | ||
x5, | ||
) | ||
import Cassandra.QQ as C (sql) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.