Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
147
Issues
147
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
d89f060c
Commit
d89f060c
authored
Jun 18, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Community] Annuaire added, ok.
parent
af2155c3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
26 deletions
+45
-26
package.yaml
package.yaml
+3
-15
Main.hs
src/Gargantext/Core/Types/Main.hs
+5
-3
Node.hs
src/Gargantext/Core/Types/Node.hs
+1
-1
Database.hs
src/Gargantext/Database.hs
+29
-4
Node.hs
src/Gargantext/Database/Node.hs
+7
-3
No files found.
package.yaml
View file @
d89f060c
...
...
@@ -18,9 +18,9 @@ library:
ghc-options
:
-
-Wincomplete-uni-patterns
-
-Wincomplete-record-updates
-
-Wmissing-signatures
-
-Wunused-binds
-
-Wunused-imports
#
- -Wmissing-signatures
#
- -Wunused-binds
#
- -Wunused-imports
# - -Werror
exposed-modules
:
-
Gargantext
...
...
@@ -143,18 +143,6 @@ executables:
-
optparse-generic
-
unordered-containers
-
full-text-search
gargantext-workflow
:
main
:
Main.hs
source-dirs
:
app-workflow
ghc-options
:
-
-threaded
-
-rtsopts
-
-with-rtsopts=-N
-
-O2
-
-Wmissing-signatures
dependencies
:
-
base
-
gargantext
tests
:
garg-test
:
...
...
src/Gargantext/Core/Types/Main.hs
View file @
d89f060c
...
...
@@ -118,9 +118,11 @@ type Notebook = Node HyperdataNotebook
nodeTypes
::
[(
NodeType
,
NodeTypeId
)]
nodeTypes
=
[
(
NodeUser
,
1
)
,
(
Project
,
2
)
,
(
Corpus
,
3
)
,
(
Document
,
4
)
,
(
Folder
,
2
)
,
(
Corpus
,
30
)
,
(
Annuaire
,
31
)
,
(
Document
,
40
)
,
(
UserPage
,
41
)
--, (NodeSwap , 19)
------ Lists
-- , (StopList , 5)
...
...
src/Gargantext/Core/Types/Node.hs
View file @
d89f060c
...
...
@@ -236,7 +236,7 @@ type Corpus = Node HyperdataCorpus
type
Document
=
Node
HyperdataDocument
------------------------------------------------------------------------
data
NodeType
=
NodeUser
|
Project
|
Corpus
|
Document
|
DocumentCopy
data
NodeType
=
NodeUser
|
Project
|
Folder
|
Corpus
|
Annuaire
|
Document
|
UserPage
|
DocumentCopy
|
Classification
|
Lists
|
Metrics
|
Occurrences
...
...
src/Gargantext/Database.hs
View file @
d89f060c
...
...
@@ -63,6 +63,7 @@ module Gargantext.Database ( module Gargantext.Database.Utils
,
post
,
post'
,
del
,
del'
,
tree
,
tree'
,
postCorpus
,
postAnnuaire
)
where
...
...
@@ -72,7 +73,7 @@ import Gargantext.Database.Utils (connectGargandb)
import
Gargantext.Database.Node
import
Gargantext.Prelude
import
Database.PostgreSQL.Simple
(
Connection
)
import
Data.Text
(
Text
)
import
Data.Text
(
Text
,
pack
)
import
Opaleye
hiding
(
FromField
)
import
Data.Aeson
import
Data.ByteString
(
ByteString
)
...
...
@@ -160,12 +161,36 @@ post' = do
c
<-
connectGargandb
"gargantext.ini"
pid
<-
last
<$>
home
c
let
uid
=
1
postNode
c
uid
pid
(
Node'
Corpus
"Premier corpus"
"{}"
[
Node'
Document
"Doc1"
"{}"
[]
,
Node'
Document
"Doc2"
"{}"
[]
,
Node'
Document
"Doc3"
"{}"
[]
postNode
c
uid
pid
(
Node'
Corpus
(
pack
"Premier corpus"
)
(
toJSON
(
"{}"
::
Text
))
[
Node'
Document
(
pack
"Doc1"
)
(
toJSON
(
"{}"
::
Text
))
[]
,
Node'
Document
(
pack
"Doc2"
)
(
toJSON
(
pack
"{}"
::
Text
))
[]
,
Node'
Document
(
pack
"Doc3"
)
(
toJSON
(
"{}"
::
Text
))
[]
]
)
type
CorpusName
=
Text
postCorpus
::
ToJSON
a
=>
CorpusName
->
(
a
->
Text
)
->
[
a
]
->
IO
[
Int
]
postCorpus
corpusName
title
ns
=
do
c
<-
connectGargandb
"gargantext.ini"
pid
<-
last
<$>
home
c
let
uid
=
1
postNode
c
uid
pid
(
Node'
Corpus
corpusName
(
toJSON
(
"{}"
::
Text
))
(
map
(
\
n
->
Node'
Document
(
title
n
)
(
toJSON
n
)
[]
)
ns
)
)
-- |
-- import IMTClient as C
-- postAnnuaire "Annuaire IMT" (\n -> (maybe "" identity (C.prenom n)) <> " " <> (maybe "" identity (C.nom n))) (take 30 annuaire)
postAnnuaire
::
ToJSON
a
=>
CorpusName
->
(
a
->
Text
)
->
[
a
]
->
IO
[
Int
]
postAnnuaire
corpusName
title
ns
=
do
c
<-
connectGargandb
"gargantext.ini"
pid
<-
last
<$>
home
c
let
uid
=
1
postNode
c
uid
pid
(
Node'
Annuaire
corpusName
(
toJSON
(
"{}"
::
Text
))
(
map
(
\
n
->
Node'
UserPage
(
title
n
)
(
toJSON
n
)
[]
)
ns
)
)
del'
::
[
NodeId
]
->
IO
Int
del'
ns
=
do
...
...
src/Gargantext/Database/Node.hs
View file @
d89f060c
...
...
@@ -45,7 +45,7 @@ import Control.Arrow (returnA)
import
Control.Lens.TH
(
makeLensesWith
,
abbreviatedFields
)
import
Data.Aeson
import
Data.Maybe
(
Maybe
,
fromMaybe
)
import
Data.Text
(
Text
)
import
Data.Text
(
Text
,
pack
)
import
Data.Profunctor.Product.TH
(
makeAdaptorAndInstance
)
import
Data.Typeable
(
Typeable
)
...
...
@@ -288,7 +288,7 @@ post c uid pid [ Node' Corpus "name" "{}" []
node2table
::
UserId
->
ParentId
->
Node'
->
[
NodeWriteT
]
node2table
uid
pid
(
Node'
nt
txt
v
[]
)
=
[(
Nothing
,
(
pgInt4
$
nodeTypeId
nt
),
(
pgInt4
uid
),
(
pgInt4
pid
)
,
pgStrictText
txt
,
Nothing
,
pgStrictJSONB
$
DB
.
pack
$
DBL
.
unpack
$
encode
v
)]
node2table
_
_
(
Node'
_
_
_
_
)
=
panic
"node2table: should not happen, Tree insert not implemented yet"
node2table
_
_
(
Node'
_
_
_
_
)
=
panic
$
pack
"node2table: should not happen, Tree insert not implemented yet"
data
Node'
=
Node'
{
_n_type
::
NodeType
...
...
@@ -318,7 +318,11 @@ postNode c uid pid (Node' Corpus txt v ns) = do
[
pid'
]
<-
postNode
c
uid
pid
(
Node'
Corpus
txt
v
[]
)
pids
<-
mkNodeR'
c
$
concat
$
(
map
(
\
(
Node'
Document
txt
v
_
)
->
node2table
uid
pid'
$
Node'
Document
txt
v
[]
)
ns
)
pure
(
pids
)
postNode
c
uid
pid
(
Node'
_
_
_
_
)
=
panic
"postNode for this type not implemented yet"
postNode
c
uid
pid
(
Node'
Annuaire
txt
v
ns
)
=
do
[
pid'
]
<-
postNode
c
uid
pid
(
Node'
Annuaire
txt
v
[]
)
pids
<-
mkNodeR'
c
$
concat
$
(
map
(
\
(
Node'
UserPage
txt
v
_
)
->
node2table
uid
pid'
$
Node'
UserPage
txt
v
[]
)
ns
)
pure
(
pids
)
postNode
c
uid
pid
(
Node'
_
_
_
_
)
=
panic
$
pack
"postNode for this type not implemented yet"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment