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
f7a8e3d5
Commit
f7a8e3d5
authored
Jul 23, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API] Annuaire / contact done
parent
a53c3ad2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
17 deletions
+26
-17
List.hs
src/Gargantext/API/Ngrams/List.hs
+0
-3
Contact.hs
src/Gargantext/API/Node/Contact.hs
+23
-7
Routes.hs
src/Gargantext/API/Routes.hs
+3
-7
No files found.
src/Gargantext/API/Ngrams/List.hs
View file @
f7a8e3d5
...
...
@@ -55,7 +55,6 @@ instance ToJSON a => MimeRender HTML a where
mimeRender
_
=
encode
------------------------------------------------------------------------
get
::
RepoCmdM
env
err
m
=>
ListId
->
m
(
Headers
'[
H
eader
"Content-Disposition"
Text
]
NgramsList
)
get
lId
=
do
...
...
@@ -74,7 +73,6 @@ get' lId = fromList
<$>
mapM
(
getNgramsTableMap
lId
)
ngramsTypes
------------------------------------------------------------------------
-- TODO : purge list
post
::
FlowCmdM
env
err
m
=>
ListId
...
...
@@ -88,7 +86,6 @@ post l m = do
------------------------------------------------------------------------
------------------------------------------------------------------------
type
PostAPI
=
Summary
"Update List"
:>
"add"
:>
"form"
...
...
src/Gargantext/API/Node/Contact.hs
View file @
f7a8e3d5
...
...
@@ -9,10 +9,17 @@ Portability : POSIX
-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module
Gargantext.API.Node.Contact
where
...
...
@@ -24,13 +31,14 @@ import Data.Text (Text)
import
GHC.Generics
(
Generic
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
))
import
Gargantext.API.Admin.Settings
(
HasSettings
)
import
Gargantext.API.Node
import
Gargantext.API.Node.Corpus.New
(
AsyncJobs
)
import
Gargantext.API.Prelude
(
GargServer
,
simuLogs
)
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Database.Action.Flow
(
flow
)
import
Gargantext.Database.Action.Flow.Types
(
FlowCmdM
)
import
Gargantext.Database.Admin.Types.Hyperdata
(
HyperdataAnnuaire
(
..
))
import
Gargantext.Database.Admin.Types.Hyperdata
(
HyperdataAnnuaire
(
..
)
,
HyperdataContact
)
import
Gargantext.Database.Admin.Types.Hyperdata.Contact
(
hyperdataContact
)
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Prelude
((
$
),
liftBase
,
(
.
),
printDebug
,
pure
)
...
...
@@ -41,9 +49,17 @@ import Test.QuickCheck (elements)
import
Test.QuickCheck.Arbitrary
------------------------------------------------------------------------
type
API
=
Summary
" Add Contact to Annuaire"
:>
AsyncJobs
JobLog
'[
J
SON
]
AddContactParams
JobLog
type
API
=
"contact"
:>
Summary
"Contact endpoint"
:>
API_Async
:<|>
Capture
"contact_id"
NodeId
:>
NodeNodeAPI
HyperdataContact
api
::
UserId
->
CorpusId
->
GargServer
API
api
uid
cid
=
(
api_async
(
RootId
(
NodeId
uid
))
cid
)
:<|>
(
nodeNodeAPI
(
Proxy
::
Proxy
HyperdataContact
)
uid
cid
)
type
API_Async
=
AsyncJobs
JobLog
'[
J
SON
]
AddContactParams
JobLog
------------------------------------------------------------------------
data
AddContactParams
=
AddContactParams
{
firstname
::
!
Text
,
lastname
::
!
Text
}
|
AddContactParamsAdvanced
{
firstname
::
!
Text
...
...
@@ -53,8 +69,8 @@ data AddContactParams = AddContactParams { firstname :: !Text, lastname
deriving
(
Generic
)
----------------------------------------------------------------------
api
::
User
->
NodeId
->
GargServer
API
api
u
nId
=
api
_async
::
User
->
NodeId
->
GargServer
API_Async
api
_async
u
nId
=
serveJobsAPI
$
JobFunction
(
\
p
log
->
let
...
...
src/Gargantext/API/Routes.hs
View file @
f7a8e3d5
...
...
@@ -7,7 +7,6 @@ Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
...
...
@@ -51,7 +50,7 @@ import qualified Gargantext.API.Node.Corpus.Annuaire as Annuaire
import
qualified
Gargantext.API.Node.Corpus.Export
as
Export
import
qualified
Gargantext.API.Node.Corpus.New
as
New
import
qualified
Gargantext.API.Public
as
Public
import
qualified
Gargantext.API.Node.Contact
as
Contact
type
GargAPI
=
"api"
:>
Summary
"API "
:>
GargAPIVersion
-- | TODO :<|> Summary "Latest API" :> GargAPI'
...
...
@@ -116,9 +115,7 @@ type GargPrivateAPI' =
:<|>
"annuaire"
:>
Summary
"Contact endpoint"
:>
Capture
"annuaire_id"
NodeId
:>
"contact"
:>
Capture
"contact_id"
NodeId
:>
NodeNodeAPI
HyperdataContact
:>
Contact
.
API
-- Document endpoint
:<|>
"document"
:>
Summary
"Document endpoint"
...
...
@@ -208,7 +205,7 @@ serverPrivateGargAPI' (AuthenticatedUser (NodeId uid))
:<|>
nodeNodeAPI
(
Proxy
::
Proxy
HyperdataAny
)
uid
:<|>
Export
.
getCorpus
-- uid
:<|>
nodeAPI
(
Proxy
::
Proxy
HyperdataAnnuaire
)
uid
:<|>
nodeNodeAPI
(
Proxy
::
Proxy
HyperdataContact
)
uid
:<|>
Contact
.
api
uid
:<|>
withAccess
(
Proxy
::
Proxy
TableNgramsApi
)
Proxy
uid
<$>
PathNode
<*>
apiNgramsTableDoc
...
...
@@ -246,7 +243,6 @@ waitAPI n = do
pure
$
"Waited: "
<>
(
cs
$
show
n
)
----------------------------------------
addCorpusWithQuery
::
User
->
GargServer
New
.
AddWithQuery
addCorpusWithQuery
user
cid
=
serveJobsAPI
$
...
...
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