Commit d27f9ebd authored by Karen Konou's avatar Karen Konou

[API] Team members API for autocomplete

parent 0b5b66ab
......@@ -132,6 +132,7 @@ library
Gargantext.API.GraphQL.Utils
Gargantext.API.Job
Gargantext.API.Metrics
Gargantext.API.Members
Gargantext.API.Ngrams.List
Gargantext.API.Ngrams.List.Types
Gargantext.API.Ngrams.NgramsTree
......
......@@ -9,10 +9,18 @@ import Gargantext.Core.Types (UserId)
import Gargantext.Database.Admin.Types.Node (NodeType(NodeTeam))
import Gargantext.Database.Query.Table.Node (getNodesIdWithType)
import Gargantext.Database.Action.Share (membersOf)
import Gargantext.Database.Prelude (HasConnectionPool, HasConfig)
import Gargantext.Core.Mail.Types (HasMail)
import Control.Monad.Extra (concatMapM)
type MembersAPI = Get '[JSON] [Text]
members :: UserId -> ServerT MembersAPI (GargM Env GargError)
members _ = do
getMembers
getMembers :: (HasConnectionPool env, HasConfig env, HasMail env) => GargM env GargError [Text]
getMembers = do
teamNodeIds <- getNodesIdWithType NodeTeam
map fst $ concatMap membersOf teamNodeIds
m <- concatMapM membersOf teamNodeIds
pure $ map fst m
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment