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
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
37fb1b8c
Commit
37fb1b8c
authored
Jun 17, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] update backend (WIP)
parent
cc45f765
Pipeline
#885
failed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
3 deletions
+110
-3
Node.hs
src/Gargantext/API/Node.hs
+6
-3
Update.hs
src/Gargantext/API/Node/Update.hs
+104
-0
No files found.
src/Gargantext/API/Node.hs
View file @
37fb1b8c
...
...
@@ -42,7 +42,9 @@ import Gargantext.API.Metrics
import
Gargantext.API.Ngrams
(
TabType
(
..
),
TableNgramsApi
,
apiNgramsTableCorpus
,
QueryParamR
)
import
Gargantext.API.Ngrams.NTree
(
MyTree
)
import
Gargantext.API.Node.New
import
qualified
Gargantext.API.Node.Share
as
Share
import
qualified
Gargantext.API.Node.Share
as
Share
import
qualified
Gargantext.API.Node.Update
as
Update
import
Gargantext.API.Search
(
SearchDocsAPI
,
searchDocs
,
SearchPairsAPI
,
searchPairs
)
import
Gargantext.API.Table
import
Gargantext.Core.Types
(
NodeTableResult
)
...
...
@@ -126,6 +128,7 @@ type NodeAPI a = Get '[JSON] (Node a)
:<|>
"table"
:>
TableApi
:<|>
"ngrams"
:>
TableNgramsApi
:<|>
"update"
:>
Update
.
API
:<|>
"category"
:>
CatApi
:<|>
"search"
:>
SearchDocsAPI
:<|>
"share"
:>
Share
.
API
...
...
@@ -199,9 +202,9 @@ nodeAPI p uId id' = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode
-- TODO gather it
:<|>
tableApi
id'
:<|>
apiNgramsTableCorpus
id'
:<|>
Update
.
api
id'
:<|>
catApi
id'
:<|>
searchDocs
id'
:<|>
Share
.
api
id'
-- Pairing Tools
...
...
src/Gargantext/API/Node/Update.hs
0 → 100644
View file @
37fb1b8c
{-|
Module : Gargantext.API.Node.Update
Description :
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module
Gargantext.API.Node.Update
where
import
Prelude
(
Enum
,
Bounded
,
minBound
,
maxBound
)
import
Data.Aeson
import
Data.Swagger
import
GHC.Generics
(
Generic
)
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Prelude
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
(
..
))
import
Gargantext.Prelude
import
Servant
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck.Arbitrary
------------------------------------------------------------------------
data
UpdateNodeParams
=
UpdateNodeParamsList
{
methodList
::
Method
}
|
UpdateNodeParamsGraph
{
methodGraph
::
Metric
}
|
UpdateNodeParamsTexts
{
methodTexts
::
Granularity
}
|
UpdateNodeParamsBoard
{
methodBoard
::
Charts
}
deriving
(
Generic
)
----------------------------------------------------------------------
data
Method
=
Basic
|
Advanced
|
WithModel
deriving
(
Generic
,
Eq
,
Ord
,
Enum
,
Bounded
)
----------------------------------------------------------------------
data
Metric
=
Order1
|
Order2
deriving
(
Generic
,
Eq
,
Ord
,
Enum
,
Bounded
)
----------------------------------------------------------------------
data
Granularity
=
NewNgrams
|
NewTexts
|
Both
deriving
(
Generic
,
Eq
,
Ord
,
Enum
,
Bounded
)
----------------------------------------------------------------------
data
Charts
=
Sources
|
Authors
|
Institutes
|
Ngrams
|
All
deriving
(
Generic
,
Eq
,
Ord
,
Enum
,
Bounded
)
------------------------------------------------------------------------
-- TODO unPrefix "pn_" FromJSON, ToJSON, ToSchema, adapt frontend.
instance
FromJSON
UpdateNodeParams
instance
ToJSON
UpdateNodeParams
instance
ToSchema
UpdateNodeParams
instance
Arbitrary
UpdateNodeParams
where
arbitrary
=
do
l
<-
UpdateNodeParamsList
<$>
arbitrary
g
<-
UpdateNodeParamsGraph
<$>
arbitrary
t
<-
UpdateNodeParamsTexts
<$>
arbitrary
b
<-
UpdateNodeParamsBoard
<$>
arbitrary
elements
[
l
,
g
,
t
,
b
]
instance
FromJSON
Method
instance
ToJSON
Method
instance
ToSchema
Method
instance
Arbitrary
Method
where
arbitrary
=
elements
[
minBound
..
maxBound
]
instance
FromJSON
Metric
instance
ToJSON
Metric
instance
ToSchema
Metric
instance
Arbitrary
Metric
where
arbitrary
=
elements
[
minBound
..
maxBound
]
instance
FromJSON
Granularity
instance
ToJSON
Granularity
instance
ToSchema
Granularity
instance
Arbitrary
Granularity
where
arbitrary
=
elements
[
minBound
..
maxBound
]
instance
FromJSON
Charts
instance
ToJSON
Charts
instance
ToSchema
Charts
instance
Arbitrary
Charts
where
arbitrary
=
elements
[
minBound
..
maxBound
]
------------------------------------------------------------------------
api
::
HasNodeError
err
=>
NodeId
->
UpdateNodeParams
->
Cmd
err
Int
api
_nId
(
UpdateNodeParamsList
_meth
)
=
pure
1
api
_nId
(
UpdateNodeParamsGraph
_meth
)
=
pure
1
api
_nId
(
UpdateNodeParamsTexts
_meth
)
=
pure
1
api
_nId
(
UpdateNodeParamsBoard
_meth
)
=
pure
1
------------------------------------------------------------------------
type
API
=
Summary
" Share Node with username"
:>
ReqBody
'[
J
SON
]
UpdateNodeParams
:>
Post
'[
J
SON
]
Int
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