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
1f9b9f14
Commit
1f9b9f14
authored
Jan 26, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] User Layout
parent
f126695c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
14 deletions
+43
-14
Contact.hs
src/Gargantext/API/Node/Contact.hs
+2
-2
Routes.hs
src/Gargantext/API/Routes.hs
+12
-4
Search.hs
src/Gargantext/API/Search.hs
+17
-6
Facet.hs
src/Gargantext/Database/Query/Facet.hs
+12
-2
No files found.
src/Gargantext/API/Node/Contact.hs
View file @
1f9b9f14
...
@@ -55,8 +55,8 @@ type API = "contact" :> Summary "Contact endpoint"
...
@@ -55,8 +55,8 @@ type API = "contact" :> Summary "Contact endpoint"
api
::
UserId
->
CorpusId
->
GargServer
API
api
::
UserId
->
CorpusId
->
GargServer
API
api
uid
cid
=
(
api_async
(
RootId
(
NodeId
uid
))
cid
)
api
uid
cid
=
(
api_async
(
RootId
(
NodeId
uid
))
cid
)
:<|>
(
nodeNodeAPI
(
Proxy
::
Proxy
HyperdataContact
)
uid
cid
)
:<|>
(
nodeNodeAPI
(
Proxy
::
Proxy
HyperdataContact
)
uid
cid
)
type
API_Async
=
AsyncJobs
JobLog
'[
J
SON
]
AddContactParams
JobLog
type
API_Async
=
AsyncJobs
JobLog
'[
J
SON
]
AddContactParams
JobLog
------------------------------------------------------------------------
------------------------------------------------------------------------
...
...
src/Gargantext/API/Routes.hs
View file @
1f9b9f14
...
@@ -95,10 +95,12 @@ type GargPrivateAPI' =
...
@@ -95,10 +95,12 @@ type GargPrivateAPI' =
:>
Capture
"node_id"
NodeId
:>
Capture
"node_id"
NodeId
:>
NodeAPI
HyperdataAny
:>
NodeAPI
HyperdataAny
--{-
-- Corpus endpoints
-- Corpus endpoints
:<|>
"corpus"
:>
Summary
"Corpus endpoint"
:<|>
"corpus"
:>
Summary
"Corpus endpoint"
:>
Capture
"corpus_id"
CorpusId
:>
Capture
"corpus_id"
CorpusId
:>
NodeAPI
HyperdataCorpus
:>
NodeAPI
HyperdataCorpus
--}
:<|>
"corpus"
:>
Summary
"Corpus endpoint"
:<|>
"corpus"
:>
Summary
"Corpus endpoint"
:>
Capture
"node1_id"
NodeId
:>
Capture
"node1_id"
NodeId
...
@@ -110,6 +112,12 @@ type GargPrivateAPI' =
...
@@ -110,6 +112,12 @@ type GargPrivateAPI' =
:>
Export
.
API
:>
Export
.
API
-- Annuaire endpoint
-- Annuaire endpoint
{-
:<|> "contact" :> Summary "Contact endpoint"
:> Capture "contact_id" ContactId
:> NodeAPI HyperdataContact
--}
:<|>
"annuaire"
:>
Summary
"Annuaire endpoint"
:<|>
"annuaire"
:>
Summary
"Annuaire endpoint"
:>
Capture
"annuaire_id"
AnnuaireId
:>
Capture
"annuaire_id"
AnnuaireId
:>
NodeAPI
HyperdataAnnuaire
:>
NodeAPI
HyperdataAnnuaire
...
@@ -117,7 +125,6 @@ type GargPrivateAPI' =
...
@@ -117,7 +125,6 @@ type GargPrivateAPI' =
:<|>
"annuaire"
:>
Summary
"Contact endpoint"
:<|>
"annuaire"
:>
Summary
"Contact endpoint"
:>
Capture
"annuaire_id"
NodeId
:>
Capture
"annuaire_id"
NodeId
:>
Contact
.
API
:>
Contact
.
API
-- Document endpoint
-- Document endpoint
:<|>
"document"
:>
Summary
"Document endpoint"
:<|>
"document"
:>
Summary
"Document endpoint"
:>
Capture
"doc_id"
DocId
:>
Capture
"doc_id"
DocId
...
@@ -158,11 +165,11 @@ type GargPrivateAPI' =
...
@@ -158,11 +165,11 @@ type GargPrivateAPI' =
:<|>
"lists"
:>
Summary
"List export API"
:<|>
"lists"
:>
Summary
"List export API"
:>
Capture
"listId"
ListId
:>
Capture
"listId"
ListId
:>
List
.
API
:>
List
.
API
{-
:<|> "wait" :> Summary "Wait test"
:<|> "wait" :> Summary "Wait test"
:> Capture "x" Int
:> Capture "x" Int
:> WaitAPI -- Get '[JSON] Int
:> WaitAPI -- Get '[JSON] Int
-}
-- /mv/<id>/<id>
-- /mv/<id>/<id>
-- /merge/<id>/<id>
-- /merge/<id>/<id>
-- /rename/<id>
-- /rename/<id>
...
@@ -207,6 +214,7 @@ serverPrivateGargAPI' (AuthenticatedUser (NodeId uid))
...
@@ -207,6 +214,7 @@ serverPrivateGargAPI' (AuthenticatedUser (NodeId uid))
:<|>
nodeAPI
(
Proxy
::
Proxy
HyperdataCorpus
)
uid
:<|>
nodeAPI
(
Proxy
::
Proxy
HyperdataCorpus
)
uid
:<|>
nodeNodeAPI
(
Proxy
::
Proxy
HyperdataAny
)
uid
:<|>
nodeNodeAPI
(
Proxy
::
Proxy
HyperdataAny
)
uid
:<|>
Export
.
getCorpus
-- uid
:<|>
Export
.
getCorpus
-- uid
-- :<|> nodeAPI (Proxy :: Proxy HyperdataContact) uid
:<|>
nodeAPI
(
Proxy
::
Proxy
HyperdataAnnuaire
)
uid
:<|>
nodeAPI
(
Proxy
::
Proxy
HyperdataAnnuaire
)
uid
:<|>
Contact
.
api
uid
:<|>
Contact
.
api
uid
...
@@ -232,7 +240,7 @@ serverPrivateGargAPI' (AuthenticatedUser (NodeId uid))
...
@@ -232,7 +240,7 @@ serverPrivateGargAPI' (AuthenticatedUser (NodeId uid))
-- :<|> New.api uid -- TODO-SECURITY
-- :<|> New.api uid -- TODO-SECURITY
-- :<|> New.info uid -- TODO-SECURITY
-- :<|> New.info uid -- TODO-SECURITY
:<|>
List
.
api
:<|>
List
.
api
:<|>
waitAPI
--
:<|> waitAPI
----------------------------------------------------------------------
----------------------------------------------------------------------
...
...
src/Gargantext/API/Search.hs
View file @
1f9b9f14
...
@@ -47,16 +47,25 @@ type API results = Summary "Search endpoint"
...
@@ -47,16 +47,25 @@ type API results = Summary "Search endpoint"
:>
QueryParam
"order"
OrderBy
:>
QueryParam
"order"
OrderBy
:>
Post
'[
J
SON
]
results
:>
Post
'[
J
SON
]
results
-----------------------------------------------------------------------
-----------------------------------------------------------------------
-- | Api search function
api
::
NodeId
->
GargServer
(
API
SearchResult
)
api
::
NodeId
->
GargServer
(
API
SearchResult
)
api
nId
(
SearchQuery
q
SearchDoc
)
o
l
order
=
api
nId
(
SearchQuery
q
SearchDoc
)
o
l
order
=
SearchResult
<$>
SearchResultDoc
<$>
map
toRow
<$>
searchInCorpus
nId
False
q
o
l
order
SearchResult
<$>
SearchResultDoc
<$>
map
(
toRow
nId
)
<$>
searchInCorpus
nId
False
q
o
l
order
api
nId
(
SearchQuery
q
SearchContact
)
o
l
order
=
do
api
nId
(
SearchQuery
q
SearchContact
)
o
l
order
=
do
printDebug
"isPairedWith"
nId
printDebug
"isPairedWith"
nId
aIds
<-
isPairedWith
nId
NodeAnnuaire
aIds
<-
isPairedWith
nId
NodeAnnuaire
-- TODO if paired with several corpus
-- TODO if paired with several corpus
case
head
aIds
of
case
head
aIds
of
Nothing
->
pure
$
SearchResult
$
SearchNoResult
"[G.A.Search] pair corpus with an Annuaire"
Nothing
->
pure
$
SearchResult
Just
aId
->
SearchResult
<$>
SearchResultContact
<$>
map
toRow
<$>
searchInCorpusWithContacts
nId
aId
q
o
l
order
$
SearchNoResult
"[G.A.Search] pair corpus with an Annuaire"
Just
aId
->
SearchResult
<$>
SearchResultContact
<$>
map
(
toRow
aId
)
<$>
searchInCorpusWithContacts
nId
aId
q
o
l
order
api
_
_
_
_
_
=
undefined
api
_
_
_
_
_
=
undefined
-----------------------------------------------------------------------
-----------------------------------------------------------------------
...
@@ -166,6 +175,7 @@ data Row =
...
@@ -166,6 +175,7 @@ data Row =
,
c_created
::
!
UTCTime
,
c_created
::
!
UTCTime
,
c_hyperdata
::
!
HyperdataRow
,
c_hyperdata
::
!
HyperdataRow
,
c_score
::
!
Int
,
c_score
::
!
Int
,
c_annuaireId
::
!
NodeId
}
}
deriving
(
Generic
)
deriving
(
Generic
)
...
@@ -187,16 +197,17 @@ instance ToSchema Row where
...
@@ -187,16 +197,17 @@ instance ToSchema Row where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
""
)
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
""
)
class
ToRow
a
where
class
ToRow
a
where
toRow
::
a
->
Row
toRow
::
NodeId
->
a
->
Row
instance
ToRow
FacetDoc
where
instance
ToRow
FacetDoc
where
toRow
(
FacetDoc
nId
utc
t
h
mc
_md
sc
)
=
Document
nId
utc
t
(
toHyperdataRow
h
)
(
fromMaybe
0
mc
)
(
round
$
fromMaybe
0
sc
)
toRow
_
(
FacetDoc
nId
utc
t
h
mc
_md
sc
)
=
Document
nId
utc
t
(
toHyperdataRow
h
)
(
fromMaybe
0
mc
)
(
round
$
fromMaybe
0
sc
)
-- | TODO rename FacetPaired
-- | TODO rename FacetPaired
type
FacetContact
=
FacetPaired
Int
UTCTime
HyperdataContact
Int
type
FacetContact
=
FacetPaired
Int
UTCTime
HyperdataContact
Int
instance
ToRow
FacetContact
where
instance
ToRow
FacetContact
where
toRow
(
FacetPaired
nId
utc
h
s
)
=
Contact
nId
utc
(
toHyperdataRow
h
)
s
toRow
annuaireId
(
FacetPaired
nId
utc
h
s
)
=
Contact
nId
utc
(
toHyperdataRow
h
)
s
annuaireId
--------------------------------------------------------------------
--------------------------------------------------------------------
...
...
src/Gargantext/Database/Query/Facet.hs
View file @
1f9b9f14
...
@@ -232,13 +232,23 @@ instance Arbitrary OrderBy
...
@@ -232,13 +232,23 @@ instance Arbitrary OrderBy
-- TODO-SECURITY check
-- TODO-SECURITY check
--{-
--{-
runViewAuthorsDoc
::
HasDBid
NodeType
=>
ContactId
->
IsTrash
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
Cmd
err
[
FacetDoc
]
runViewAuthorsDoc
::
HasDBid
NodeType
=>
ContactId
->
IsTrash
->
Maybe
Offset
->
Maybe
Limit
->
Maybe
OrderBy
->
Cmd
err
[
FacetDoc
]
runViewAuthorsDoc
cId
t
o
l
order
=
runOpaQuery
$
filterWith
o
l
order
$
viewAuthorsDoc
cId
t
ntId
runViewAuthorsDoc
cId
t
o
l
order
=
runOpaQuery
$
filterWith
o
l
order
$
viewAuthorsDoc
cId
t
ntId
where
where
ntId
=
NodeDocument
ntId
=
NodeDocument
-- TODO add delete ?
-- TODO add delete ?
viewAuthorsDoc
::
HasDBid
NodeType
=>
ContactId
->
IsTrash
->
NodeType
->
Query
FacetDocRead
viewAuthorsDoc
::
HasDBid
NodeType
=>
ContactId
->
IsTrash
->
NodeType
->
Query
FacetDocRead
viewAuthorsDoc
cId
_
nt
=
proc
()
->
do
viewAuthorsDoc
cId
_
nt
=
proc
()
->
do
(
doc
,(
_
,(
_
,(
_
,
contact'
))))
<-
queryAuthorsDoc
-<
()
(
doc
,(
_
,(
_
,(
_
,
contact'
))))
<-
queryAuthorsDoc
-<
()
...
...
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