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
158
Issues
158
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
677fed9b
Commit
677fed9b
authored
May 02, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API] PostNodeAsync funs, before refactoring
parent
00b915ee
Pipeline
#841
failed with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
42 deletions
+45
-42
Main.hs
bin/gargantext-init/Main.hs
+2
-1
API.hs
src/Gargantext/API.hs
+40
-41
Node.hs
src/Gargantext/API/Node.hs
+2
-0
New.hs
src/Gargantext/API/Node/Corpus/New.hs
+1
-0
No files found.
bin/gargantext-init/Main.hs
View file @
677fed9b
...
@@ -24,11 +24,12 @@ import Data.Maybe (Maybe(..))
...
@@ -24,11 +24,12 @@ import Data.Maybe (Maybe(..))
import
Gargantext.API.Admin.Settings
(
withDevEnv
,
runCmdDev
)
import
Gargantext.API.Admin.Settings
(
withDevEnv
,
runCmdDev
)
import
Gargantext.API.Admin.Types
(
GargError
)
import
Gargantext.API.Admin.Types
(
GargError
)
import
Gargantext.API.Node
()
-- instances
import
Gargantext.API.Node
()
-- instances
import
Gargantext.Core.Types.Individu
(
User
Id
,
User
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Database.Action.Flow
(
getOrMkRoot
,
getOrMk_RootWithCorpus
)
import
Gargantext.Database.Action.Flow
(
getOrMkRoot
,
getOrMk_RootWithCorpus
)
import
Gargantext.Database.Query.Table.Node
(
getOrMkList
)
import
Gargantext.Database.Query.Table.Node
(
getOrMkList
)
import
Gargantext.Database.Query.Table.User
(
insertUsersDemo
)
import
Gargantext.Database.Query.Table.User
(
insertUsersDemo
)
import
Gargantext.Database.Admin.Config
(
userMaster
,
corpusMasterName
)
import
Gargantext.Database.Admin.Config
(
userMaster
,
corpusMasterName
)
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Admin.Trigger.Init
(
initTriggers
)
import
Gargantext.Database.Admin.Trigger.Init
(
initTriggers
)
import
Gargantext.Database.Admin.Types.Node
(
CorpusId
,
RootId
,
HyperdataCorpus
,
ListId
)
import
Gargantext.Database.Admin.Types.Node
(
CorpusId
,
RootId
,
HyperdataCorpus
,
ListId
)
import
Gargantext.Database.Prelude
(
Cmd
,
)
import
Gargantext.Database.Prelude
(
Cmd
,
)
...
...
src/Gargantext/API.hs
View file @
677fed9b
...
@@ -70,6 +70,7 @@ import Gargantext.API.Admin.Types
...
@@ -70,6 +70,7 @@ import Gargantext.API.Admin.Types
import
Gargantext.API.Count
(
CountAPI
,
count
,
Query
)
import
Gargantext.API.Count
(
CountAPI
,
count
,
Query
)
import
Gargantext.API.Ngrams
(
HasRepo
(
..
),
HasRepoSaver
(
..
),
saveRepo
,
TableNgramsApi
,
apiNgramsTableDoc
)
import
Gargantext.API.Ngrams
(
HasRepo
(
..
),
HasRepoSaver
(
..
),
saveRepo
,
TableNgramsApi
,
apiNgramsTableDoc
)
import
Gargantext.API.Node
import
Gargantext.API.Node
import
qualified
Gargantext.API.Node.New
as
NodeNew
import
Gargantext.API.Search
(
SearchPairsAPI
,
searchPairs
)
import
Gargantext.API.Search
(
SearchPairsAPI
,
searchPairs
)
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Database.Query.Table.Node.Contact
(
HyperdataContact
)
import
Gargantext.Database.Query.Table.Node.Contact
(
HyperdataContact
)
...
@@ -411,47 +412,6 @@ serverPrivateGargAPI' (AuthenticatedUser (NodeId uid))
...
@@ -411,47 +412,6 @@ serverPrivateGargAPI' (AuthenticatedUser (NodeId uid))
:<|>
waitAPI
:<|>
waitAPI
addCorpusWithQuery
::
User
->
GargServer
New
.
AddWithQuery
addCorpusWithQuery
user
cid
=
serveJobsAPI
$
JobFunction
(
\
q
log
->
let
log'
x
=
do
printDebug
"addToCorpusWithQuery"
x
liftBase
$
log
x
in
New
.
addToCorpusWithQuery
user
cid
q
log'
)
{-
addWithFile :: GargServer New.AddWithFile
addWithFile cid i f =
serveJobsAPI $
JobFunction (\_i log -> New.addToCorpusWithFile cid i f (liftBase . log))
-}
addCorpusWithForm
::
User
->
GargServer
New
.
AddWithForm
addCorpusWithForm
user
cid
=
serveJobsAPI
$
JobFunction
(
\
i
log
->
let
log'
x
=
do
printDebug
"addToCorpusWithForm"
x
liftBase
$
log
x
in
New
.
addToCorpusWithForm
user
cid
i
log'
)
addAnnuaireWithForm
::
GargServer
Annuaire
.
AddWithForm
addAnnuaireWithForm
cid
=
serveJobsAPI
$
JobFunction
(
\
i
log
->
Annuaire
.
addToAnnuaireWithForm
cid
i
(
liftBase
.
log
))
{-
serverStatic :: Server (Get '[HTML] Html)
serverStatic = $(do
let path = "purescript-gargantext/dist/index.html"
Just s <- liftBase (fileTypeToFileTree (FileTypeFile path))
fileTreeToServer s
)
-}
---------------------------------------------------------------------
---------------------------------------------------------------------
--gargMock :: Server GargAPI
--gargMock :: Server GargAPI
--gargMock = mock apiGarg Proxy
--gargMock = mock apiGarg Proxy
...
@@ -537,4 +497,43 @@ startGargantextMock port = do
...
@@ -537,4 +497,43 @@ startGargantextMock port = do
-}
-}
----------------------------------------------------------------------
addCorpusWithQuery
::
User
->
GargServer
New
.
AddWithQuery
addCorpusWithQuery
user
cid
=
serveJobsAPI
$
JobFunction
(
\
q
log
->
let
log'
x
=
do
printDebug
"addToCorpusWithQuery"
x
liftBase
$
log
x
in
New
.
addToCorpusWithQuery
user
cid
q
log'
)
{-
addWithFile :: GargServer New.AddWithFile
addWithFile cid i f =
serveJobsAPI $
JobFunction (\_i log -> New.addToCorpusWithFile cid i f (liftBase . log))
-}
addCorpusWithForm
::
User
->
GargServer
New
.
AddWithForm
addCorpusWithForm
user
cid
=
serveJobsAPI
$
JobFunction
(
\
i
log
->
let
log'
x
=
do
printDebug
"addToCorpusWithForm"
x
liftBase
$
log
x
in
New
.
addToCorpusWithForm
user
cid
i
log'
)
addAnnuaireWithForm
::
GargServer
Annuaire
.
AddWithForm
addAnnuaireWithForm
cid
=
serveJobsAPI
$
JobFunction
(
\
i
log
->
Annuaire
.
addToAnnuaireWithForm
cid
i
(
liftBase
.
log
))
postNodeAsync
::
UserId
->
NodeId
->
GargServer
NodeNew
.
PostNodeAsync
postNodeAsync
uId
nId
=
serveJobsAPI
$
JobFunction
(
\
p
log
->
NodeNew
.
postNodeAsync
uId
nId
p
(
liftBase
.
log
))
src/Gargantext/API/Node.hs
View file @
677fed9b
...
@@ -121,6 +121,7 @@ roots = getNodesWithParentId Nothing
...
@@ -121,6 +121,7 @@ roots = getNodesWithParentId Nothing
type
NodeAPI
a
=
Get
'[
J
SON
]
(
Node
a
)
type
NodeAPI
a
=
Get
'[
J
SON
]
(
Node
a
)
:<|>
"rename"
:>
RenameApi
:<|>
"rename"
:>
RenameApi
:<|>
PostNodeApi
-- TODO move to children POST
:<|>
PostNodeApi
-- TODO move to children POST
-- :<|> PostNodeAsync
:<|>
ReqBody
'[
J
SON
]
a
:>
Put
'[
J
SON
]
Int
:<|>
ReqBody
'[
J
SON
]
a
:>
Put
'[
J
SON
]
Int
:<|>
Delete
'[
J
SON
]
Int
:<|>
Delete
'[
J
SON
]
Int
:<|>
"children"
:>
ChildrenApi
a
:<|>
"children"
:>
ChildrenApi
a
...
@@ -193,6 +194,7 @@ nodeAPI p uId id' = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode
...
@@ -193,6 +194,7 @@ nodeAPI p uId id' = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode
nodeAPI'
=
getNodeWith
id'
p
nodeAPI'
=
getNodeWith
id'
p
:<|>
rename
id'
:<|>
rename
id'
:<|>
postNode
uId
id'
:<|>
postNode
uId
id'
-- :<|> postNodeAsync uId id'
:<|>
putNode
id'
:<|>
putNode
id'
:<|>
deleteNodeApi
id'
:<|>
deleteNodeApi
id'
:<|>
getChildren
id'
p
:<|>
getChildren
id'
p
...
...
src/Gargantext/API/Node/Corpus/New.hs
View file @
677fed9b
...
@@ -202,6 +202,7 @@ type AddWithForm = Summary "Add with FormUrlEncoded to corpus endpoint"
...
@@ -202,6 +202,7 @@ type AddWithForm = Summary "Add with FormUrlEncoded to corpus endpoint"
:>
"async"
:>
"async"
:>
AsyncJobs
ScraperStatus
'[
F
ormUrlEncoded
]
WithForm
ScraperStatus
:>
AsyncJobs
ScraperStatus
'[
F
ormUrlEncoded
]
WithForm
ScraperStatus
------------------------------------------------------------------------
------------------------------------------------------------------------
-- TODO WithQuery also has a corpus id
-- TODO WithQuery also has a corpus id
addToCorpusWithQuery
::
FlowCmdM
env
err
m
addToCorpusWithQuery
::
FlowCmdM
env
err
m
...
...
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