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 (HasConnectionPool, HasConfig)
13 import Gargantext.Core.Mail.Types (HasMail)
14 import Control.Monad.Extra (concatMapM)
16 type MembersAPI = Get '[JSON] [Text]
18 members :: UserId -> ServerT MembersAPI (GargM Env GargError)
22 getMembers :: (HasConnectionPool env, HasConfig env, HasMail env) => GargM env GargError [Text]
24 teamNodeIds <- getNodesIdWithType NodeTeam
25 m <- concatMapM membersOf teamNodeIds