Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Przemyslaw Kaminski
haskell-gargantext
Commits
5e9336e4
Commit
5e9336e4
authored
Jan 31, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API][PAIRING] adding route to pair a corpus with an annuaire (need to note this in db)
parent
5a3ebd2c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
11 deletions
+25
-11
Node.hs
src/Gargantext/API/Node.hs
+19
-4
Table.hs
src/Gargantext/API/Table.hs
+3
-4
Pairing.hs
src/Gargantext/Database/Flow/Pairing.hs
+3
-3
No files found.
src/Gargantext/API/Node.hs
View file @
5e9336e4
...
...
@@ -57,6 +57,7 @@ import Gargantext.API.Types
import
Gargantext.Core.Types
(
NodeTableResult
)
import
Gargantext.Core.Types.Main
(
Tree
,
NodeTree
,
ListType
)
import
Gargantext.Database.Config
(
nodeTypeId
)
import
Gargantext.Database.Flow.Pairing
(
pairing
)
import
Gargantext.Database.Facet
(
FacetDoc
,
OrderBy
(
..
))
import
Gargantext.Database.Node.Children
(
getChildren
)
import
Gargantext.Database.Schema.Node
(
getNodesWithParentId
,
getNodeWith
,
getNode
,
deleteNode
,
deleteNodes
,
mkNodeWithParent
,
JSONB
,
HasNodeError
(
..
))
...
...
@@ -128,10 +129,11 @@ type NodeAPI a = Get '[JSON] (Node a)
-- TODO gather it
:<|>
"table"
:>
TableApi
:<|>
"ngrams"
:>
TableNgramsApi
:<|>
"pairing"
:>
PairingApi
:<|>
"category"
:>
CatApi
:<|>
"search"
:>
SearchDocsAPI
-- Pairing utilities
:<|>
"pairing"
:>
PairingApi
:<|>
"searchPair"
:>
SearchPairsAPI
-- VIZ
...
...
@@ -189,12 +191,12 @@ nodeAPI p uId id = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode i
-- TODO gather it
:<|>
tableApi
id
:<|>
apiNgramsTableCorpus
id
:<|>
getPairing
id
-- :<|> getTableNgramsDoc id
:<|>
catApi
id
:<|>
catApi
id
:<|>
searchDocs
id
-- Pairing Tools
:<|>
getPair
id
:<|>
searchPairs
id
:<|>
getScatter
id
...
...
@@ -256,6 +258,7 @@ catApi = putCat
------------------------------------------------------------------------
-- TODO adapt FacetDoc -> ListDoc (and add type of document as column)
-- Pairing utilities to move elsewhere
type
PairingApi
=
Summary
" Pairing API"
:>
QueryParam
"view"
TabType
-- TODO change TabType -> DocType (CorpusId for pairing)
...
...
@@ -264,6 +267,18 @@ type PairingApi = Summary " Pairing API"
:>
QueryParam
"order"
OrderBy
:>
Get
'[
J
SON
]
[
FacetDoc
]
----------
type
PairWith
=
Summary
"Pair a Corpus with an Annuaire"
:>
"annuaire"
:>
Capture
"annuaire_id"
AnnuaireId
:>
"list"
:>
Capture
"list_id"
ListId
:>
Post
'[
J
SON
]
Int
pairWith
::
CorpusId
->
GargServer
PairWith
pairWith
cId
aId
lId
=
do
r
<-
pairing
cId
aId
lId
pure
r
------------------------------------------------------------------------
type
ChartApi
=
Summary
" Chart API"
:>
QueryParam
"from"
UTCTime
...
...
src/Gargantext/API/Table.hs
View file @
5e9336e4
...
...
@@ -121,14 +121,13 @@ getTable' cId ft o l order =
(
Just
MoreTrash
)
->
moreLike
cId
o
l
order
IsTrash
x
->
panic
$
"not implemented in getTable: "
<>
(
cs
$
show
x
)
--{-
getPair
ing
::
ContactId
->
Maybe
TabType
getPair
::
ContactId
->
Maybe
TabType
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
Cmd
err
[
FacetDoc
]
getPair
ing
cId
ft
o
l
order
=
getPair
cId
ft
o
l
order
=
case
ft
of
(
Just
Docs
)
->
runViewAuthorsDoc
cId
False
o
l
order
(
Just
Trash
)
->
runViewAuthorsDoc
cId
True
o
l
order
_
->
panic
$
"not implemented: get Pairing"
<>
(
cs
$
show
ft
)
--}
src/Gargantext/Database/Flow/Pairing.hs
View file @
5e9336e4
...
...
@@ -52,11 +52,11 @@ pairing' = undefined
-}
-- | TODO : add paring policy as parameter
pairing
::
AnnuaireId
-- (AnnuaireId,
ListId) -- Pair (Either CorpusId AnnuaireId) ListId
->
CorpusId
-- (CorpusId,
ListId) -- Pair (Either CorpusId AnnuaireId) ListId
pairing
::
CorpusId
-- (CorpusId,
ListId) -- Pair (Either CorpusId AnnuaireId) ListId
->
AnnuaireId
-- (AnnuaireId,
ListId) -- Pair (Either CorpusId AnnuaireId) ListId
->
ListId
->
Cmd
err
Int
pairing
aId
c
Id
lId
=
do
pairing
cId
a
Id
lId
=
do
contacts'
<-
getAllContacts
aId
let
contactsMap
=
pairingPolicyToMap
toLower
$
toMaps
extractNgramsT
(
tr_docs
contacts'
)
...
...
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