]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Core/Text/List/Social.hs
[FEAT] Cumulative private and social lists (WIP)
[gargantext.git] / src / Gargantext / Core / Text / List / Social.hs
1 {-|
2 Module : Gargantext.Core.Text.List.Social
3 Description :
4 Copyright : (c) CNRS, 2018-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10
11 -}
12
13 module Gargantext.Core.Text.List.Social
14 where
15
16 import Gargantext.Database.Prelude
17 import Gargantext.Database.Query.Tree
18 import Gargantext.Database.Query.Tree.Root (getRootId)
19 import Gargantext.Core.Types.Individu
20 import Gargantext.Database.Admin.Types.Node
21 import Gargantext.Prelude
22 import Gargantext.Database.Query.Table.Node.Error
23 import Gargantext.Database.Admin.Config
24
25 findListsId :: (HasNodeError err, HasTreeError err) => NodeMode -> User -> Cmd err [NodeId]
26 findListsId mode u = do
27 r <- getRootId u
28 map _dt_nodeId <$> filter (\n -> _dt_typeId n == nodeTypeId NodeList)
29 <$> findNodes' mode r
30
31 findNodes' :: HasTreeError err
32 => NodeMode -> RootId
33 -> Cmd err [DbTreeNode]
34 findNodes' Private r = findNodes Private r [NodeFolderPrivate, NodeCorpus, NodeList]
35 findNodes' Shared r = findNodes Shared r [NodeFolderShared, NodeCorpus, NodeList]
36 findNodes' Public r = findNodes Public r [NodeFolderPublic, NodeCorpus, NodeList]