1 module Gargantext.API.Members where
3 import Gargantext.Prelude
4 import Gargantext.API.Prelude
6 import Data.Text (Text)
7 import Gargantext.API.Admin.EnvTypes (Env)
8 import Gargantext.Core.Types (UserId)
9 import Gargantext.Database.Admin.Types.Node (NodeType(NodeTeam))
10 import Gargantext.Database.Query.Table.Node (getNodesIdWithType)
11 import Gargantext.Database.Action.Share (membersOf)
12 import Gargantext.Database.Prelude (CmdCommon)
13 import Control.Monad.Extra (concatMapM)
15 type MembersAPI = Get '[JSON] [Text]
17 members :: UserId -> ServerT MembersAPI (GargM Env GargError)
21 getMembers :: (CmdCommon env) =>
22 GargM env GargError [Text]
24 teamNodeIds <- getNodesIdWithType NodeTeam
25 m <- concatMapM membersOf teamNodeIds