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
157
Issues
157
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
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
405a3082
Commit
405a3082
authored
Oct 30, 2023
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GargError -> BackendInternalError
parent
8a474bbb
Changes
45
Hide whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
285 additions
and
228 deletions
+285
-228
Main.hs
bin/gargantext-admin/Main.hs
+2
-2
Main.hs
bin/gargantext-import/Main.hs
+5
-5
Main.hs
bin/gargantext-init/Main.hs
+5
-5
Main.hs
bin/gargantext-invitations/Main.hs
+2
-2
gargantext.cabal
gargantext.cabal
+1
-0
Auth.hs
src/Gargantext/API/Admin/Auth.hs
+6
-5
EnvTypes.hs
src/Gargantext/API/Admin/EnvTypes.hs
+14
-13
Settings.hs
src/Gargantext/API/Admin/Settings.hs
+2
-1
PolicyCheck.hs
src/Gargantext/API/Auth/PolicyCheck.hs
+10
-10
Dev.hs
src/Gargantext/API/Dev.hs
+3
-2
Errors.hs
src/Gargantext/API/Errors.hs
+41
-4
Class.hs
src/Gargantext/API/Errors/Class.hs
+8
-0
Types.hs
src/Gargantext/API/Errors/Types.hs
+57
-2
GraphQL.hs
src/Gargantext/API/GraphQL.hs
+5
-4
AsyncTask.hs
src/Gargantext/API/GraphQL/AsyncTask.hs
+3
-2
Context.hs
src/Gargantext/API/GraphQL/Context.hs
+4
-3
PolicyCheck.hs
src/Gargantext/API/GraphQL/PolicyCheck.hs
+2
-2
Team.hs
src/Gargantext/API/GraphQL/Team.hs
+3
-2
Types.hs
src/Gargantext/API/GraphQL/Types.hs
+3
-2
Members.hs
src/Gargantext/API/Members.hs
+5
-4
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+6
-5
List.hs
src/Gargantext/API/Ngrams/List.hs
+7
-5
Node.hs
src/Gargantext/API/Node.hs
+3
-2
Contact.hs
src/Gargantext/API/Node/Contact.hs
+6
-5
Searx.hs
src/Gargantext/API/Node/Corpus/Searx.hs
+3
-3
DocumentUpload.hs
src/Gargantext/API/Node/DocumentUpload.hs
+2
-1
DocumentsFromWriteNodes.hs
src/Gargantext/API/Node/DocumentsFromWriteNodes.hs
+4
-3
File.hs
src/Gargantext/API/Node/File.hs
+2
-1
FrameCalcUpload.hs
src/Gargantext/API/Node/FrameCalcUpload.hs
+2
-1
New.hs
src/Gargantext/API/Node/New.hs
+3
-2
Update.hs
src/Gargantext/API/Node/Update.hs
+3
-2
Prelude.hs
src/Gargantext/API/Prelude.hs
+9
-58
Routes.hs
src/Gargantext/API/Routes.hs
+6
-5
Server.hs
src/Gargantext/API/Server.hs
+3
-26
ThrowAll.hs
src/Gargantext/API/ThrowAll.hs
+2
-1
Types.hs
src/Gargantext/Core/Types.hs
+5
-5
API.hs
src/Gargantext/Core/Viz/Graph/API.hs
+4
-3
Flow.hs
src/Gargantext/Database/Action/Flow.hs
+7
-7
List.hs
src/Gargantext/Database/Action/Flow/List.hs
+5
-5
Types.hs
src/Gargantext/Database/Action/Flow/Types.hs
+2
-2
Error.hs
src/Gargantext/Database/Query/Table/Node/Error.hs
+2
-2
Jobs.hs
src/Gargantext/Utils/Jobs.hs
+4
-3
Setup.hs
test/Test/API/Setup.hs
+2
-1
Types.hs
test/Test/Database/Types.hs
+8
-7
Jobs.hs
test/Test/Utils/Jobs.hs
+4
-3
No files found.
bin/gargantext-admin/Main.hs
View file @
405a3082
...
@@ -16,7 +16,7 @@ Portability : POSIX
...
@@ -16,7 +16,7 @@ Portability : POSIX
module
Main
where
module
Main
where
import
Gargantext.API.Dev
(
withDevEnv
,
runCmdDev
)
import
Gargantext.API.Dev
(
withDevEnv
,
runCmdDev
)
import
Gargantext.API.
Prelude
(
GargError
)
import
Gargantext.API.
Errors.Types
import
Gargantext.Database.Action.User.New
(
newUsers
)
import
Gargantext.Database.Action.User.New
(
newUsers
)
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Prelude
(
Cmd
''
)
import
Gargantext.Database.Prelude
(
Cmd
''
)
...
@@ -28,6 +28,6 @@ main = do
...
@@ -28,6 +28,6 @@ main = do
(
iniPath
:
mails
)
<-
getArgs
(
iniPath
:
mails
)
<-
getArgs
withDevEnv
iniPath
$
\
env
->
do
withDevEnv
iniPath
$
\
env
->
do
x
<-
runCmdDev
env
((
newUsers
$
map
cs
mails
)
::
Cmd''
DevEnv
Garg
Error
[
UserId
])
x
<-
runCmdDev
env
((
newUsers
$
map
cs
mails
)
::
Cmd''
DevEnv
BackendInternal
Error
[
UserId
])
putStrLn
(
show
x
::
Text
)
putStrLn
(
show
x
::
Text
)
pure
()
pure
()
bin/gargantext-import/Main.hs
View file @
405a3082
...
@@ -20,8 +20,8 @@ import qualified Data.Text as Text
...
@@ -20,8 +20,8 @@ import qualified Data.Text as Text
import
Gargantext.API.Dev
(
withDevEnv
,
runCmdGargDev
)
import
Gargantext.API.Dev
(
withDevEnv
,
runCmdGargDev
)
import
Gargantext.API.Admin.EnvTypes
(
DevEnv
(
..
),
DevJobHandle
(
..
))
import
Gargantext.API.Admin.EnvTypes
(
DevEnv
(
..
),
DevJobHandle
(
..
))
import
Gargantext.API.Errors.Types
import
Gargantext.API.Node
()
-- instances
import
Gargantext.API.Node
()
-- instances
import
Gargantext.API.Prelude
(
GargError
)
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Query
(
Limit
)
import
Gargantext.Core.Types.Query
(
Limit
)
...
@@ -45,17 +45,17 @@ main = do
...
@@ -45,17 +45,17 @@ main = do
limit'
=
case
(
readMaybe
limit
::
Maybe
Limit
)
of
limit'
=
case
(
readMaybe
limit
::
Maybe
Limit
)
of
Nothing
->
panic
$
"Cannot read limit: "
<>
(
Text
.
pack
limit
)
Nothing
->
panic
$
"Cannot read limit: "
<>
(
Text
.
pack
limit
)
Just
l
->
l
Just
l
->
l
corpus
::
forall
m
.
(
FlowCmdM
DevEnv
Garg
Error
m
,
MonadJobStatus
m
,
JobHandle
m
~
DevJobHandle
)
=>
m
CorpusId
corpus
::
forall
m
.
(
FlowCmdM
DevEnv
BackendInternal
Error
m
,
MonadJobStatus
m
,
JobHandle
m
~
DevJobHandle
)
=>
m
CorpusId
corpus
=
flowCorpusFile
(
UserName
$
cs
user
)
(
Left
(
cs
name
::
Text
))
limit'
tt
format
Plain
corpusPath
Nothing
DevJobHandle
corpus
=
flowCorpusFile
(
UserName
$
cs
user
)
(
Left
(
cs
name
::
Text
))
limit'
tt
format
Plain
corpusPath
Nothing
DevJobHandle
corpusCsvHal
::
forall
m
.
(
FlowCmdM
DevEnv
Garg
Error
m
,
MonadJobStatus
m
,
JobHandle
m
~
DevJobHandle
)
=>
m
CorpusId
corpusCsvHal
::
forall
m
.
(
FlowCmdM
DevEnv
BackendInternal
Error
m
,
MonadJobStatus
m
,
JobHandle
m
~
DevJobHandle
)
=>
m
CorpusId
corpusCsvHal
=
flowCorpusFile
(
UserName
$
cs
user
)
(
Left
(
cs
name
::
Text
))
limit'
tt
CsvHal
Plain
corpusPath
Nothing
DevJobHandle
corpusCsvHal
=
flowCorpusFile
(
UserName
$
cs
user
)
(
Left
(
cs
name
::
Text
))
limit'
tt
CsvHal
Plain
corpusPath
Nothing
DevJobHandle
annuaire
::
forall
m
.
(
FlowCmdM
DevEnv
Garg
Error
m
,
MonadJobStatus
m
,
JobHandle
m
~
DevJobHandle
)
=>
m
CorpusId
annuaire
::
forall
m
.
(
FlowCmdM
DevEnv
BackendInternal
Error
m
,
MonadJobStatus
m
,
JobHandle
m
~
DevJobHandle
)
=>
m
CorpusId
annuaire
=
flowAnnuaire
(
UserName
$
cs
user
)
(
Left
"Annuaire"
)
(
Multi
EN
)
corpusPath
DevJobHandle
annuaire
=
flowAnnuaire
(
UserName
$
cs
user
)
(
Left
"Annuaire"
)
(
Multi
EN
)
corpusPath
DevJobHandle
{-
{-
let debatCorpus :: forall m. FlowCmdM DevEnv
Garg
Error m => m CorpusId
let debatCorpus :: forall m. FlowCmdM DevEnv
BackendInternal
Error m => m CorpusId
debatCorpus = do
debatCorpus = do
docs <- liftIO ( splitEvery 500
docs <- liftIO ( splitEvery 500
<$> take (read limit :: Int)
<$> take (read limit :: Int)
...
...
bin/gargantext-init/Main.hs
View file @
405a3082
...
@@ -16,8 +16,8 @@ Import a corpus binary.
...
@@ -16,8 +16,8 @@ Import a corpus binary.
module
Main
where
module
Main
where
import
Gargantext.API.Dev
(
withDevEnv
,
runCmdDev
)
import
Gargantext.API.Dev
(
withDevEnv
,
runCmdDev
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.Node
()
-- instances only
import
Gargantext.API.Node
()
-- instances only
import
Gargantext.API.Prelude
(
GargError
)
import
Gargantext.Core.Types.Individu
(
User
(
..
),
arbitraryNewUsers
,
NewUser
(
..
),
arbitraryUsername
,
GargPassword
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
),
arbitraryNewUsers
,
NewUser
(
..
),
arbitraryUsername
,
GargPassword
(
..
))
import
Gargantext.Database.Action.Flow
(
getOrMkRoot
,
getOrMk_RootWithCorpus
)
import
Gargantext.Database.Action.Flow
(
getOrMkRoot
,
getOrMk_RootWithCorpus
)
import
Gargantext.Database.Admin.Config
(
userMaster
,
corpusMasterName
)
import
Gargantext.Database.Admin.Config
(
userMaster
,
corpusMasterName
)
...
@@ -48,18 +48,18 @@ main = do
...
@@ -48,18 +48,18 @@ main = do
cfg
<-
readConfig
iniPath
cfg
<-
readConfig
iniPath
let
secret
=
_gc_secretkey
cfg
let
secret
=
_gc_secretkey
cfg
let
createUsers
::
Cmd
Garg
Error
Int64
let
createUsers
::
Cmd
BackendInternal
Error
Int64
createUsers
=
insertNewUsers
(
NewUser
"gargantua"
(
cs
email
)
(
GargPassword
$
cs
password
)
createUsers
=
insertNewUsers
(
NewUser
"gargantua"
(
cs
email
)
(
GargPassword
$
cs
password
)
:
arbitraryNewUsers
:
arbitraryNewUsers
)
)
let
let
mkRoots
::
Cmd
Garg
Error
[(
UserId
,
RootId
)]
mkRoots
::
Cmd
BackendInternal
Error
[(
UserId
,
RootId
)]
mkRoots
=
mapM
getOrMkRoot
$
map
UserName
(
"gargantua"
:
arbitraryUsername
)
mkRoots
=
mapM
getOrMkRoot
$
map
UserName
(
"gargantua"
:
arbitraryUsername
)
-- TODO create all users roots
-- TODO create all users roots
let
let
initMaster
::
Cmd
Garg
Error
(
UserId
,
RootId
,
CorpusId
,
ListId
)
initMaster
::
Cmd
BackendInternal
Error
(
UserId
,
RootId
,
CorpusId
,
ListId
)
initMaster
=
do
initMaster
=
do
(
masterUserId
,
masterRootId
,
masterCorpusId
)
(
masterUserId
,
masterRootId
,
masterCorpusId
)
<-
getOrMk_RootWithCorpus
(
UserName
userMaster
)
<-
getOrMk_RootWithCorpus
(
UserName
userMaster
)
...
@@ -70,7 +70,7 @@ main = do
...
@@ -70,7 +70,7 @@ main = do
pure
(
masterUserId
,
masterRootId
,
masterCorpusId
,
masterListId
)
pure
(
masterUserId
,
masterRootId
,
masterCorpusId
,
masterListId
)
withDevEnv
iniPath
$
\
env
->
do
withDevEnv
iniPath
$
\
env
->
do
_
<-
runCmdDev
env
(
initFirstTriggers
secret
::
DBCmd
Garg
Error
[
Int64
])
_
<-
runCmdDev
env
(
initFirstTriggers
secret
::
DBCmd
BackendInternal
Error
[
Int64
])
_
<-
runCmdDev
env
createUsers
_
<-
runCmdDev
env
createUsers
x
<-
runCmdDev
env
initMaster
x
<-
runCmdDev
env
initMaster
_
<-
runCmdDev
env
mkRoots
_
<-
runCmdDev
env
mkRoots
...
...
bin/gargantext-invitations/Main.hs
View file @
405a3082
...
@@ -16,7 +16,7 @@ module Main where
...
@@ -16,7 +16,7 @@ module Main where
import
Gargantext.API.Dev
(
withDevEnv
,
runCmdDev
)
import
Gargantext.API.Dev
(
withDevEnv
,
runCmdDev
)
import
Gargantext.API.Node
()
-- instances only
import
Gargantext.API.Node
()
-- instances only
import
Gargantext.API.
Prelude
(
GargError
)
import
Gargantext.API.
Errors.Types
import
Gargantext.Core.NLP
(
HasNLPServer
)
import
Gargantext.Core.NLP
(
HasNLPServer
)
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Admin.Types.Node
...
@@ -36,7 +36,7 @@ main = do
...
@@ -36,7 +36,7 @@ main = do
_cfg
<-
readConfig
iniPath
_cfg
<-
readConfig
iniPath
let
invite
::
(
CmdRandom
env
Garg
Error
m
,
HasNLPServer
env
)
=>
m
Int
let
invite
::
(
CmdRandom
env
BackendInternal
Error
m
,
HasNLPServer
env
)
=>
m
Int
invite
=
Share
.
api
(
UserName
$
cs
user
)
(
UnsafeMkNodeId
$
(
read
node_id
::
Int
))
(
Share
.
ShareTeamParams
$
cs
email
)
invite
=
Share
.
api
(
UserName
$
cs
user
)
(
UnsafeMkNodeId
$
(
read
node_id
::
Int
))
(
Share
.
ShareTeamParams
$
cs
email
)
withDevEnv
iniPath
$
\
env
->
do
withDevEnv
iniPath
$
\
env
->
do
...
...
gargantext.cabal
View file @
405a3082
...
@@ -52,6 +52,7 @@ library
...
@@ -52,6 +52,7 @@ library
Gargantext.API.Auth.PolicyCheck
Gargantext.API.Auth.PolicyCheck
Gargantext.API.Dev
Gargantext.API.Dev
Gargantext.API.Errors
Gargantext.API.Errors
Gargantext.API.Errors.Class
Gargantext.API.Errors.Types
Gargantext.API.Errors.Types
Gargantext.API.HashedResponse
Gargantext.API.HashedResponse
Gargantext.API.Ngrams
Gargantext.API.Ngrams
...
...
src/Gargantext/API/Admin/Auth.hs
View file @
405a3082
...
@@ -53,7 +53,7 @@ import Gargantext.API.Admin.EnvTypes (GargJob(..), Env)
...
@@ -53,7 +53,7 @@ import Gargantext.API.Admin.EnvTypes (GargJob(..), Env)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Types
import
Gargantext.API.Admin.Types
import
Gargantext.API.Auth.PolicyCheck
import
Gargantext.API.Auth.PolicyCheck
import
Gargantext.API.Prelude
(
HasJoseError
(
..
),
joseError
,
HasServerError
,
GargServerC
,
GargServer
,
_ServerError
,
GargM
,
GargError
(
..
)
)
import
Gargantext.API.Prelude
(
joseError
,
HasServerError
,
GargServerC
,
GargServer
,
_ServerError
,
GargM
)
import
Gargantext.Core.Mail
(
MailModel
(
..
),
mail
)
import
Gargantext.Core.Mail
(
MailModel
(
..
),
mail
)
import
Gargantext.Core.Mail.Types
(
mailSettings
)
import
Gargantext.Core.Mail.Types
(
mailSettings
)
import
Gargantext.Core.Types.Individu
(
User
(
..
),
Username
,
GargPassword
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
),
Username
,
GargPassword
(
..
))
...
@@ -72,6 +72,7 @@ import Gargantext.Prelude.Crypto.Pass.User (gargPass)
...
@@ -72,6 +72,7 @@ import Gargantext.Prelude.Crypto.Pass.User (gargPass)
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
))
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
))
import
Servant
import
Servant
import
Servant.Auth.Server
import
Servant.Auth.Server
import
Gargantext.API.Errors
---------------------------------------------------
---------------------------------------------------
...
@@ -163,7 +164,7 @@ withAccess p _ ur id = hoistServer p f
...
@@ -163,7 +164,7 @@ withAccess p _ ur id = hoistServer p f
-- | Given the 'AuthenticatedUser', a policy check and a function that returns an @a@,
-- | Given the 'AuthenticatedUser', a policy check and a function that returns an @a@,
-- it runs the underlying policy check to ensure that the resource is returned only to
-- it runs the underlying policy check to ensure that the resource is returned only to
-- who is entitled to see it.
-- who is entitled to see it.
withPolicy
::
GargServerC
env
Garg
Error
m
withPolicy
::
GargServerC
env
BackendInternal
Error
m
=>
AuthenticatedUser
=>
AuthenticatedUser
->
BoolExpr
AccessCheck
->
BoolExpr
AccessCheck
->
m
a
->
m
a
...
@@ -174,10 +175,10 @@ withPolicy ur checks m mgr = case mgr of
...
@@ -174,10 +175,10 @@ withPolicy ur checks m mgr = case mgr of
res
<-
runAccessPolicy
ur
checks
res
<-
runAccessPolicy
ur
checks
case
res
of
case
res
of
Allow
->
m
Allow
->
m
Deny
err
->
throwError
$
Garg
ServerError
$
err
Deny
err
->
throwError
$
Internal
ServerError
$
err
withPolicyT
::
forall
env
m
api
.
(
withPolicyT
::
forall
env
m
api
.
(
GargServerC
env
Garg
Error
m
GargServerC
env
BackendInternal
Error
m
,
HasServer
api
'[
]
,
HasServer
api
'[
]
)
)
=>
Proxy
api
=>
Proxy
api
...
@@ -309,7 +310,7 @@ generateForgotPasswordUUID = do
...
@@ -309,7 +310,7 @@ generateForgotPasswordUUID = do
type
ForgotPasswordAsyncAPI
=
Summary
"Forgot password asnc"
type
ForgotPasswordAsyncAPI
=
Summary
"Forgot password asnc"
:>
AsyncJobs
JobLog
'[
J
SON
]
ForgotPasswordAsyncParams
JobLog
:>
AsyncJobs
JobLog
'[
J
SON
]
ForgotPasswordAsyncParams
JobLog
forgotPasswordAsync
::
ServerT
ForgotPasswordAsyncAPI
(
GargM
Env
Garg
Error
)
forgotPasswordAsync
::
ServerT
ForgotPasswordAsyncAPI
(
GargM
Env
BackendInternal
Error
)
forgotPasswordAsync
=
forgotPasswordAsync
=
serveJobsAPI
ForgotPasswordJob
$
\
jHandle
p
->
forgotPasswordAsync'
p
jHandle
serveJobsAPI
ForgotPasswordJob
$
\
jHandle
p
->
forgotPasswordAsync'
p
jHandle
...
...
src/Gargantext/API/Admin/EnvTypes.hs
View file @
405a3082
...
@@ -32,8 +32,9 @@ import Data.Text qualified as T
...
@@ -32,8 +32,9 @@ import Data.Text qualified as T
import
Database.PostgreSQL.Simple
(
Connection
)
import
Database.PostgreSQL.Simple
(
Connection
)
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Admin.Types
import
Gargantext.API.Admin.Types
import
Gargantext.API.Errors.Types
import
Gargantext.API.Job
import
Gargantext.API.Job
import
Gargantext.API.Prelude
(
GargM
,
GargError
)
import
Gargantext.API.Prelude
(
GargM
)
import
Gargantext.Core.Mail.Types
(
HasMail
,
mailSettings
)
import
Gargantext.Core.Mail.Types
(
HasMail
,
mailSettings
)
import
Gargantext.Core.NLP
(
NLPServerMap
,
HasNLPServer
(
..
))
import
Gargantext.Core.NLP
(
NLPServerMap
,
HasNLPServer
(
..
))
import
Gargantext.Core.NodeStory
import
Gargantext.Core.NodeStory
...
@@ -64,17 +65,17 @@ modeToLoggingLevels = \case
...
@@ -64,17 +65,17 @@ modeToLoggingLevels = \case
-- For production, accepts everything but DEBUG.
-- For production, accepts everything but DEBUG.
Prod
->
[
minBound
..
maxBound
]
\\
[
DEBUG
]
Prod
->
[
minBound
..
maxBound
]
\\
[
DEBUG
]
instance
MonadLogger
(
GargM
Env
Garg
Error
)
where
instance
MonadLogger
(
GargM
Env
BackendInternal
Error
)
where
getLogger
=
asks
_env_logger
getLogger
=
asks
_env_logger
instance
HasLogger
(
GargM
Env
Garg
Error
)
where
instance
HasLogger
(
GargM
Env
BackendInternal
Error
)
where
data
instance
Logger
(
GargM
Env
Garg
Error
)
=
data
instance
Logger
(
GargM
Env
BackendInternal
Error
)
=
GargLogger
{
GargLogger
{
logger_mode
::
Mode
logger_mode
::
Mode
,
logger_set
::
FL
.
LoggerSet
,
logger_set
::
FL
.
LoggerSet
}
}
type
instance
LogInitParams
(
GargM
Env
Garg
Error
)
=
Mode
type
instance
LogInitParams
(
GargM
Env
BackendInternal
Error
)
=
Mode
type
instance
LogPayload
(
GargM
Env
Garg
Error
)
=
FL
.
LogStr
type
instance
LogPayload
(
GargM
Env
BackendInternal
Error
)
=
FL
.
LogStr
initLogger
=
\
mode
->
do
initLogger
=
\
mode
->
do
logger_set
<-
liftIO
$
FL
.
newStderrLoggerSet
FL
.
defaultBufSize
logger_set
<-
liftIO
$
FL
.
newStderrLoggerSet
FL
.
defaultBufSize
pure
$
GargLogger
mode
logger_set
pure
$
GargLogger
mode
logger_set
...
@@ -111,7 +112,7 @@ data GargJob
...
@@ -111,7 +112,7 @@ data GargJob
-- we need to remember to force the fields to WHNF at that point.
-- we need to remember to force the fields to WHNF at that point.
data
Env
=
Env
data
Env
=
Env
{
_env_settings
::
~
Settings
{
_env_settings
::
~
Settings
,
_env_logger
::
~
(
Logger
(
GargM
Env
Garg
Error
))
,
_env_logger
::
~
(
Logger
(
GargM
Env
BackendInternal
Error
))
,
_env_pool
::
~
(
Pool
Connection
)
,
_env_pool
::
~
(
Pool
Connection
)
,
_env_nodeStory
::
~
NodeStoryEnv
,
_env_nodeStory
::
~
NodeStoryEnv
,
_env_manager
::
~
Manager
,
_env_manager
::
~
Manager
...
@@ -234,17 +235,17 @@ data MockEnv = MockEnv
...
@@ -234,17 +235,17 @@ data MockEnv = MockEnv
makeLenses
''
M
ockEnv
makeLenses
''
M
ockEnv
instance
MonadLogger
(
GargM
DevEnv
Garg
Error
)
where
instance
MonadLogger
(
GargM
DevEnv
BackendInternal
Error
)
where
getLogger
=
asks
_dev_env_logger
getLogger
=
asks
_dev_env_logger
instance
HasLogger
(
GargM
DevEnv
Garg
Error
)
where
instance
HasLogger
(
GargM
DevEnv
BackendInternal
Error
)
where
data
instance
Logger
(
GargM
DevEnv
Garg
Error
)
=
data
instance
Logger
(
GargM
DevEnv
BackendInternal
Error
)
=
GargDevLogger
{
GargDevLogger
{
dev_logger_mode
::
Mode
dev_logger_mode
::
Mode
,
dev_logger_set
::
FL
.
LoggerSet
,
dev_logger_set
::
FL
.
LoggerSet
}
}
type
instance
LogInitParams
(
GargM
DevEnv
Garg
Error
)
=
Mode
type
instance
LogInitParams
(
GargM
DevEnv
BackendInternal
Error
)
=
Mode
type
instance
LogPayload
(
GargM
DevEnv
Garg
Error
)
=
FL
.
LogStr
type
instance
LogPayload
(
GargM
DevEnv
BackendInternal
Error
)
=
FL
.
LogStr
initLogger
=
\
mode
->
do
initLogger
=
\
mode
->
do
dev_logger_set
<-
liftIO
$
FL
.
newStderrLoggerSet
FL
.
defaultBufSize
dev_logger_set
<-
liftIO
$
FL
.
newStderrLoggerSet
FL
.
defaultBufSize
pure
$
GargDevLogger
mode
dev_logger_set
pure
$
GargDevLogger
mode
dev_logger_set
...
@@ -258,7 +259,7 @@ instance HasLogger (GargM DevEnv GargError) where
...
@@ -258,7 +259,7 @@ instance HasLogger (GargM DevEnv GargError) where
data
DevEnv
=
DevEnv
data
DevEnv
=
DevEnv
{
_dev_env_settings
::
!
Settings
{
_dev_env_settings
::
!
Settings
,
_dev_env_config
::
!
GargConfig
,
_dev_env_config
::
!
GargConfig
,
_dev_env_logger
::
!
(
Logger
(
GargM
DevEnv
Garg
Error
))
,
_dev_env_logger
::
!
(
Logger
(
GargM
DevEnv
BackendInternal
Error
))
,
_dev_env_pool
::
!
(
Pool
Connection
)
,
_dev_env_pool
::
!
(
Pool
Connection
)
,
_dev_env_nodeStory
::
!
NodeStoryEnv
,
_dev_env_nodeStory
::
!
NodeStoryEnv
,
_dev_env_mail
::
!
MailConfig
,
_dev_env_mail
::
!
MailConfig
...
...
src/Gargantext/API/Admin/Settings.hs
View file @
405a3082
...
@@ -28,6 +28,7 @@ import Data.Pool (Pool, createPool)
...
@@ -28,6 +28,7 @@ import Data.Pool (Pool, createPool)
import
Database.PostgreSQL.Simple
(
Connection
,
connect
,
close
,
ConnectInfo
)
import
Database.PostgreSQL.Simple
(
Connection
,
connect
,
close
,
ConnectInfo
)
import
Gargantext.API.Admin.EnvTypes
import
Gargantext.API.Admin.EnvTypes
import
Gargantext.API.Admin.Types
import
Gargantext.API.Admin.Types
import
Gargantext.API.Errors.Types
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.Core.NLP
(
nlpServerMap
)
import
Gargantext.Core.NLP
(
nlpServerMap
)
import
Gargantext.Core.NodeStory
import
Gargantext.Core.NodeStory
...
@@ -171,7 +172,7 @@ readRepoEnv repoDir = do
...
@@ -171,7 +172,7 @@ readRepoEnv repoDir = do
devJwkFile
::
FilePath
devJwkFile
::
FilePath
devJwkFile
=
"dev.jwk"
devJwkFile
=
"dev.jwk"
newEnv
::
Logger
(
GargM
Env
Garg
Error
)
->
PortNumber
->
FilePath
->
IO
Env
newEnv
::
Logger
(
GargM
Env
BackendInternal
Error
)
->
PortNumber
->
FilePath
->
IO
Env
newEnv
logger
port
file
=
do
newEnv
logger
port
file
=
do
!
manager_env
<-
newTlsManager
!
manager_env
<-
newTlsManager
!
settings'
<-
devSettings
devJwkFile
<&>
appPort
.~
port
-- TODO read from 'file'
!
settings'
<-
devSettings
devJwkFile
<&>
appPort
.~
port
-- TODO read from 'file'
...
...
src/Gargantext/API/Auth/PolicyCheck.hs
View file @
405a3082
...
@@ -21,24 +21,24 @@ module Gargantext.API.Auth.PolicyCheck (
...
@@ -21,24 +21,24 @@ module Gargantext.API.Auth.PolicyCheck (
)
where
)
where
import
Control.Lens
import
Control.Lens
import
Control.Monad
import
Data.BoolExpr
import
Gargantext.API.Admin.Auth.Types
import
Gargantext.API.Admin.Auth.Types
import
Gargantext.API.Errors.Types
import
Gargantext.Core.Types
import
Gargantext.Core.Types
import
Gargantext.Core.Types.Individu
import
Gargantext.Database.Prelude
(
DBCmd
,
HasConfig
(
..
))
import
Gargantext.Database.Prelude
(
DBCmd
,
HasConfig
(
..
))
import
Gargantext.Database.Query.Table.Node.Error
import
Gargantext.Database.Query.Tree
import
Gargantext.Database.Query.Tree.Root
import
Gargantext.Prelude.Config
(
GargConfig
(
..
))
import
Gargantext.Prelude.Config
(
GargConfig
(
..
))
import
Prelude
import
Prelude
import
Servant
import
Servant
import
Servant.Auth.Server.Internal.AddSetCookie
import
Servant.Ekg
import
Servant.Ekg
import
Servant.Server.Internal.Delayed
import
Servant.Server.Internal.Delayed
import
Servant.Server.Internal.DelayedIO
import
Servant.Server.Internal.DelayedIO
import
qualified
Servant.Swagger
as
Swagger
import
qualified
Servant.Swagger
as
Swagger
import
Gargantext.Core.Types.Individu
import
Gargantext.Database.Query.Table.Node.Error
import
Data.BoolExpr
import
Control.Monad
import
Gargantext.API.Prelude
import
Servant.Auth.Server.Internal.AddSetCookie
import
Gargantext.Database.Query.Tree
import
Gargantext.Database.Query.Tree.Root
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Types
-- Types
...
@@ -66,7 +66,7 @@ instance Monoid AccessResult where
...
@@ -66,7 +66,7 @@ instance Monoid AccessResult where
-- | An access policy manager for gargantext that governs how resources are accessed
-- | An access policy manager for gargantext that governs how resources are accessed
-- and who is entitled to see what.
-- and who is entitled to see what.
data
AccessPolicyManager
=
AccessPolicyManager
data
AccessPolicyManager
=
AccessPolicyManager
{
runAccessPolicy
::
AuthenticatedUser
->
BoolExpr
AccessCheck
->
DBCmd
Garg
Error
AccessResult
}
{
runAccessPolicy
::
AuthenticatedUser
->
BoolExpr
AccessCheck
->
DBCmd
BackendInternal
Error
AccessResult
}
-- | A type representing all the possible access checks we might want to perform on a resource,
-- | A type representing all the possible access checks we might want to perform on a resource,
-- typically a 'Node'.
-- typically a 'Node'.
...
@@ -97,7 +97,7 @@ data AccessCheck
...
@@ -97,7 +97,7 @@ data AccessCheck
accessPolicyManager
::
AccessPolicyManager
accessPolicyManager
::
AccessPolicyManager
accessPolicyManager
=
AccessPolicyManager
(
\
ur
ac
->
interpretPolicy
ur
ac
)
accessPolicyManager
=
AccessPolicyManager
(
\
ur
ac
->
interpretPolicy
ur
ac
)
where
where
interpretPolicy
::
AuthenticatedUser
->
BoolExpr
AccessCheck
->
DBCmd
Garg
Error
AccessResult
interpretPolicy
::
AuthenticatedUser
->
BoolExpr
AccessCheck
->
DBCmd
BackendInternal
Error
AccessResult
interpretPolicy
ur
chk
=
case
chk
of
interpretPolicy
ur
chk
=
case
chk
of
BAnd
b1
b2
BAnd
b1
b2
->
liftM2
(
<>
)
(
interpretPolicy
ur
b1
)
(
interpretPolicy
ur
b2
)
->
liftM2
(
<>
)
(
interpretPolicy
ur
b1
)
(
interpretPolicy
ur
b2
)
...
...
src/Gargantext/API/Dev.hs
View file @
405a3082
...
@@ -15,6 +15,7 @@ module Gargantext.API.Dev where
...
@@ -15,6 +15,7 @@ module Gargantext.API.Dev where
import
Control.Monad
(
fail
)
import
Control.Monad
(
fail
)
import
Gargantext.API.Admin.EnvTypes
import
Gargantext.API.Admin.EnvTypes
import
Gargantext.API.Admin.Settings
import
Gargantext.API.Admin.Settings
import
Gargantext.API.Errors.Types
import
Gargantext.API.Ngrams
(
saveNodeStoryImmediate
)
import
Gargantext.API.Ngrams
(
saveNodeStoryImmediate
)
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.Core.NLP
(
nlpServerMap
)
import
Gargantext.Core.NLP
(
nlpServerMap
)
...
@@ -69,7 +70,7 @@ runCmdDev :: Show err => DevEnv -> Cmd'' DevEnv err a -> IO a
...
@@ -69,7 +70,7 @@ runCmdDev :: Show err => DevEnv -> Cmd'' DevEnv err a -> IO a
runCmdDev
env
f
=
runCmdDev
env
f
=
(
either
(
fail
.
show
)
pure
=<<
runCmd
env
f
)
(
either
(
fail
.
show
)
pure
=<<
runCmd
env
f
)
runCmdGargDev
::
DevEnv
->
GargM
DevEnv
Garg
Error
a
->
IO
a
runCmdGargDev
::
DevEnv
->
GargM
DevEnv
BackendInternal
Error
a
->
IO
a
runCmdGargDev
env
cmd
=
runCmdGargDev
env
cmd
=
(
either
(
fail
.
show
)
pure
=<<
runExceptT
(
runReaderT
cmd
env
))
(
either
(
fail
.
show
)
pure
=<<
runExceptT
(
runReaderT
cmd
env
))
`
finally
`
`
finally
`
...
@@ -81,5 +82,5 @@ runCmdDevNoErr = runCmdDev
...
@@ -81,5 +82,5 @@ runCmdDevNoErr = runCmdDev
runCmdDevServantErr
::
DevEnv
->
Cmd'
DevEnv
ServerError
a
->
IO
a
runCmdDevServantErr
::
DevEnv
->
Cmd'
DevEnv
ServerError
a
->
IO
a
runCmdDevServantErr
=
runCmdDev
runCmdDevServantErr
=
runCmdDev
runCmdReplEasy
::
Cmd''
DevEnv
Garg
Error
a
->
IO
a
runCmdReplEasy
::
Cmd''
DevEnv
BackendInternal
Error
a
->
IO
a
runCmdReplEasy
f
=
withDevEnv
"gargantext.ini"
$
\
env
->
runCmdDev
env
f
runCmdReplEasy
f
=
withDevEnv
"gargantext.ini"
$
\
env
->
runCmdDev
env
f
src/Gargantext/API/Errors.hs
View file @
405a3082
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE LambdaCase #-}
module
Gargantext.API.Errors
(
module
Gargantext.API.Errors
(
module
Types
module
Types
,
module
Class
-- * Conversion functions
-- * Conversion functions
,
backendErrorTypeToErrStatus
,
backendErrorToFrontendError
-- * Temporary shims
,
showAsServantJSONErr
)
where
)
where
import
Prelude
import
Gargantext.API.Errors.Class
as
Class
import
Gargantext.API.Errors.Types
as
Types
import
Gargantext.API.Errors.Types
as
Types
import
Gargantext.Database.Query.Table.Node.Error
import
Servant.Server
import
qualified
Data.Aeson
as
JSON
import
qualified
Network.HTTP.Types.Status
as
HTTP
import
qualified
Network.HTTP.Types.Status
as
HTTP
backendErrorTypeToErrStatus
::
BackendErrorType
->
HTTP
.
Status
_
backendErrorTypeToErrStatus
::
BackendErrorType
->
HTTP
.
Status
backendErrorTypeToErrStatus
=
\
case
_
backendErrorTypeToErrStatus
=
\
case
BE_phylo_corpus_not_ready
->
HTTP
.
status500
BE_phylo_corpus_not_ready
->
HTTP
.
status500
BE_node_not_found
->
HTTP
.
status500
BE_node_not_found
->
HTTP
.
status500
BE_tree_error_root_not_found
->
HTTP
.
status404
BE_tree_error_root_not_found
->
HTTP
.
status404
-- | Transforms a backend internal error into something that the frontend
-- can consume. This is the only representation we offer to the outside world,
-- as we later encode this into a 'ServerError' in the main server handler.
backendErrorToFrontendError
::
BackendInternalError
->
FrontendError
backendErrorToFrontendError
=
\
case
InternalNodeError
_nodeError
->
undefined
InternalTreeError
_treeError
->
undefined
InternalValidationError
_validationError
->
undefined
InternalJoseError
_joseError
->
undefined
InternalServerError
_internalServerError
->
undefined
InternalJobError
_jobError
->
undefined
showAsServantJSONErr
::
BackendInternalError
->
ServerError
showAsServantJSONErr
(
InternalNodeError
err
@
(
NoListFound
{}))
=
err404
{
errBody
=
JSON
.
encode
err
}
showAsServantJSONErr
(
InternalNodeError
err
@
NoRootFound
)
=
err404
{
errBody
=
JSON
.
encode
err
}
showAsServantJSONErr
(
InternalNodeError
err
@
NoCorpusFound
)
=
err404
{
errBody
=
JSON
.
encode
err
}
showAsServantJSONErr
(
InternalNodeError
err
@
NoUserFound
{})
=
err404
{
errBody
=
JSON
.
encode
err
}
showAsServantJSONErr
(
InternalNodeError
err
@
(
DoesNotExist
{}))
=
err404
{
errBody
=
JSON
.
encode
err
}
showAsServantJSONErr
(
InternalServerError
err
)
=
err
showAsServantJSONErr
a
=
err500
{
errBody
=
JSON
.
encode
a
}
src/Gargantext/API/Errors/Class.hs
0 → 100644
View file @
405a3082
module
Gargantext.API.Errors.Class
where
import
Control.Lens
import
Crypto.JOSE.Error
as
Jose
class
HasJoseError
e
where
_JoseError
::
Prism'
e
Jose
.
Error
src/Gargantext/API/Errors/Types.hs
View file @
405a3082
...
@@ -16,8 +16,9 @@ module Gargantext.API.Errors.Types (
...
@@ -16,8 +16,9 @@ module Gargantext.API.Errors.Types (
-- * The main frontend error type
-- * The main frontend error type
FrontendError
(
..
)
FrontendError
(
..
)
-- * The enumeration of all possible backend error types
-- * The
internal backend type and an
enumeration of all possible backend error types
,
BackendErrorType
(
..
)
,
BackendErrorType
(
..
)
,
BackendInternalError
(
..
)
-- * Constructing frontend errors
-- * Constructing frontend errors
,
mkFrontendErr
,
mkFrontendErr
...
@@ -32,18 +33,29 @@ module Gargantext.API.Errors.Types (
...
@@ -32,18 +33,29 @@ module Gargantext.API.Errors.Types (
)
where
)
where
import
Control.Exception
import
Control.Exception
import
Control.Lens
(
makePrisms
)
import
Data.Aeson
as
JSON
import
Data.Aeson
as
JSON
import
Data.Aeson.Types
(
typeMismatch
)
import
Data.Aeson.Types
(
typeMismatch
,
emptyArray
)
import
Data.Kind
import
Data.Kind
import
Data.Singletons.TH
import
Data.Singletons.TH
import
Data.Typeable
import
Data.Typeable
import
Data.Validity
(
Validation
)
import
GHC.Generics
import
GHC.Generics
import
GHC.Stack
import
GHC.Stack
import
Gargantext.API.Errors.Class
import
Gargantext.Core.Types
(
HasValidationError
(
..
))
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Query.Table.Node.Error
import
Gargantext.Database.Query.Tree.Error
import
Prelude
import
Prelude
import
Servant
(
ServerError
)
import
Servant.Job.Core
import
Test.QuickCheck
import
Test.QuickCheck
import
Test.QuickCheck.Instances.Text
()
import
Test.QuickCheck.Instances.Text
()
import
qualified
Crypto.JWT
as
Jose
import
qualified
Data.Text
as
T
import
qualified
Data.Text
as
T
import
qualified
Gargantext.Utils.Jobs.Monad
as
Jobs
import
qualified
Servant.Job.Types
as
SJ
-- | A 'WithStacktrace' carries an error alongside its
-- | A 'WithStacktrace' carries an error alongside its
-- 'CallStack', to be able to print the correct source location
-- 'CallStack', to be able to print the correct source location
...
@@ -58,6 +70,49 @@ instance Exception e => Exception (WithStacktrace e) where
...
@@ -58,6 +70,49 @@ instance Exception e => Exception (WithStacktrace e) where
displayException
WithStacktrace
{
..
}
displayException
WithStacktrace
{
..
}
=
displayException
ct_error
<>
"
\n
"
<>
prettyCallStack
ct_callStack
=
displayException
ct_error
<>
"
\n
"
<>
prettyCallStack
ct_callStack
-------------------------------------------------------------------
-- | An internal error which can be emitted from the backend and later
-- converted into a 'FrontendError', for later consumption.
data
BackendInternalError
=
InternalNodeError
!
NodeError
|
InternalTreeError
!
TreeError
|
InternalValidationError
!
Validation
|
InternalJoseError
!
Jose
.
Error
|
InternalServerError
!
ServerError
|
InternalJobError
!
Jobs
.
JobError
deriving
(
Show
,
Typeable
)
makePrisms
''
B
ackendInternalError
instance
ToJSON
BackendInternalError
where
toJSON
(
InternalJobError
s
)
=
object
[
(
"status"
,
toJSON
SJ
.
IsFailure
)
,
(
"log"
,
emptyArray
)
,
(
"id"
,
String
mk_id
)
,
(
"error"
,
String
$
T
.
pack
$
show
s
)
]
where
mk_id
=
case
s
of
Jobs
.
InvalidMacID
i
->
i
_
->
""
toJSON
err
=
object
[(
"error"
,
String
$
T
.
pack
$
show
err
)]
instance
Exception
BackendInternalError
instance
HasNodeError
BackendInternalError
where
_NodeError
=
_InternalNodeError
instance
HasValidationError
BackendInternalError
where
_ValidationError
=
_InternalValidationError
instance
HasTreeError
BackendInternalError
where
_TreeError
=
_InternalTreeError
instance
HasServerError
BackendInternalError
where
_ServerError
=
_InternalServerError
instance
HasJoseError
BackendInternalError
where
_JoseError
=
_InternalJoseError
-- | A (hopefully and eventually) exhaustive list of backend errors.
-- | A (hopefully and eventually) exhaustive list of backend errors.
data
BackendErrorType
data
BackendErrorType
=
BE_phylo_corpus_not_ready
=
BE_phylo_corpus_not_ready
...
...
src/Gargantext/API/GraphQL.hs
View file @
405a3082
...
@@ -28,6 +28,7 @@ import Gargantext.API.Admin.Auth.Types (AuthenticatedUser)
...
@@ -28,6 +28,7 @@ import Gargantext.API.Admin.Auth.Types (AuthenticatedUser)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Auth.PolicyCheck
import
Gargantext.API.Auth.PolicyCheck
import
Gargantext.API.Errors.Types
import
Gargantext.API.GraphQL.Annuaire
qualified
as
GQLA
import
Gargantext.API.GraphQL.Annuaire
qualified
as
GQLA
import
Gargantext.API.GraphQL.AsyncTask
qualified
as
GQLAT
import
Gargantext.API.GraphQL.AsyncTask
qualified
as
GQLAT
import
Gargantext.API.GraphQL.Context
qualified
as
GQLCTX
import
Gargantext.API.GraphQL.Context
qualified
as
GQLCTX
...
@@ -38,7 +39,7 @@ import Gargantext.API.GraphQL.Team qualified as GQLTeam
...
@@ -38,7 +39,7 @@ import Gargantext.API.GraphQL.Team qualified as GQLTeam
import
Gargantext.API.GraphQL.TreeFirstLevel
qualified
as
GQLTree
import
Gargantext.API.GraphQL.TreeFirstLevel
qualified
as
GQLTree
import
Gargantext.API.GraphQL.User
qualified
as
GQLUser
import
Gargantext.API.GraphQL.User
qualified
as
GQLUser
import
Gargantext.API.GraphQL.UserInfo
qualified
as
GQLUserInfo
import
Gargantext.API.GraphQL.UserInfo
qualified
as
GQLUserInfo
import
Gargantext.API.Prelude
(
GargM
,
GargError
)
import
Gargantext.API.Prelude
(
GargM
)
import
Gargantext.API.Prelude
(
HasJobEnv
'
)
import
Gargantext.API.Prelude
(
HasJobEnv
'
)
import
Gargantext.API.Types
import
Gargantext.API.Types
import
Gargantext.Core.NLP
(
HasNLPServer
)
import
Gargantext.Core.NLP
(
HasNLPServer
)
...
@@ -106,7 +107,7 @@ rootResolver
...
@@ -106,7 +107,7 @@ rootResolver
::
(
CmdCommon
env
,
HasNLPServer
env
,
HasJobEnv'
env
,
HasSettings
env
)
::
(
CmdCommon
env
,
HasNLPServer
env
,
HasJobEnv'
env
,
HasSettings
env
)
=>
AuthenticatedUser
=>
AuthenticatedUser
->
AccessPolicyManager
->
AccessPolicyManager
->
RootResolver
(
GargM
env
Garg
Error
)
e
Query
Mutation
Undefined
->
RootResolver
(
GargM
env
BackendInternal
Error
)
e
Query
Mutation
Undefined
rootResolver
authenticatedUser
policyManager
=
rootResolver
authenticatedUser
policyManager
=
RootResolver
RootResolver
{
queryResolver
=
Query
{
annuaire_contacts
=
GQLA
.
resolveAnnuaireContacts
{
queryResolver
=
Query
{
annuaire_contacts
=
GQLA
.
resolveAnnuaireContacts
...
@@ -135,7 +136,7 @@ app
...
@@ -135,7 +136,7 @@ app
::
(
Typeable
env
,
CmdCommon
env
,
HasJobEnv'
env
,
HasNLPServer
env
,
HasSettings
env
)
::
(
Typeable
env
,
CmdCommon
env
,
HasJobEnv'
env
,
HasNLPServer
env
,
HasSettings
env
)
=>
AuthenticatedUser
=>
AuthenticatedUser
->
AccessPolicyManager
->
AccessPolicyManager
->
App
(
EVENT
(
GargM
env
GargError
))
(
GargM
env
Garg
Error
)
->
App
(
EVENT
(
GargM
env
BackendInternalError
))
(
GargM
env
BackendInternal
Error
)
app
authenticatedUser
policyManager
=
deriveApp
(
rootResolver
authenticatedUser
policyManager
)
app
authenticatedUser
policyManager
=
deriveApp
(
rootResolver
authenticatedUser
policyManager
)
----------------------------------------------
----------------------------------------------
...
@@ -172,6 +173,6 @@ gqapi = Proxy
...
@@ -172,6 +173,6 @@ gqapi = Proxy
--api :: Server API
--api :: Server API
api
api
::
(
Typeable
env
,
CmdCommon
env
,
HasJobEnv'
env
,
HasSettings
env
)
::
(
Typeable
env
,
CmdCommon
env
,
HasJobEnv'
env
,
HasSettings
env
)
=>
ServerT
API
(
GargM
env
Garg
Error
)
=>
ServerT
API
(
GargM
env
BackendInternal
Error
)
api
(
SAS
.
Authenticated
auser
)
=
(
httpPubApp
[]
.
app
auser
)
:<|>
pure
httpPlayground
api
(
SAS
.
Authenticated
auser
)
=
(
httpPubApp
[]
.
app
auser
)
:<|>
pure
httpPlayground
api
_
=
panic
"401 in graphql"
-- SAS.throwAll (_ServerError # err401)
api
_
=
panic
"401 in graphql"
-- SAS.throwAll (_ServerError # err401)
src/Gargantext/API/GraphQL/AsyncTask.hs
View file @
405a3082
...
@@ -18,7 +18,8 @@ import Data.IntMap.Strict qualified as IntMap
...
@@ -18,7 +18,8 @@ import Data.IntMap.Strict qualified as IntMap
import
Data.Map.Strict
qualified
as
Map
import
Data.Map.Strict
qualified
as
Map
import
Data.Morpheus.Types
(
GQLType
,
Resolver
,
QUERY
)
import
Data.Morpheus.Types
(
GQLType
,
Resolver
,
QUERY
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
))
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
))
import
Gargantext.API.Prelude
(
GargM
,
GargError
,
HasJobEnv
'
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.Prelude
(
GargM
,
HasJobEnv
'
)
import
Gargantext.Database.Prelude
(
HasConnectionPool
,
HasConfig
)
import
Gargantext.Database.Prelude
(
HasConnectionPool
,
HasConfig
)
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Servant.Job.Async
(
HasJobEnv
(
job_env
),
jenv_jobs
,
job_async
)
import
Servant.Job.Async
(
HasJobEnv
(
job_env
),
jenv_jobs
,
job_async
)
...
@@ -29,7 +30,7 @@ data JobLogArgs
...
@@ -29,7 +30,7 @@ data JobLogArgs
{
job_log_id
::
Int
{
job_log_id
::
Int
}
deriving
(
Generic
,
GQLType
)
}
deriving
(
Generic
,
GQLType
)
type
GqlM
e
env
=
Resolver
QUERY
e
(
GargM
env
Garg
Error
)
type
GqlM
e
env
=
Resolver
QUERY
e
(
GargM
env
BackendInternal
Error
)
resolveJobLogs
resolveJobLogs
::
(
HasConnectionPool
env
,
HasConfig
env
,
HasJobEnv'
env
)
::
(
HasConnectionPool
env
,
HasConfig
env
,
HasJobEnv'
env
)
...
...
src/Gargantext/API/GraphQL/Context.hs
View file @
405a3082
...
@@ -25,7 +25,8 @@ import Data.Morpheus.Types
...
@@ -25,7 +25,8 @@ import Data.Morpheus.Types
import
Data.Text
(
pack
)
import
Data.Text
(
pack
)
import
Data.Time.Format.ISO8601
(
iso8601Show
)
import
Data.Time.Format.ISO8601
(
iso8601Show
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Prelude
(
GargM
,
GargError
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.Prelude
(
GargM
)
import
Gargantext.Core.Types.Search
(
HyperdataRow
(
..
),
toHyperdataRow
)
import
Gargantext.Core.Types.Search
(
HyperdataRow
(
..
),
toHyperdataRow
)
import
Gargantext.Database.Admin.Types.Hyperdata
(
HyperdataDocument
)
import
Gargantext.Database.Admin.Types.Hyperdata
(
HyperdataDocument
)
import
Gargantext.Database.Admin.Types.Node
(
ContextTitle
,
NodeId
(
..
),
NodeTypeId
,
UserId
,
unNodeId
,
ContextId
(
..
))
import
Gargantext.Database.Admin.Types.Node
(
ContextTitle
,
NodeId
(
..
),
NodeTypeId
,
UserId
,
unNodeId
,
ContextId
(
..
))
...
@@ -109,8 +110,8 @@ data ContextNgramsArgs
...
@@ -109,8 +110,8 @@ data ContextNgramsArgs
,
list_id
::
Int
}
,
list_id
::
Int
}
deriving
(
Generic
,
GQLType
)
deriving
(
Generic
,
GQLType
)
type
GqlM
e
env
=
Resolver
QUERY
e
(
GargM
env
Garg
Error
)
type
GqlM
e
env
=
Resolver
QUERY
e
(
GargM
env
BackendInternal
Error
)
type
GqlM'
e
env
a
=
ResolverM
e
(
GargM
env
Garg
Error
)
a
type
GqlM'
e
env
a
=
ResolverM
e
(
GargM
env
BackendInternal
Error
)
a
-- GQL API
-- GQL API
...
...
src/Gargantext/API/GraphQL/PolicyCheck.hs
View file @
405a3082
...
@@ -6,8 +6,8 @@ import Prelude
...
@@ -6,8 +6,8 @@ import Prelude
import
Control.Monad.Except
import
Control.Monad.Except
import
Gargantext.API.Admin.Auth.Types
import
Gargantext.API.Admin.Auth.Types
import
Gargantext.API.Auth.PolicyCheck
import
Gargantext.API.Auth.PolicyCheck
import
Gargantext.API.Errors.Types
import
Gargantext.API.GraphQL.Types
import
Gargantext.API.GraphQL.Types
import
Gargantext.API.Prelude
import
Gargantext.Database.Prelude
(
HasConnectionPool
,
HasConfig
)
import
Gargantext.Database.Prelude
(
HasConnectionPool
,
HasConfig
)
withPolicy
::
(
HasConnectionPool
env
,
HasConfig
env
)
withPolicy
::
(
HasConnectionPool
env
,
HasConfig
env
)
...
@@ -21,5 +21,5 @@ withPolicy ur mgr checks m = case mgr of
...
@@ -21,5 +21,5 @@ withPolicy ur mgr checks m = case mgr of
res
<-
lift
$
runAccessPolicy
ur
checks
res
<-
lift
$
runAccessPolicy
ur
checks
case
res
of
case
res
of
Allow
->
m
Allow
->
m
Deny
err
->
lift
$
throwError
$
Garg
ServerError
$
err
Deny
err
->
lift
$
throwError
$
Internal
ServerError
$
err
src/Gargantext/API/GraphQL/Team.hs
View file @
405a3082
...
@@ -17,9 +17,10 @@ module Gargantext.API.GraphQL.Team where
...
@@ -17,9 +17,10 @@ module Gargantext.API.GraphQL.Team where
import
Data.Morpheus.Types
(
GQLType
,
ResolverM
)
import
Data.Morpheus.Types
(
GQLType
,
ResolverM
)
import
Data.Text
qualified
as
T
import
Data.Text
qualified
as
T
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.GraphQL.Types
(
GqlM
)
import
Gargantext.API.GraphQL.Types
(
GqlM
)
import
Gargantext.API.GraphQL.Utils
(
authUser
,
AuthStatus
(
Invalid
,
Valid
))
import
Gargantext.API.GraphQL.Utils
(
authUser
,
AuthStatus
(
Invalid
,
Valid
))
import
Gargantext.API.Prelude
(
GargM
,
GargError
)
import
Gargantext.API.Prelude
(
GargM
)
import
Gargantext.Core.Types
(
NodeId
(
..
),
unNodeId
)
import
Gargantext.Core.Types
(
NodeId
(
..
),
unNodeId
)
import
Gargantext.Core.Types.Individu
qualified
as
Individu
import
Gargantext.Core.Types.Individu
qualified
as
Individu
import
Gargantext.Database.Action.Share
(
membersOf
,
deleteMemberShip
)
import
Gargantext.Database.Action.Share
(
membersOf
,
deleteMemberShip
)
...
@@ -49,7 +50,7 @@ data TeamDeleteMArgs = TeamDeleteMArgs
...
@@ -49,7 +50,7 @@ data TeamDeleteMArgs = TeamDeleteMArgs
,
team_node_id
::
Int
,
team_node_id
::
Int
}
deriving
(
Generic
,
GQLType
)
}
deriving
(
Generic
,
GQLType
)
type
GqlM'
e
env
a
=
ResolverM
e
(
GargM
env
Garg
Error
)
a
type
GqlM'
e
env
a
=
ResolverM
e
(
GargM
env
BackendInternal
Error
)
a
resolveTeam
::
(
CmdCommon
env
)
=>
TeamArgs
->
GqlM
e
env
Team
resolveTeam
::
(
CmdCommon
env
)
=>
TeamArgs
->
GqlM
e
env
Team
resolveTeam
TeamArgs
{
team_node_id
}
=
dbTeam
team_node_id
resolveTeam
TeamArgs
{
team_node_id
}
=
dbTeam
team_node_id
...
...
src/Gargantext/API/GraphQL/Types.hs
View file @
405a3082
...
@@ -3,6 +3,7 @@ module Gargantext.API.GraphQL.Types where
...
@@ -3,6 +3,7 @@ module Gargantext.API.GraphQL.Types where
import
Data.Morpheus.Types
import
Data.Morpheus.Types
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.API.Errors.Types
type
GqlM
e
env
=
Resolver
QUERY
e
(
GargM
env
Garg
Error
)
type
GqlM
e
env
=
Resolver
QUERY
e
(
GargM
env
BackendInternal
Error
)
type
GqlM'
e
env
a
=
ResolverM
e
(
GargM
env
Garg
Error
)
a
type
GqlM'
e
env
a
=
ResolverM
e
(
GargM
env
BackendInternal
Error
)
a
src/Gargantext/API/Members.hs
View file @
405a3082
...
@@ -11,21 +11,22 @@ Portability : POSIX
...
@@ -11,21 +11,22 @@ Portability : POSIX
module
Gargantext.API.Members
where
module
Gargantext.API.Members
where
import
Gargantext.API.Admin.EnvTypes
(
Env
)
import
Gargantext.API.Admin.EnvTypes
(
Env
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.Database.Admin.Types.Node
(
NodeType
(
NodeTeam
))
import
Gargantext.Database.Query.Table.Node
(
getNodesIdWithType
)
import
Gargantext.Database.Action.Share
(
membersOf
)
import
Gargantext.Database.Action.Share
(
membersOf
)
import
Gargantext.Database.Admin.Types.Node
(
NodeType
(
NodeTeam
))
import
Gargantext.Database.Prelude
(
CmdCommon
)
import
Gargantext.Database.Prelude
(
CmdCommon
)
import
Gargantext.Database.Query.Table.Node
(
getNodesIdWithType
)
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Servant
import
Servant
type
MembersAPI
=
Get
'[
J
SON
]
[
Text
]
type
MembersAPI
=
Get
'[
J
SON
]
[
Text
]
members
::
ServerT
MembersAPI
(
GargM
Env
Garg
Error
)
members
::
ServerT
MembersAPI
(
GargM
Env
BackendInternal
Error
)
members
=
getMembers
members
=
getMembers
getMembers
::
(
CmdCommon
env
)
=>
getMembers
::
(
CmdCommon
env
)
=>
GargM
env
Garg
Error
[
Text
]
GargM
env
BackendInternal
Error
[
Text
]
getMembers
=
do
getMembers
=
do
teamNodeIds
<-
getNodesIdWithType
NodeTeam
teamNodeIds
<-
getNodesIdWithType
NodeTeam
m
<-
concatMapM
membersOf
teamNodeIds
m
<-
concatMapM
membersOf
teamNodeIds
...
...
src/Gargantext/API/Ngrams.hs
View file @
405a3082
...
@@ -104,12 +104,13 @@ import Formatting (hprint, int, (%))
...
@@ -104,12 +104,13 @@ import Formatting (hprint, int, (%))
import
Gargantext.API.Admin.EnvTypes
(
Env
,
GargJob
(
..
))
import
Gargantext.API.Admin.EnvTypes
(
Env
,
GargJob
(
..
))
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.Metrics
qualified
as
Metrics
import
Gargantext.API.Metrics
qualified
as
Metrics
import
Gargantext.API.Ngrams.Tools
import
Gargantext.API.Ngrams.Tools
import
Gargantext.API.Ngrams.Types
import
Gargantext.API.Ngrams.Types
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.Core.NodeStory
import
Gargantext.Core.NodeStory
import
Gargantext.Core.Types
(
ListType
(
..
),
NodeId
,
ListId
,
DocId
,
TODO
,
assertValid
,
Has
Invalid
Error
,
ContextId
)
import
Gargantext.Core.Types
(
ListType
(
..
),
NodeId
,
ListId
,
DocId
,
TODO
,
assertValid
,
Has
Validation
Error
,
ContextId
)
import
Gargantext.Core.Types.Query
(
Limit
(
..
),
Offset
(
..
),
MinSize
(
..
),
MaxSize
(
..
))
import
Gargantext.Core.Types.Query
(
Limit
(
..
),
Offset
(
..
),
MinSize
(
..
),
MaxSize
(
..
))
import
Gargantext.Database.Action.Metrics.NgramsByContext
(
getOccByNgramsOnlyFast
)
import
Gargantext.Database.Action.Metrics.NgramsByContext
(
getOccByNgramsOnlyFast
)
import
Gargantext.Database.Admin.Config
(
userMaster
)
import
Gargantext.Database.Admin.Config
(
userMaster
)
...
@@ -382,7 +383,7 @@ tableNgramsPull listId ngramsType p_version = do
...
@@ -382,7 +383,7 @@ tableNgramsPull listId ngramsType p_version = do
tableNgramsPut
::
(
HasNodeStory
env
err
m
tableNgramsPut
::
(
HasNodeStory
env
err
m
,
HasNodeStoryImmediateSaver
env
,
HasNodeStoryImmediateSaver
env
,
HasNodeArchiveStoryImmediateSaver
env
,
HasNodeArchiveStoryImmediateSaver
env
,
Has
Invalid
Error
err
,
Has
Validation
Error
err
)
)
=>
TabType
=>
TabType
->
ListId
->
ListId
...
@@ -790,21 +791,21 @@ getTableNgramsDoc dId tabType listId limit_ offset listType minSize maxSize orde
...
@@ -790,21 +791,21 @@ getTableNgramsDoc dId tabType listId limit_ offset listType minSize maxSize orde
getTableNgrams
dId
listId
tabType
searchQuery
getTableNgrams
dId
listId
tabType
searchQuery
apiNgramsTableCorpus
::
NodeId
->
ServerT
TableNgramsApi
(
GargM
Env
Garg
Error
)
apiNgramsTableCorpus
::
NodeId
->
ServerT
TableNgramsApi
(
GargM
Env
BackendInternal
Error
)
apiNgramsTableCorpus
cId
=
getTableNgramsCorpus
cId
apiNgramsTableCorpus
cId
=
getTableNgramsCorpus
cId
:<|>
tableNgramsPut
:<|>
tableNgramsPut
:<|>
scoresRecomputeTableNgrams
cId
:<|>
scoresRecomputeTableNgrams
cId
:<|>
getTableNgramsVersion
cId
:<|>
getTableNgramsVersion
cId
:<|>
apiNgramsAsync
cId
:<|>
apiNgramsAsync
cId
apiNgramsTableDoc
::
DocId
->
ServerT
TableNgramsApi
(
GargM
Env
Garg
Error
)
apiNgramsTableDoc
::
DocId
->
ServerT
TableNgramsApi
(
GargM
Env
BackendInternal
Error
)
apiNgramsTableDoc
dId
=
getTableNgramsDoc
dId
apiNgramsTableDoc
dId
=
getTableNgramsDoc
dId
:<|>
tableNgramsPut
:<|>
tableNgramsPut
:<|>
scoresRecomputeTableNgrams
dId
:<|>
scoresRecomputeTableNgrams
dId
:<|>
getTableNgramsVersion
dId
:<|>
getTableNgramsVersion
dId
:<|>
apiNgramsAsync
dId
:<|>
apiNgramsAsync
dId
apiNgramsAsync
::
NodeId
->
ServerT
TableNgramsAsyncApi
(
GargM
Env
Garg
Error
)
apiNgramsAsync
::
NodeId
->
ServerT
TableNgramsAsyncApi
(
GargM
Env
BackendInternal
Error
)
apiNgramsAsync
_dId
=
apiNgramsAsync
_dId
=
serveJobsAPI
TableNgramsJob
$
\
jHandle
i
->
withTracer
(
printDebug
"tableNgramsPostChartsAsync"
)
jHandle
$
serveJobsAPI
TableNgramsJob
$
\
jHandle
i
->
withTracer
(
printDebug
"tableNgramsPostChartsAsync"
)
jHandle
$
\
jHandle'
->
tableNgramsPostChartsAsync
i
jHandle'
\
jHandle'
->
tableNgramsPostChartsAsync
i
jHandle'
...
...
src/Gargantext/API/Ngrams/List.hs
View file @
405a3082
...
@@ -28,11 +28,12 @@ import Data.Vector (Vector)
...
@@ -28,11 +28,12 @@ import Data.Vector (Vector)
import
Data.Vector
qualified
as
Vec
import
Data.Vector
qualified
as
Vec
import
Gargantext.API.Admin.EnvTypes
(
Env
,
GargJob
(
..
))
import
Gargantext.API.Admin.EnvTypes
(
Env
,
GargJob
(
..
))
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Errors.Types
import
Gargantext.API.Ngrams
(
setListNgrams
)
import
Gargantext.API.Ngrams
(
setListNgrams
)
import
Gargantext.API.Ngrams.List.Types
import
Gargantext.API.Ngrams.List.Types
import
Gargantext.API.Ngrams.Prelude
(
getNgramsList
)
import
Gargantext.API.Ngrams.Prelude
(
getNgramsList
)
import
Gargantext.API.Ngrams.Types
import
Gargantext.API.Ngrams.Types
import
Gargantext.API.Prelude
(
GargServer
,
GargM
,
GargError
)
import
Gargantext.API.Prelude
(
GargServer
,
GargM
)
import
Gargantext.API.Types
import
Gargantext.API.Types
import
Gargantext.Core.NodeStory
import
Gargantext.Core.NodeStory
import
Gargantext.Core.Types.Main
(
ListType
(
..
))
import
Gargantext.Core.Types.Main
(
ListType
(
..
))
...
@@ -50,6 +51,7 @@ import Gargantext.Utils.Servant qualified as GUS
...
@@ -50,6 +51,7 @@ import Gargantext.Utils.Servant qualified as GUS
import
Prelude
qualified
import
Prelude
qualified
import
Protolude
qualified
as
P
import
Protolude
qualified
as
P
import
Servant
import
Servant
------------------------------------------------------------------------
------------------------------------------------------------------------
type
GETAPI
=
Summary
"Get List"
type
GETAPI
=
Summary
"Get List"
:>
"lists"
:>
"lists"
...
@@ -72,7 +74,7 @@ type JSONAPI = Summary "Update List"
...
@@ -72,7 +74,7 @@ type JSONAPI = Summary "Update List"
:>
"async"
:>
"async"
:>
AsyncJobs
JobLog
'[
F
ormUrlEncoded
]
WithJsonFile
JobLog
:>
AsyncJobs
JobLog
'[
F
ormUrlEncoded
]
WithJsonFile
JobLog
jsonApi
::
ServerT
JSONAPI
(
GargM
Env
Garg
Error
)
jsonApi
::
ServerT
JSONAPI
(
GargM
Env
BackendInternal
Error
)
jsonApi
=
jsonPostAsync
jsonApi
=
jsonPostAsync
----------------------
----------------------
...
@@ -85,7 +87,7 @@ type CSVAPI = Summary "Update List (legacy v3 CSV)"
...
@@ -85,7 +87,7 @@ type CSVAPI = Summary "Update List (legacy v3 CSV)"
:>
"async"
:>
"async"
:>
AsyncJobs
JobLog
'[
F
ormUrlEncoded
]
WithTextFile
JobLog
:>
AsyncJobs
JobLog
'[
F
ormUrlEncoded
]
WithTextFile
JobLog
csvApi
::
ServerT
CSVAPI
(
GargM
Env
Garg
Error
)
csvApi
::
ServerT
CSVAPI
(
GargM
Env
BackendInternal
Error
)
csvApi
=
csvPostAsync
csvApi
=
csvPostAsync
------------------------------------------------------------------------
------------------------------------------------------------------------
...
@@ -135,7 +137,7 @@ toIndexedNgrams m t = Indexed <$> i <*> n
...
@@ -135,7 +137,7 @@ toIndexedNgrams m t = Indexed <$> i <*> n
n
=
Just
(
text2ngrams
t
)
n
=
Just
(
text2ngrams
t
)
------------------------------------------------------------------------
------------------------------------------------------------------------
jsonPostAsync
::
ServerT
JSONAPI
(
GargM
Env
Garg
Error
)
jsonPostAsync
::
ServerT
JSONAPI
(
GargM
Env
BackendInternal
Error
)
jsonPostAsync
lId
=
jsonPostAsync
lId
=
serveJobsAPI
UpdateNgramsListJobJSON
$
\
jHandle
f
->
serveJobsAPI
UpdateNgramsListJobJSON
$
\
jHandle
f
->
postAsync'
lId
f
jHandle
postAsync'
lId
f
jHandle
...
@@ -216,7 +218,7 @@ csvPost l m = do
...
@@ -216,7 +218,7 @@ csvPost l m = do
pure
$
Right
()
pure
$
Right
()
------------------------------------------------------------------------
------------------------------------------------------------------------
csvPostAsync
::
ServerT
CSVAPI
(
GargM
Env
Garg
Error
)
csvPostAsync
::
ServerT
CSVAPI
(
GargM
Env
BackendInternal
Error
)
csvPostAsync
lId
=
csvPostAsync
lId
=
serveJobsAPI
UpdateNgramsListJobCSV
$
\
jHandle
f
->
do
serveJobsAPI
UpdateNgramsListJobCSV
$
\
jHandle
f
->
do
markStarted
1
jHandle
markStarted
1
jHandle
...
...
src/Gargantext/API/Node.hs
View file @
405a3082
...
@@ -36,6 +36,7 @@ import Gargantext.API.Admin.Auth (withAccess, withPolicy)
...
@@ -36,6 +36,7 @@ import Gargantext.API.Admin.Auth (withAccess, withPolicy)
import
Gargantext.API.Admin.Auth.Types
(
PathId
(
..
),
AuthenticatedUser
(
..
),
auth_node_id
)
import
Gargantext.API.Admin.Auth.Types
(
PathId
(
..
),
AuthenticatedUser
(
..
),
auth_node_id
)
import
Gargantext.API.Admin.EnvTypes
import
Gargantext.API.Admin.EnvTypes
import
Gargantext.API.Auth.PolicyCheck
import
Gargantext.API.Auth.PolicyCheck
import
Gargantext.API.Errors.Types
import
Gargantext.API.Metrics
import
Gargantext.API.Metrics
import
Gargantext.API.Ngrams
(
TableNgramsApi
,
apiNgramsTableCorpus
)
import
Gargantext.API.Ngrams
(
TableNgramsApi
,
apiNgramsTableCorpus
)
import
Gargantext.API.Ngrams.Types
(
TabType
(
..
))
import
Gargantext.API.Ngrams.Types
(
TabType
(
..
))
...
@@ -195,14 +196,14 @@ nodeAPI :: forall proxy a.
...
@@ -195,14 +196,14 @@ nodeAPI :: forall proxy a.
)
=>
proxy
a
)
=>
proxy
a
->
AuthenticatedUser
->
AuthenticatedUser
->
NodeId
->
NodeId
->
ServerT
(
NodeAPI
a
)
(
GargM
Env
Garg
Error
)
->
ServerT
(
NodeAPI
a
)
(
GargM
Env
BackendInternal
Error
)
nodeAPI
p
authenticatedUser
targetNode
=
nodeAPI
p
authenticatedUser
targetNode
=
withAccess
(
Proxy
::
Proxy
(
NodeAPI
a
))
Proxy
authenticatedUser
(
PathNode
targetNode
)
nodeAPI'
withAccess
(
Proxy
::
Proxy
(
NodeAPI
a
))
Proxy
authenticatedUser
(
PathNode
targetNode
)
nodeAPI'
where
where
userRootId
=
RootId
$
authenticatedUser
^.
auth_node_id
userRootId
=
RootId
$
authenticatedUser
^.
auth_node_id
nodeAPI'
::
ServerT
(
NodeAPI
a
)
(
GargM
Env
Garg
Error
)
nodeAPI'
::
ServerT
(
NodeAPI
a
)
(
GargM
Env
BackendInternal
Error
)
nodeAPI'
=
withPolicy
authenticatedUser
(
nodeChecks
targetNode
)
(
getNodeWith
targetNode
p
)
nodeAPI'
=
withPolicy
authenticatedUser
(
nodeChecks
targetNode
)
(
getNodeWith
targetNode
p
)
:<|>
rename
targetNode
:<|>
rename
targetNode
:<|>
postNode
authenticatedUser
targetNode
:<|>
postNode
authenticatedUser
targetNode
...
...
src/Gargantext/API/Node/Contact.hs
View file @
405a3082
...
@@ -33,11 +33,13 @@ import Servant
...
@@ -33,11 +33,13 @@ import Servant
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck.Arbitrary
import
Test.QuickCheck.Arbitrary
import
Gargantext.API.Admin.Auth.Types
import
Gargantext.API.Admin.EnvTypes
(
Env
,
GargJob
(
..
))
import
Gargantext.API.Admin.EnvTypes
(
Env
,
GargJob
(
..
))
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.Node
import
Gargantext.API.Node
import
Gargantext.API.Prelude
(
Garg
Error
,
Garg
M
,
simuLogs
)
import
Gargantext.API.Prelude
(
GargM
,
simuLogs
)
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.Text.Terms
(
TermType
(
..
))
import
Gargantext.Core.Text.Terms
(
TermType
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
...
@@ -47,9 +49,8 @@ import Gargantext.Database.Admin.Types.Hyperdata (HyperdataAnnuaire(..), Hyperda
...
@@ -47,9 +49,8 @@ import Gargantext.Database.Admin.Types.Hyperdata (HyperdataAnnuaire(..), Hyperda
import
Gargantext.Database.Admin.Types.Hyperdata.Contact
(
hyperdataContact
)
import
Gargantext.Database.Admin.Types.Hyperdata.Contact
(
hyperdataContact
)
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Prelude
((
$
),
{-printDebug,-}
)
import
Gargantext.Prelude
((
$
),
{-printDebug,-}
)
import
qualified
Gargantext.Utils.Aeson
as
GUA
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
))
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
))
import
Gargantext.API.Admin.Auth.Types
import
qualified
Gargantext.Utils.Aeson
as
GUA
------------------------------------------------------------------------
------------------------------------------------------------------------
type
API
=
"contact"
:>
Summary
"Contact endpoint"
type
API
=
"contact"
:>
Summary
"Contact endpoint"
...
@@ -58,7 +59,7 @@ type API = "contact" :> Summary "Contact endpoint"
...
@@ -58,7 +59,7 @@ type API = "contact" :> Summary "Contact endpoint"
:>
NodeNodeAPI
HyperdataContact
:>
NodeNodeAPI
HyperdataContact
api
::
AuthenticatedUser
->
CorpusId
->
ServerT
API
(
GargM
Env
Garg
Error
)
api
::
AuthenticatedUser
->
CorpusId
->
ServerT
API
(
GargM
Env
BackendInternal
Error
)
api
authUser
@
(
AuthenticatedUser
userNodeId
_userUserId
)
cid
=
api
authUser
@
(
AuthenticatedUser
userNodeId
_userUserId
)
cid
=
(
api_async
(
RootId
userNodeId
)
cid
)
(
api_async
(
RootId
userNodeId
)
cid
)
:<|>
(
nodeNodeAPI
(
Proxy
::
Proxy
HyperdataContact
)
authUser
cid
)
:<|>
(
nodeNodeAPI
(
Proxy
::
Proxy
HyperdataContact
)
authUser
cid
)
...
@@ -73,7 +74,7 @@ data AddContactParams = AddContactParams { firstname :: !Text, lastname
...
@@ -73,7 +74,7 @@ data AddContactParams = AddContactParams { firstname :: !Text, lastname
deriving
(
Generic
)
deriving
(
Generic
)
----------------------------------------------------------------------
----------------------------------------------------------------------
api_async
::
User
->
NodeId
->
ServerT
API_Async
(
GargM
Env
Garg
Error
)
api_async
::
User
->
NodeId
->
ServerT
API_Async
(
GargM
Env
BackendInternal
Error
)
api_async
u
nId
=
api_async
u
nId
=
serveJobsAPI
AddContactJob
$
\
jHandle
p
->
serveJobsAPI
AddContactJob
$
\
jHandle
p
->
addContact
u
nId
p
jHandle
addContact
u
nId
p
jHandle
...
...
src/Gargantext/API/Node/Corpus/Searx.hs
View file @
405a3082
...
@@ -29,7 +29,7 @@ import Gargantext.Core.Text.Corpus.API qualified as API
...
@@ -29,7 +29,7 @@ import Gargantext.Core.Text.Corpus.API qualified as API
import
Gargantext.Core.Text.List
(
buildNgramsLists
)
import
Gargantext.Core.Text.List
(
buildNgramsLists
)
import
Gargantext.Core.Text.List.Group.WithStem
(
{-StopSize(..),-}
GroupParams
(
..
))
import
Gargantext.Core.Text.List.Group.WithStem
(
{-StopSize(..),-}
GroupParams
(
..
))
import
Gargantext.Core.Text.Terms
(
TermType
(
..
))
import
Gargantext.Core.Text.Terms
(
TermType
(
..
))
import
Gargantext.Core.Types
(
Has
Invalid
Error
)
import
Gargantext.Core.Types
(
Has
Validation
Error
)
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
import
Gargantext.Database.Action.Flow
(
addDocumentsToHyperCorpus
)
--, DataText(..))
import
Gargantext.Database.Action.Flow
(
addDocumentsToHyperCorpus
)
--, DataText(..))
...
@@ -124,7 +124,7 @@ insertSearxResponse :: ( MonadBase IO m
...
@@ -124,7 +124,7 @@ insertSearxResponse :: ( MonadBase IO m
,
HasNLPServer
env
,
HasNLPServer
env
,
HasNodeError
err
,
HasNodeError
err
,
HasTreeError
err
,
HasTreeError
err
,
Has
Invalid
Error
err
)
,
Has
Validation
Error
err
)
=>
User
=>
User
->
CorpusId
->
CorpusId
->
ListId
->
ListId
...
@@ -166,7 +166,7 @@ triggerSearxSearch :: ( MonadBase IO m
...
@@ -166,7 +166,7 @@ triggerSearxSearch :: ( MonadBase IO m
,
HasNLPServer
env
,
HasNLPServer
env
,
HasNodeError
err
,
HasNodeError
err
,
HasTreeError
err
,
HasTreeError
err
,
Has
InvalidError
err
,
Has
ValidationError
err
,
MonadJobStatus
m
)
,
MonadJobStatus
m
)
=>
User
=>
User
->
CorpusId
->
CorpusId
...
...
src/Gargantext/API/Node/DocumentUpload.hs
View file @
405a3082
...
@@ -22,6 +22,7 @@ import Data.Swagger (ToSchema)
...
@@ -22,6 +22,7 @@ import Data.Swagger (ToSchema)
import
Data.Text
qualified
as
T
import
Data.Text
qualified
as
T
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.NLP
(
nlpServerGet
)
import
Gargantext.Core.NLP
(
nlpServerGet
)
...
@@ -75,7 +76,7 @@ type API = Summary " Document upload"
...
@@ -75,7 +76,7 @@ type API = Summary " Document upload"
:>
"async"
:>
"async"
:>
AsyncJobs
JobLog
'[
J
SON
]
DocumentUpload
JobLog
:>
AsyncJobs
JobLog
'[
J
SON
]
DocumentUpload
JobLog
api
::
NodeId
->
ServerT
API
(
GargM
Env
Garg
Error
)
api
::
NodeId
->
ServerT
API
(
GargM
Env
BackendInternal
Error
)
api
nId
=
api
nId
=
serveJobsAPI
UploadDocumentJob
$
\
jHandle
q
->
do
serveJobsAPI
UploadDocumentJob
$
\
jHandle
q
->
do
documentUploadAsync
nId
q
jHandle
documentUploadAsync
nId
q
jHandle
...
...
src/Gargantext/API/Node/DocumentsFromWriteNodes.hs
View file @
405a3082
...
@@ -22,11 +22,13 @@ import Data.Aeson
...
@@ -22,11 +22,13 @@ import Data.Aeson
import
Data.List
qualified
as
List
import
Data.List
qualified
as
List
import
Data.Swagger
import
Data.Swagger
import
Data.Text
qualified
as
T
import
Data.Text
qualified
as
T
import
Gargantext.API.Admin.Auth.Types
import
Gargantext.API.Admin.EnvTypes
(
Env
,
GargJob
(
..
))
import
Gargantext.API.Admin.EnvTypes
(
Env
,
GargJob
(
..
))
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.Ngrams
(
commitStatePatch
,
Versioned
(
..
))
import
Gargantext.API.Ngrams
(
commitStatePatch
,
Versioned
(
..
))
import
Gargantext.API.Prelude
(
GargM
,
GargError
)
import
Gargantext.API.Prelude
(
GargM
)
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.NodeStory
(
HasNodeStoryImmediateSaver
,
HasNodeArchiveStoryImmediateSaver
,
currentVersion
)
import
Gargantext.Core.NodeStory
(
HasNodeStoryImmediateSaver
,
HasNodeArchiveStoryImmediateSaver
,
currentVersion
)
import
Gargantext.Core.Text.Corpus.Parsers.Date
(
split'
)
import
Gargantext.Core.Text.Corpus.Parsers.Date
(
split'
)
...
@@ -44,7 +46,6 @@ import Gargantext.Database.Schema.Node (node_hyperdata, node_name, node_date)
...
@@ -44,7 +46,6 @@ import Gargantext.Database.Schema.Node (node_hyperdata, node_name, node_date)
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
))
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
))
import
Servant
import
Servant
import
Gargantext.API.Admin.Auth.Types
-- import qualified Gargantext.Defaults as Defaults
-- import qualified Gargantext.Defaults as Defaults
------------------------------------------------------------------------
------------------------------------------------------------------------
...
@@ -67,7 +68,7 @@ instance ToSchema Params
...
@@ -67,7 +68,7 @@ instance ToSchema Params
api
::
AuthenticatedUser
api
::
AuthenticatedUser
-- ^ The logged-in user
-- ^ The logged-in user
->
NodeId
->
NodeId
->
ServerT
API
(
GargM
Env
Garg
Error
)
->
ServerT
API
(
GargM
Env
BackendInternal
Error
)
api
authenticatedUser
nId
=
api
authenticatedUser
nId
=
serveJobsAPI
DocumentFromWriteNodeJob
$
\
jHandle
p
->
serveJobsAPI
DocumentFromWriteNodeJob
$
\
jHandle
p
->
documentsFromWriteNodes
authenticatedUser
nId
p
jHandle
documentsFromWriteNodes
authenticatedUser
nId
p
jHandle
...
...
src/Gargantext/API/Node/File.hs
View file @
405a3082
...
@@ -33,6 +33,7 @@ import Gargantext.API.Admin.Auth.Types
...
@@ -33,6 +33,7 @@ import Gargantext.API.Admin.Auth.Types
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.Node.Types
import
Gargantext.API.Node.Types
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.Core.Types
(
TODO
)
import
Gargantext.Core.Types
(
TODO
)
...
@@ -114,7 +115,7 @@ type FileAsyncApi = Summary "File Async Api"
...
@@ -114,7 +115,7 @@ type FileAsyncApi = Summary "File Async Api"
fileAsyncApi
::
AuthenticatedUser
fileAsyncApi
::
AuthenticatedUser
-- ^ The logged-in user
-- ^ The logged-in user
->
NodeId
->
NodeId
->
ServerT
FileAsyncApi
(
GargM
Env
Garg
Error
)
->
ServerT
FileAsyncApi
(
GargM
Env
BackendInternal
Error
)
fileAsyncApi
authenticatedUser
nId
=
fileAsyncApi
authenticatedUser
nId
=
serveJobsAPI
AddFileJob
$
\
jHandle
i
->
serveJobsAPI
AddFileJob
$
\
jHandle
i
->
addWithFile
authenticatedUser
nId
i
jHandle
addWithFile
authenticatedUser
nId
i
jHandle
...
...
src/Gargantext/API/Node/FrameCalcUpload.hs
View file @
405a3082
...
@@ -29,6 +29,7 @@ import Web.FormUrlEncoded (FromForm)
...
@@ -29,6 +29,7 @@ import Web.FormUrlEncoded (FromForm)
import
Gargantext.API.Admin.Auth.Types
import
Gargantext.API.Admin.Auth.Types
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.Node.Corpus.New
(
addToCorpusWithForm
)
import
Gargantext.API.Node.Corpus.New
(
addToCorpusWithForm
)
import
Gargantext.API.Node.Corpus.New.Types
(
FileFormat
(
..
),
FileType
(
..
))
import
Gargantext.API.Node.Corpus.New.Types
(
FileFormat
(
..
),
FileType
(
..
))
import
Gargantext.API.Node.Types
(
NewWithForm
(
..
))
import
Gargantext.API.Node.Types
(
NewWithForm
(
..
))
...
@@ -62,7 +63,7 @@ type API = Summary " FrameCalc upload"
...
@@ -62,7 +63,7 @@ type API = Summary " FrameCalc upload"
:>
"async"
:>
"async"
:>
AsyncJobs
JobLog
'[
J
SON
]
FrameCalcUpload
JobLog
:>
AsyncJobs
JobLog
'[
J
SON
]
FrameCalcUpload
JobLog
api
::
AuthenticatedUser
->
NodeId
->
ServerT
API
(
GargM
Env
Garg
Error
)
api
::
AuthenticatedUser
->
NodeId
->
ServerT
API
(
GargM
Env
BackendInternal
Error
)
api
authenticatedUser
nId
=
api
authenticatedUser
nId
=
serveJobsAPI
UploadFrameCalcJob
$
\
jHandle
p
->
serveJobsAPI
UploadFrameCalcJob
$
\
jHandle
p
->
frameCalcUploadAsync
authenticatedUser
nId
p
jHandle
frameCalcUploadAsync
authenticatedUser
nId
p
jHandle
...
...
src/Gargantext/API/Node/New.hs
View file @
405a3082
...
@@ -23,8 +23,10 @@ module Gargantext.API.Node.New
...
@@ -23,8 +23,10 @@ module Gargantext.API.Node.New
import
Control.Lens
hiding
(
elements
,
Empty
)
import
Control.Lens
hiding
(
elements
,
Empty
)
import
Data.Aeson
import
Data.Aeson
import
Data.Swagger
import
Data.Swagger
import
Gargantext.API.Admin.Auth.Types
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.Database.Action.Flow.Types
import
Gargantext.Database.Action.Flow.Types
import
Gargantext.Database.Action.Node
import
Gargantext.Database.Action.Node
...
@@ -37,7 +39,6 @@ import Servant
...
@@ -37,7 +39,6 @@ import Servant
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck.Arbitrary
import
Test.QuickCheck.Arbitrary
import
Web.FormUrlEncoded
(
FromForm
,
ToForm
)
import
Web.FormUrlEncoded
(
FromForm
,
ToForm
)
import
Gargantext.API.Admin.Auth.Types
------------------------------------------------------------------------
------------------------------------------------------------------------
data
PostNode
=
PostNode
{
pn_name
::
Text
data
PostNode
=
PostNode
{
pn_name
::
Text
...
@@ -75,7 +76,7 @@ postNodeAsyncAPI
...
@@ -75,7 +76,7 @@ postNodeAsyncAPI
-- ^ The logged-in user
-- ^ The logged-in user
->
NodeId
->
NodeId
-- ^ The target node
-- ^ The target node
->
ServerT
PostNodeAsync
(
GargM
Env
Garg
Error
)
->
ServerT
PostNodeAsync
(
GargM
Env
BackendInternal
Error
)
postNodeAsyncAPI
authenticatedUser
nId
=
postNodeAsyncAPI
authenticatedUser
nId
=
serveJobsAPI
NewNodeJob
$
\
jHandle
p
->
postNodeAsync
authenticatedUser
nId
p
jHandle
serveJobsAPI
NewNodeJob
$
\
jHandle
p
->
postNodeAsync
authenticatedUser
nId
p
jHandle
...
...
src/Gargantext/API/Node/Update.hs
View file @
405a3082
...
@@ -23,9 +23,10 @@ import Data.Swagger
...
@@ -23,9 +23,10 @@ import Data.Swagger
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.Metrics
qualified
as
Metrics
import
Gargantext.API.Metrics
qualified
as
Metrics
import
Gargantext.API.Ngrams.Types
qualified
as
NgramsTypes
import
Gargantext.API.Ngrams.Types
qualified
as
NgramsTypes
import
Gargantext.API.Prelude
(
GargM
,
GargError
,
simuLogs
)
import
Gargantext.API.Prelude
(
GargM
,
simuLogs
)
import
Gargantext.Core.Methods.Similarities
(
GraphMetric
(
..
))
import
Gargantext.Core.Methods.Similarities
(
GraphMetric
(
..
))
import
Gargantext.Core.NodeStory
(
HasNodeStory
)
import
Gargantext.Core.NodeStory
(
HasNodeStory
)
import
Gargantext.Core.Types.Main
(
ListType
(
..
))
import
Gargantext.Core.Types.Main
(
ListType
(
..
))
...
@@ -88,7 +89,7 @@ data Charts = Sources | Authors | Institutes | Ngrams | All
...
@@ -88,7 +89,7 @@ data Charts = Sources | Authors | Institutes | Ngrams | All
deriving
(
Generic
,
Eq
,
Ord
,
Enum
,
Bounded
)
deriving
(
Generic
,
Eq
,
Ord
,
Enum
,
Bounded
)
------------------------------------------------------------------------
------------------------------------------------------------------------
api
::
NodeId
->
ServerT
API
(
GargM
Env
Garg
Error
)
api
::
NodeId
->
ServerT
API
(
GargM
Env
BackendInternal
Error
)
api
nId
=
api
nId
=
serveJobsAPI
UpdateNodeJob
$
\
jHandle
p
->
serveJobsAPI
UpdateNodeJob
$
\
jHandle
p
->
updateNode
nId
p
jHandle
updateNode
nId
p
jHandle
...
...
src/Gargantext/API/Prelude.hs
View file @
405a3082
...
@@ -20,33 +20,25 @@ module Gargantext.API.Prelude
...
@@ -20,33 +20,25 @@ module Gargantext.API.Prelude
)
)
where
where
import
Control.Lens
(
Prism
'
,
(
#
))
import
Control.Lens
((
#
))
import
Control.Lens.TH
(
makePrisms
)
import
Crypto.JOSE.Error
as
Jose
import
Crypto.JOSE.Error
as
Jose
import
Data.Aeson.Types
import
Data.Aeson.Types
import
Data.Text
qualified
as
Text
import
Data.Typeable
import
Data.Validity
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Admin.Types
import
Gargantext.API.Admin.Types
import
Gargantext.API.Errors.Class
import
Gargantext.Core.Mail.Types
(
HasMail
)
import
Gargantext.Core.Mail.Types
(
HasMail
)
import
Gargantext.Core.NLP
(
HasNLPServer
)
import
Gargantext.Core.NLP
(
HasNLPServer
)
import
Gargantext.Core.NodeStory
import
Gargantext.Core.NodeStory
import
Gargantext.Core.Types
import
Gargantext.Core.Types
import
Gargantext.Database.Prelude
(
CmdM
,
CmdRandom
,
HasConnectionPool
,
HasConfig
)
import
Gargantext.Database.Prelude
(
CmdM
,
CmdRandom
,
HasConnectionPool
,
HasConfig
)
import
Gargantext.Database.Query.Table.Node.Error
(
NodeError
(
..
),
HasNodeError
(
..
))
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
(
..
))
import
Gargantext.Database.Query.Tree
import
Gargantext.Database.Query.Tree
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Gargantext.System.Logging
import
Gargantext.System.Logging
import
Gargantext.Utils.Jobs.Monad
(
MonadJobStatus
(
..
),
JobHandle
)
import
Gargantext.Utils.Jobs.Monad
(
MonadJobStatus
(
..
),
JobHandle
)
import
Gargantext.Utils.Jobs.Monad
qualified
as
Jobs
import
Servant
import
Servant
import
Servant.Job.Async
import
Servant.Job.Async
import
Servant.Job.Core
(
HasServerError
(
..
),
serverError
)
import
Servant.Job.Core
(
HasServerError
(
..
),
serverError
)
import
Servant.Job.Types
qualified
as
SJ
class
HasJoseError
e
where
_JoseError
::
Prism'
e
Jose
.
Error
joseError
::
(
MonadError
e
m
,
HasJoseError
e
)
=>
Jose
.
Error
->
m
a
joseError
::
(
MonadError
e
m
,
HasJoseError
e
)
=>
Jose
.
Error
->
m
a
joseError
=
throwError
.
(
_JoseError
#
)
joseError
=
throwError
.
(
_JoseError
#
)
...
@@ -64,13 +56,13 @@ type EnvC env =
...
@@ -64,13 +56,13 @@ type EnvC env =
)
)
type
ErrC
err
=
type
ErrC
err
=
(
HasNodeError
err
(
HasNodeError
err
,
Has
InvalidError
err
,
Has
ValidationError
err
,
HasTreeError
err
,
HasTreeError
err
,
HasServerError
err
,
HasServerError
err
,
HasJoseError
err
,
HasJoseError
err
-- , ToJSON err -- TODO this is arguable
-- , ToJSON err -- TODO this is arguable
,
Exception
err
,
Exception
err
)
)
type
GargServerC
env
err
m
=
type
GargServerC
env
err
m
=
...
@@ -103,47 +95,6 @@ type GargNoServer' env err m =
...
@@ -103,47 +95,6 @@ type GargNoServer' env err m =
,
HasNodeError
err
,
HasNodeError
err
)
)
-------------------------------------------------------------------
data
GargError
=
GargNodeError
NodeError
|
GargTreeError
TreeError
|
GargInvalidError
Validation
|
GargJoseError
Jose
.
Error
|
GargServerError
ServerError
|
GargJobError
Jobs
.
JobError
deriving
(
Show
,
Typeable
)
makePrisms
''
G
argError
instance
ToJSON
GargError
where
toJSON
(
GargJobError
s
)
=
object
[
(
"status"
,
toJSON
SJ
.
IsFailure
)
,
(
"log"
,
emptyArray
)
,
(
"id"
,
String
id
)
,
(
"error"
,
String
$
Text
.
pack
$
show
s
)
]
where
id
=
case
s
of
Jobs
.
InvalidMacID
i
->
i
_
->
""
toJSON
err
=
object
[(
"error"
,
String
$
Text
.
pack
$
show
err
)]
instance
Exception
GargError
instance
HasNodeError
GargError
where
_NodeError
=
_GargNodeError
instance
HasInvalidError
GargError
where
_InvalidError
=
_GargInvalidError
instance
HasTreeError
GargError
where
_TreeError
=
_GargTreeError
instance
HasServerError
GargError
where
_ServerError
=
_GargServerError
instance
HasJoseError
GargError
where
_JoseError
=
_GargJoseError
------------------------------------------------------------------------
------------------------------------------------------------------------
-- | Utils
-- | Utils
-- | Simulate logs
-- | Simulate logs
...
...
src/Gargantext/API/Routes.hs
View file @
405a3082
...
@@ -28,6 +28,7 @@ import Gargantext.API.Admin.FrontEnd (FrontEndAPI)
...
@@ -28,6 +28,7 @@ import Gargantext.API.Admin.FrontEnd (FrontEndAPI)
import
Gargantext.API.Auth.PolicyCheck
import
Gargantext.API.Auth.PolicyCheck
import
Gargantext.API.Context
import
Gargantext.API.Context
import
Gargantext.API.Count
(
CountAPI
,
count
,
Query
)
import
Gargantext.API.Count
(
CountAPI
,
count
,
Query
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.GraphQL
qualified
as
GraphQL
import
Gargantext.API.GraphQL
qualified
as
GraphQL
import
Gargantext.API.Members
(
MembersAPI
,
members
)
import
Gargantext.API.Members
(
MembersAPI
,
members
)
import
Gargantext.API.Ngrams
(
TableNgramsApi
,
apiNgramsTableDoc
)
import
Gargantext.API.Ngrams
(
TableNgramsApi
,
apiNgramsTableDoc
)
...
@@ -236,7 +237,7 @@ serverGargAdminAPI = roots
...
@@ -236,7 +237,7 @@ serverGargAdminAPI = roots
serverPrivateGargAPI'
serverPrivateGargAPI'
::
AuthenticatedUser
->
ServerT
GargPrivateAPI'
(
GargM
Env
Garg
Error
)
::
AuthenticatedUser
->
ServerT
GargPrivateAPI'
(
GargM
Env
BackendInternal
Error
)
serverPrivateGargAPI'
authenticatedUser
@
(
AuthenticatedUser
userNodeId
userId
)
serverPrivateGargAPI'
authenticatedUser
@
(
AuthenticatedUser
userNodeId
userId
)
=
serverGargAdminAPI
=
serverGargAdminAPI
:<|>
nodeAPI
(
Proxy
::
Proxy
HyperdataAny
)
authenticatedUser
:<|>
nodeAPI
(
Proxy
::
Proxy
HyperdataAny
)
authenticatedUser
...
@@ -293,7 +294,7 @@ waitAPI n = do
...
@@ -293,7 +294,7 @@ waitAPI n = do
pure
$
"Waited: "
<>
show
n
pure
$
"Waited: "
<>
show
n
----------------------------------------
----------------------------------------
addCorpusWithQuery
::
User
->
ServerT
New
.
AddWithQuery
(
GargM
Env
Garg
Error
)
addCorpusWithQuery
::
User
->
ServerT
New
.
AddWithQuery
(
GargM
Env
BackendInternal
Error
)
addCorpusWithQuery
user
cid
=
addCorpusWithQuery
user
cid
=
serveJobsAPI
AddCorpusQueryJob
$
\
jHandle
q
->
do
serveJobsAPI
AddCorpusQueryJob
$
\
jHandle
q
->
do
limit
<-
view
$
hasConfig
.
gc_max_docs_scrapers
limit
<-
view
$
hasConfig
.
gc_max_docs_scrapers
...
@@ -303,7 +304,7 @@ addCorpusWithQuery user cid =
...
@@ -303,7 +304,7 @@ addCorpusWithQuery user cid =
liftBase $ log x
liftBase $ log x
-}
-}
addCorpusWithForm
::
User
->
ServerT
New
.
AddWithForm
(
GargM
Env
Garg
Error
)
addCorpusWithForm
::
User
->
ServerT
New
.
AddWithForm
(
GargM
Env
BackendInternal
Error
)
addCorpusWithForm
user
cid
=
addCorpusWithForm
user
cid
=
serveJobsAPI
AddCorpusFormJob
$
\
jHandle
i
->
do
serveJobsAPI
AddCorpusFormJob
$
\
jHandle
i
->
do
-- /NOTE(adinapoli)/ Track the initial steps outside 'addToCorpusWithForm', because it's
-- /NOTE(adinapoli)/ Track the initial steps outside 'addToCorpusWithForm', because it's
...
@@ -311,12 +312,12 @@ addCorpusWithForm user cid =
...
@@ -311,12 +312,12 @@ addCorpusWithForm user cid =
markStarted
3
jHandle
markStarted
3
jHandle
New
.
addToCorpusWithForm
user
cid
i
jHandle
New
.
addToCorpusWithForm
user
cid
i
jHandle
addCorpusWithFile
::
User
->
ServerT
New
.
AddWithFile
(
GargM
Env
Garg
Error
)
addCorpusWithFile
::
User
->
ServerT
New
.
AddWithFile
(
GargM
Env
BackendInternal
Error
)
addCorpusWithFile
user
cid
=
addCorpusWithFile
user
cid
=
serveJobsAPI
AddCorpusFileJob
$
\
jHandle
i
->
serveJobsAPI
AddCorpusFileJob
$
\
jHandle
i
->
New
.
addToCorpusWithFile
user
cid
i
jHandle
New
.
addToCorpusWithFile
user
cid
i
jHandle
addAnnuaireWithForm
::
ServerT
Annuaire
.
AddWithForm
(
GargM
Env
Garg
Error
)
addAnnuaireWithForm
::
ServerT
Annuaire
.
AddWithForm
(
GargM
Env
BackendInternal
Error
)
addAnnuaireWithForm
cid
=
addAnnuaireWithForm
cid
=
serveJobsAPI
AddAnnuaireFormJob
$
\
jHandle
i
->
serveJobsAPI
AddAnnuaireFormJob
$
\
jHandle
i
->
Annuaire
.
addToAnnuaireWithForm
cid
i
jHandle
Annuaire
.
addToAnnuaireWithForm
cid
i
jHandle
src/Gargantext/API/Server.hs
View file @
405a3082
...
@@ -14,8 +14,6 @@ Portability : POSIX
...
@@ -14,8 +14,6 @@ Portability : POSIX
module
Gargantext.API.Server
where
module
Gargantext.API.Server
where
import
Control.Lens
((
^.
))
import
Control.Lens
((
^.
))
import
Data.Aeson
qualified
as
Aeson
import
Data.ByteString.Lazy.Char8
qualified
as
BL8
import
Data.Version
(
showVersion
)
import
Data.Version
(
showVersion
)
import
Gargantext.API.Admin.Auth
(
auth
,
forgotPassword
,
forgotPasswordAsync
)
import
Gargantext.API.Admin.Auth
(
auth
,
forgotPassword
,
forgotPasswordAsync
)
import
Gargantext.API.Admin.Auth.Types
(
AuthContext
)
import
Gargantext.API.Admin.Auth.Types
(
AuthContext
)
...
@@ -29,15 +27,15 @@ import Gargantext.API.Routes
...
@@ -29,15 +27,15 @@ import Gargantext.API.Routes
import
Gargantext.API.Swagger
(
swaggerDoc
)
import
Gargantext.API.Swagger
(
swaggerDoc
)
import
Gargantext.API.ThrowAll
(
serverPrivateGargAPI
)
import
Gargantext.API.ThrowAll
(
serverPrivateGargAPI
)
import
Gargantext.Database.Prelude
(
hasConfig
)
import
Gargantext.Database.Prelude
(
hasConfig
)
import
Gargantext.Database.Query.Table.Node.Error
(
NodeError
(
..
))
import
Gargantext.Prelude
hiding
(
Handler
)
import
Gargantext.Prelude
hiding
(
Handler
)
import
Gargantext.Prelude.Config
(
gc_url_backend_api
)
import
Gargantext.Prelude.Config
(
gc_url_backend_api
)
import
Paths_gargantext
qualified
as
PG
-- cabal magic build module
import
Paths_gargantext
qualified
as
PG
-- cabal magic build module
import
Servant
import
Servant
import
Servant.Swagger.UI
(
swaggerSchemaUIServer
)
import
Servant.Swagger.UI
(
swaggerSchemaUIServer
)
import
Gargantext.API.Errors
serverGargAPI
::
Text
->
ServerT
GargAPI
(
GargM
Env
Garg
Error
)
serverGargAPI
::
Text
->
ServerT
GargAPI
(
GargM
Env
BackendInternal
Error
)
serverGargAPI
baseUrl
-- orchestrator
serverGargAPI
baseUrl
-- orchestrator
=
auth
=
auth
:<|>
forgotPassword
:<|>
forgotPassword
...
@@ -68,26 +66,5 @@ server env = do
...
@@ -68,26 +66,5 @@ server env = do
GraphQL
.
api
GraphQL
.
api
:<|>
frontEndServer
:<|>
frontEndServer
where
where
-- transform :: forall a. GargM Env GargError a -> Handler a
transformJSON
::
forall
a
.
GargM
Env
BackendInternalError
a
->
Handler
a
-- transform = Handler . withExceptT showAsServantErr . (`runReaderT` env)
transformJSON
::
forall
a
.
GargM
Env
GargError
a
->
Handler
a
transformJSON
=
Handler
.
withExceptT
showAsServantJSONErr
.
(`
runReaderT
`
env
)
transformJSON
=
Handler
.
withExceptT
showAsServantJSONErr
.
(`
runReaderT
`
env
)
showAsServantErr
::
GargError
->
ServerError
showAsServantErr
(
GargNodeError
err
@
(
NoListFound
{}))
=
err404
{
errBody
=
BL8
.
pack
$
show
err
}
showAsServantErr
(
GargNodeError
err
@
NoRootFound
)
=
err404
{
errBody
=
BL8
.
pack
$
show
err
}
showAsServantErr
(
GargNodeError
err
@
NoCorpusFound
)
=
err404
{
errBody
=
BL8
.
pack
$
show
err
}
showAsServantErr
(
GargNodeError
err
@
NoUserFound
{})
=
err404
{
errBody
=
BL8
.
pack
$
show
err
}
showAsServantErr
(
GargNodeError
err
@
(
DoesNotExist
{}))
=
err404
{
errBody
=
BL8
.
pack
$
show
err
}
showAsServantErr
(
GargServerError
err
)
=
err
showAsServantErr
a
=
err500
{
errBody
=
BL8
.
pack
$
show
a
}
showAsServantJSONErr
::
GargError
->
ServerError
showAsServantJSONErr
(
GargNodeError
err
@
(
NoListFound
{}))
=
err404
{
errBody
=
Aeson
.
encode
err
}
showAsServantJSONErr
(
GargNodeError
err
@
NoRootFound
)
=
err404
{
errBody
=
Aeson
.
encode
err
}
showAsServantJSONErr
(
GargNodeError
err
@
NoCorpusFound
)
=
err404
{
errBody
=
Aeson
.
encode
err
}
showAsServantJSONErr
(
GargNodeError
err
@
NoUserFound
{})
=
err404
{
errBody
=
Aeson
.
encode
err
}
showAsServantJSONErr
(
GargNodeError
err
@
(
DoesNotExist
{}))
=
err404
{
errBody
=
Aeson
.
encode
err
}
showAsServantJSONErr
(
GargServerError
err
)
=
err
showAsServantJSONErr
a
=
err500
{
errBody
=
Aeson
.
encode
a
}
src/Gargantext/API/ThrowAll.hs
View file @
405a3082
...
@@ -18,6 +18,7 @@ module Gargantext.API.ThrowAll where
...
@@ -18,6 +18,7 @@ module Gargantext.API.ThrowAll where
import
Control.Lens
((
#
))
import
Control.Lens
((
#
))
import
Gargantext.API.Admin.EnvTypes
(
Env
)
import
Gargantext.API.Admin.EnvTypes
(
Env
)
import
Gargantext.API.Errors.Types
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.API.Routes
(
GargPrivateAPI
,
serverPrivateGargAPI'
)
import
Gargantext.API.Routes
(
GargPrivateAPI
,
serverPrivateGargAPI'
)
import
Gargantext.Prelude
import
Gargantext.Prelude
...
@@ -45,7 +46,7 @@ instance {-# OVERLAPPABLE #-} (MonadError e m) => ThrowAll' e (m a) where
...
@@ -45,7 +46,7 @@ instance {-# OVERLAPPABLE #-} (MonadError e m) => ThrowAll' e (m a) where
throwAll'
=
throwError
throwAll'
=
throwError
serverPrivateGargAPI
serverPrivateGargAPI
::
ServerT
GargPrivateAPI
(
GargM
Env
Garg
Error
)
::
ServerT
GargPrivateAPI
(
GargM
Env
BackendInternal
Error
)
serverPrivateGargAPI
(
Authenticated
auser
)
=
serverPrivateGargAPI'
auser
serverPrivateGargAPI
(
Authenticated
auser
)
=
serverPrivateGargAPI'
auser
serverPrivateGargAPI
_
=
throwAll'
(
_ServerError
#
err401
)
serverPrivateGargAPI
_
=
throwAll'
(
_ServerError
#
err401
)
-- Here throwAll' requires a concrete type for the monad.
-- Here throwAll' requires a concrete type for the monad.
src/Gargantext/Core/Types.hs
View file @
405a3082
...
@@ -23,7 +23,7 @@ module Gargantext.Core.Types ( module Gargantext.Core.Types.Main
...
@@ -23,7 +23,7 @@ module Gargantext.Core.Types ( module Gargantext.Core.Types.Main
,
Term
(
..
),
Terms
(
..
),
TermsCount
,
TermsWithCount
,
Term
(
..
),
Terms
(
..
),
TermsCount
,
TermsWithCount
,
TokenTag
(
..
),
POS
(
..
),
NER
(
..
)
,
TokenTag
(
..
),
POS
(
..
),
NER
(
..
)
,
Label
,
Stems
,
Label
,
Stems
,
Has
Invalid
Error
(
..
),
assertValid
,
Has
Validation
Error
(
..
),
assertValid
,
Name
,
Name
,
TableResult
(
..
),
NodeTableResult
,
TableResult
(
..
),
NodeTableResult
,
Ordering
(
..
)
,
Ordering
(
..
)
...
@@ -171,11 +171,11 @@ instance Monoid TokenTag where
...
@@ -171,11 +171,11 @@ instance Monoid TokenTag where
-- mappend t1 t2 = (<>) t1 t2
-- mappend t1 t2 = (<>) t1 t2
class
Has
Invalid
Error
e
where
class
Has
Validation
Error
e
where
_
Invalid
Error
::
Prism'
e
Validation
_
Validation
Error
::
Prism'
e
Validation
assertValid
::
(
MonadError
e
m
,
Has
Invalid
Error
e
)
=>
Validation
->
m
()
assertValid
::
(
MonadError
e
m
,
Has
Validation
Error
e
)
=>
Validation
->
m
()
assertValid
v
=
when
(
not
$
validationIsValid
v
)
$
throwError
$
_
Invalid
Error
#
v
assertValid
v
=
when
(
not
$
validationIsValid
v
)
$
throwError
$
_
Validation
Error
#
v
-- assertValid :: MonadBase IO m => Validation -> m ()
-- assertValid :: MonadBase IO m => Validation -> m ()
-- assertValid v = when (not $ validationIsValid v) $ fail $ show v
-- assertValid v = when (not $ validationIsValid v) $ fail $ show v
...
...
src/Gargantext/Core/Viz/Graph/API.hs
View file @
405a3082
...
@@ -24,6 +24,7 @@ import Data.HashMap.Strict qualified as HashMap
...
@@ -24,6 +24,7 @@ import Data.HashMap.Strict qualified as HashMap
import
Data.Swagger
import
Data.Swagger
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Errors.Types
import
Gargantext.API.Ngrams.Tools
import
Gargantext.API.Ngrams.Tools
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.Core.Methods.Similarities
(
Similarity
(
..
),
GraphMetric
(
..
),
withMetric
)
import
Gargantext.Core.Methods.Similarities
(
Similarity
(
..
),
GraphMetric
(
..
),
withMetric
)
...
@@ -41,8 +42,8 @@ import Gargantext.Database.Query.Table.Node
...
@@ -41,8 +42,8 @@ import Gargantext.Database.Query.Table.Node
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
)
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
)
import
Gargantext.Database.Query.Table.Node.Select
import
Gargantext.Database.Query.Table.Node.Select
import
Gargantext.Database.Query.Table.Node.UpdateOpaleye
(
updateHyperdata
)
import
Gargantext.Database.Query.Table.Node.UpdateOpaleye
(
updateHyperdata
)
import
Gargantext.Database.Schema.Node
import
Gargantext.Database.Schema.Ngrams
import
Gargantext.Database.Schema.Ngrams
import
Gargantext.Database.Schema.Node
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
))
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
))
import
Servant
import
Servant
...
@@ -70,7 +71,7 @@ instance FromJSON GraphVersions
...
@@ -70,7 +71,7 @@ instance FromJSON GraphVersions
instance
ToJSON
GraphVersions
instance
ToJSON
GraphVersions
instance
ToSchema
GraphVersions
instance
ToSchema
GraphVersions
graphAPI
::
UserId
->
NodeId
->
ServerT
GraphAPI
(
GargM
Env
Garg
Error
)
graphAPI
::
UserId
->
NodeId
->
ServerT
GraphAPI
(
GargM
Env
BackendInternal
Error
)
graphAPI
userId
n
=
getGraph
n
graphAPI
userId
n
=
getGraph
n
:<|>
graphAsync
n
:<|>
graphAsync
n
:<|>
graphClone
userId
n
:<|>
graphClone
userId
n
...
@@ -248,7 +249,7 @@ type GraphAsyncAPI = Summary "Recompute graph"
...
@@ -248,7 +249,7 @@ type GraphAsyncAPI = Summary "Recompute graph"
:>
AsyncJobsAPI
JobLog
()
JobLog
:>
AsyncJobsAPI
JobLog
()
JobLog
graphAsync
::
NodeId
->
ServerT
GraphAsyncAPI
(
GargM
Env
Garg
Error
)
graphAsync
::
NodeId
->
ServerT
GraphAsyncAPI
(
GargM
Env
BackendInternal
Error
)
graphAsync
n
=
graphAsync
n
=
serveJobsAPI
RecomputeGraphJob
$
\
jHandle
_
->
graphRecompute
n
jHandle
serveJobsAPI
RecomputeGraphJob
$
\
jHandle
_
->
graphRecompute
n
jHandle
...
...
src/Gargantext/Database/Action/Flow.hs
View file @
405a3082
...
@@ -86,7 +86,7 @@ import Gargantext.Core.Text.List.Social (FlowSocialListWith(..))
...
@@ -86,7 +86,7 @@ import Gargantext.Core.Text.List.Social (FlowSocialListWith(..))
import
Gargantext.Core.Text.Terms
import
Gargantext.Core.Text.Terms
import
Gargantext.Core.Text.Terms.Mono.Stem.En
(
stemIt
)
import
Gargantext.Core.Text.Terms.Mono.Stem.En
(
stemIt
)
import
Gargantext.Core.Text.Terms.WithList
(
MatchedText
,
buildPatternsWith
,
termsInText
)
import
Gargantext.Core.Text.Terms.WithList
(
MatchedText
,
buildPatternsWith
,
termsInText
)
import
Gargantext.Core.Types
(
Has
Invalid
Error
,
POS
(
NP
),
TermsCount
)
import
Gargantext.Core.Types
(
Has
Validation
Error
,
POS
(
NP
),
TermsCount
)
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Main
import
Gargantext.Core.Types.Main
import
Gargantext.Core.Types.Query
(
Limit
)
import
Gargantext.Core.Types.Query
(
Limit
)
...
@@ -193,7 +193,7 @@ flowDataText :: forall env err m.
...
@@ -193,7 +193,7 @@ flowDataText :: forall env err m.
,
MonadLogger
m
,
MonadLogger
m
,
HasNLPServer
env
,
HasNLPServer
env
,
HasTreeError
err
,
HasTreeError
err
,
Has
Invalid
Error
err
,
Has
Validation
Error
err
,
MonadJobStatus
m
,
MonadJobStatus
m
)
)
=>
User
=>
User
...
@@ -222,7 +222,7 @@ flowAnnuaire :: ( DbCmd' env err m
...
@@ -222,7 +222,7 @@ flowAnnuaire :: ( DbCmd' env err m
,
MonadLogger
m
,
MonadLogger
m
,
HasNLPServer
env
,
HasNLPServer
env
,
HasTreeError
err
,
HasTreeError
err
,
Has
Invalid
Error
err
,
Has
Validation
Error
err
,
MonadJobStatus
m
)
,
MonadJobStatus
m
)
=>
User
=>
User
->
Either
CorpusName
[
CorpusId
]
->
Either
CorpusName
[
CorpusId
]
...
@@ -241,7 +241,7 @@ flowCorpusFile :: ( DbCmd' env err m
...
@@ -241,7 +241,7 @@ flowCorpusFile :: ( DbCmd' env err m
,
MonadLogger
m
,
MonadLogger
m
,
HasNLPServer
env
,
HasNLPServer
env
,
HasTreeError
err
,
HasTreeError
err
,
Has
Invalid
Error
err
,
Has
Validation
Error
err
,
MonadJobStatus
m
)
,
MonadJobStatus
m
)
=>
User
=>
User
->
Either
CorpusName
[
CorpusId
]
->
Either
CorpusName
[
CorpusId
]
...
@@ -270,7 +270,7 @@ flowCorpus :: ( DbCmd' env err m
...
@@ -270,7 +270,7 @@ flowCorpus :: ( DbCmd' env err m
,
MonadLogger
m
,
MonadLogger
m
,
HasNLPServer
env
,
HasNLPServer
env
,
HasTreeError
err
,
HasTreeError
err
,
Has
Invalid
Error
err
,
Has
Validation
Error
err
,
FlowCorpus
a
,
FlowCorpus
a
,
MonadJobStatus
m
)
,
MonadJobStatus
m
)
=>
User
=>
User
...
@@ -289,7 +289,7 @@ flow :: forall env err m a c.
...
@@ -289,7 +289,7 @@ flow :: forall env err m a c.
,
MonadLogger
m
,
MonadLogger
m
,
HasNLPServer
env
,
HasNLPServer
env
,
HasTreeError
err
,
HasTreeError
err
,
Has
Invalid
Error
err
,
Has
Validation
Error
err
,
FlowCorpus
a
,
FlowCorpus
a
,
MkCorpus
c
,
MkCorpus
c
,
MonadJobStatus
m
,
MonadJobStatus
m
...
@@ -366,7 +366,7 @@ createNodes user corpusName ctype = do
...
@@ -366,7 +366,7 @@ createNodes user corpusName ctype = do
flowCorpusUser
::
(
HasNodeError
err
flowCorpusUser
::
(
HasNodeError
err
,
Has
Invalid
Error
err
,
Has
Validation
Error
err
,
HasNLPServer
env
,
HasNLPServer
env
,
HasTreeError
err
,
HasTreeError
err
,
HasNodeStory
env
err
m
,
HasNodeStory
env
err
m
...
...
src/Gargantext/Database/Action/Flow/List.hs
View file @
405a3082
...
@@ -28,7 +28,7 @@ import Gargantext.API.Ngrams (saveNodeStory)
...
@@ -28,7 +28,7 @@ import Gargantext.API.Ngrams (saveNodeStory)
import
Gargantext.API.Ngrams.Tools
(
getNodeStoryVar
)
import
Gargantext.API.Ngrams.Tools
(
getNodeStoryVar
)
import
Gargantext.API.Ngrams.Types
import
Gargantext.API.Ngrams.Types
import
Gargantext.Core.NodeStory
import
Gargantext.Core.NodeStory
import
Gargantext.Core.Types
(
Has
Invalid
Error
(
..
),
assertValid
)
import
Gargantext.Core.Types
(
Has
Validation
Error
(
..
),
assertValid
)
import
Gargantext.Core.Types.Main
(
ListType
(
CandidateTerm
))
import
Gargantext.Core.Types.Main
(
ListType
(
CandidateTerm
))
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Query.Table.Ngrams
qualified
as
TableNgrams
import
Gargantext.Database.Query.Table.Ngrams
qualified
as
TableNgrams
...
@@ -79,7 +79,7 @@ flowList_Tficf' u m nt f = do
...
@@ -79,7 +79,7 @@ flowList_Tficf' u m nt f = do
------------------------------------------------------------------------
------------------------------------------------------------------------
flowList_DbRepo
::
(
Has
Invalid
Error
err
,
HasNodeStory
env
err
m
)
flowList_DbRepo
::
(
Has
Validation
Error
err
,
HasNodeStory
env
err
m
)
=>
ListId
=>
ListId
->
Map
NgramsType
[
NgramsElement
]
->
Map
NgramsType
[
NgramsElement
]
->
m
ListId
->
m
ListId
...
@@ -154,7 +154,7 @@ toNodeNgramsW' l'' ngs = [ NodeNgrams { _nng_id = Nothing
...
@@ -154,7 +154,7 @@ toNodeNgramsW' l'' ngs = [ NodeNgrams { _nng_id = Nothing
]
]
listInsert
::
(
Has
Invalid
Error
err
,
HasNodeStory
env
err
m
)
listInsert
::
(
Has
Validation
Error
err
,
HasNodeStory
env
err
m
)
=>
ListId
=>
ListId
->
Map
NgramsType
[
NgramsElement
]
->
Map
NgramsType
[
NgramsElement
]
->
m
()
->
m
()
...
@@ -168,7 +168,7 @@ listInsert lId ngs = mapM_ (\(typeList, ngElmts)
...
@@ -168,7 +168,7 @@ listInsert lId ngs = mapM_ (\(typeList, ngElmts)
-- This function is maintained for its usage in Database.Action.Flow.List.
-- This function is maintained for its usage in Database.Action.Flow.List.
-- If the given list of ngrams elements contains ngrams already in
-- If the given list of ngrams elements contains ngrams already in
-- the repo, they will be ignored.
-- the repo, they will be ignored.
putListNgrams
::
(
Has
Invalid
Error
err
,
HasNodeStory
env
err
m
)
putListNgrams
::
(
Has
Validation
Error
err
,
HasNodeStory
env
err
m
)
=>
NodeId
=>
NodeId
->
TableNgrams
.
NgramsType
->
TableNgrams
.
NgramsType
->
[
NgramsElement
]
->
[
NgramsElement
]
...
@@ -178,7 +178,7 @@ putListNgrams nodeId ngramsType nes = putListNgrams' nodeId ngramsType m
...
@@ -178,7 +178,7 @@ putListNgrams nodeId ngramsType nes = putListNgrams' nodeId ngramsType m
where
where
m
=
Map
.
fromList
$
map
(
\
n
->
(
n
^.
ne_ngrams
,
ngramsElementToRepo
n
))
nes
m
=
Map
.
fromList
$
map
(
\
n
->
(
n
^.
ne_ngrams
,
ngramsElementToRepo
n
))
nes
putListNgrams'
::
(
Has
Invalid
Error
err
,
HasNodeStory
env
err
m
)
putListNgrams'
::
(
Has
Validation
Error
err
,
HasNodeStory
env
err
m
)
=>
NodeId
=>
NodeId
->
TableNgrams
.
NgramsType
->
TableNgrams
.
NgramsType
->
Map
NgramsTerm
NgramsRepoElement
->
Map
NgramsTerm
NgramsRepoElement
...
...
src/Gargantext/Database/Action/Flow/Types.hs
View file @
405a3082
...
@@ -21,7 +21,7 @@ module Gargantext.Database.Action.Flow.Types
...
@@ -21,7 +21,7 @@ module Gargantext.Database.Action.Flow.Types
import
Data.Aeson
(
ToJSON
)
import
Data.Aeson
(
ToJSON
)
import
Gargantext.Core.Types
(
Has
Invalid
Error
)
import
Gargantext.Core.Types
(
Has
Validation
Error
)
import
Gargantext.Core.Flow.Types
import
Gargantext.Core.Flow.Types
import
Gargantext.Core.Text
import
Gargantext.Core.Text
import
Gargantext.Core.NodeStory
import
Gargantext.Core.NodeStory
...
@@ -36,7 +36,7 @@ type FlowCmdM env err m =
...
@@ -36,7 +36,7 @@ type FlowCmdM env err m =
(
CmdM
env
err
m
(
CmdM
env
err
m
,
HasNodeStory
env
err
m
,
HasNodeStory
env
err
m
,
HasNodeError
err
,
HasNodeError
err
,
Has
Invalid
Error
err
,
Has
Validation
Error
err
,
HasTreeError
err
,
HasTreeError
err
,
MonadLogger
m
,
MonadLogger
m
)
)
...
...
src/Gargantext/Database/Query/Table/Node/Error.hs
View file @
405a3082
...
@@ -22,7 +22,7 @@ import Gargantext.Prelude hiding (sum, head)
...
@@ -22,7 +22,7 @@ import Gargantext.Prelude hiding (sum, head)
import
Prelude
qualified
import
Prelude
qualified
------------------------------------------------------------------------
------------------------------------------------------------------------
data
NodeError
=
NoListFound
{
listId
::
ListId
}
data
NodeError
=
NoListFound
ListId
|
NoRootFound
|
NoRootFound
|
NoCorpusFound
|
NoCorpusFound
|
NoUserFound
User
|
NoUserFound
User
...
@@ -60,7 +60,7 @@ instance Prelude.Show NodeError
...
@@ -60,7 +60,7 @@ instance Prelude.Show NodeError
show
(
QueryNoParse
err
)
=
"QueryNoParse: "
<>
T
.
unpack
err
show
(
QueryNoParse
err
)
=
"QueryNoParse: "
<>
T
.
unpack
err
instance
ToJSON
NodeError
where
instance
ToJSON
NodeError
where
toJSON
(
NoListFound
{
listId
}
)
=
toJSON
(
NoListFound
listId
)
=
object
[
(
"error"
,
"No list found"
)
object
[
(
"error"
,
"No list found"
)
,
(
"listId"
,
toJSON
listId
)
]
,
(
"listId"
,
toJSON
listId
)
]
toJSON
err
=
toJSON
err
=
...
...
src/Gargantext/Utils/Jobs.hs
View file @
405a3082
...
@@ -28,6 +28,7 @@ import Text.Read (readMaybe)
...
@@ -28,6 +28,7 @@ import Text.Read (readMaybe)
import
qualified
Data.Text
as
T
import
qualified
Data.Text
as
T
import
Gargantext.API.Admin.EnvTypes
import
Gargantext.API.Admin.EnvTypes
import
Gargantext.API.Errors.Types
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
qualified
Gargantext.Utils.Jobs.Internal
as
Internal
import
qualified
Gargantext.Utils.Jobs.Internal
as
Internal
import
Gargantext.Utils.Jobs.Monad
import
Gargantext.Utils.Jobs.Monad
...
@@ -36,8 +37,8 @@ import Gargantext.System.Logging
...
@@ -36,8 +37,8 @@ import Gargantext.System.Logging
import
qualified
Servant.Job.Async
as
SJ
import
qualified
Servant.Job.Async
as
SJ
jobErrorToGargError
jobErrorToGargError
::
JobError
->
Garg
Error
::
JobError
->
BackendInternal
Error
jobErrorToGargError
=
Garg
JobError
jobErrorToGargError
=
Internal
JobError
serveJobsAPI
serveJobsAPI
::
(
::
(
...
@@ -47,7 +48,7 @@ serveJobsAPI
...
@@ -47,7 +48,7 @@ serveJobsAPI
,
ToJSON
(
JobEventType
m
)
,
ToJSON
(
JobEventType
m
)
,
ToJSON
(
JobOutputType
m
)
,
ToJSON
(
JobOutputType
m
)
,
MonadJobStatus
m
,
MonadJobStatus
m
,
m
~
(
GargM
Env
Garg
Error
)
,
m
~
(
GargM
Env
BackendInternal
Error
)
,
JobEventType
m
~
JobOutputType
m
,
JobEventType
m
~
JobOutputType
m
)
)
=>
JobType
m
=>
JobType
m
...
...
test/Test/API/Setup.hs
View file @
405a3082
...
@@ -10,6 +10,7 @@ import Gargantext.API (makeApp)
...
@@ -10,6 +10,7 @@ import Gargantext.API (makeApp)
import
Gargantext.API.Admin.EnvTypes
(
Mode
(
Mock
),
Env
(
..
))
import
Gargantext.API.Admin.EnvTypes
(
Mode
(
Mock
),
Env
(
..
))
import
Gargantext.API.Admin.Settings
import
Gargantext.API.Admin.Settings
import
Gargantext.API.Admin.Types
import
Gargantext.API.Admin.Types
import
Gargantext.API.Errors.Types
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.Core.NLP
import
Gargantext.Core.NLP
import
Gargantext.Core.NodeStory
import
Gargantext.Core.NodeStory
...
@@ -41,7 +42,7 @@ import qualified Network.Wai.Handler.Warp as Wai
...
@@ -41,7 +42,7 @@ import qualified Network.Wai.Handler.Warp as Wai
import
qualified
Servant.Job.Async
as
ServantAsync
import
qualified
Servant.Job.Async
as
ServantAsync
newTestEnv
::
TestEnv
->
Logger
(
GargM
Env
Garg
Error
)
->
Warp
.
Port
->
IO
Env
newTestEnv
::
TestEnv
->
Logger
(
GargM
Env
BackendInternal
Error
)
->
Warp
.
Port
->
IO
Env
newTestEnv
testEnv
logger
port
=
do
newTestEnv
testEnv
logger
port
=
do
file
<-
fakeIniPath
file
<-
fakeIniPath
!
manager_env
<-
newTlsManager
!
manager_env
<-
newTlsManager
...
...
test/Test/Database/Types.hs
View file @
405a3082
...
@@ -29,6 +29,7 @@ import Gargantext hiding (to)
...
@@ -29,6 +29,7 @@ import Gargantext hiding (to)
import
Gargantext.API.Admin.EnvTypes
import
Gargantext.API.Admin.EnvTypes
import
Gargantext.API.Admin.EnvTypes
qualified
as
EnvTypes
import
Gargantext.API.Admin.EnvTypes
qualified
as
EnvTypes
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Errors.Types
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.Core.Mail.Types
(
HasMail
(
..
))
import
Gargantext.Core.Mail.Types
(
HasMail
(
..
))
import
Gargantext.Core.NLP
(
HasNLPServer
(
..
))
import
Gargantext.Core.NLP
(
HasNLPServer
(
..
))
...
@@ -58,7 +59,7 @@ data TestEnv = TestEnv {
...
@@ -58,7 +59,7 @@ data TestEnv = TestEnv {
test_db
::
!
DBHandle
test_db
::
!
DBHandle
,
test_config
::
!
GargConfig
,
test_config
::
!
GargConfig
,
test_usernameGen
::
!
Counter
,
test_usernameGen
::
!
Counter
,
test_logger
::
!
(
Logger
(
GargM
TestEnv
Garg
Error
))
,
test_logger
::
!
(
Logger
(
GargM
TestEnv
BackendInternal
Error
))
}
}
newtype
TestMonad
a
=
TestMonad
{
runTestMonad
::
ReaderT
TestEnv
IO
a
}
newtype
TestMonad
a
=
TestMonad
{
runTestMonad
::
ReaderT
TestEnv
IO
a
}
...
@@ -71,7 +72,7 @@ newtype TestMonad a = TestMonad { runTestMonad :: ReaderT TestEnv IO a }
...
@@ -71,7 +72,7 @@ newtype TestMonad a = TestMonad { runTestMonad :: ReaderT TestEnv IO a }
)
)
instance
MonadJobStatus
TestMonad
where
instance
MonadJobStatus
TestMonad
where
type
JobHandle
TestMonad
=
EnvTypes
.
ConcreteJobHandle
Garg
Error
type
JobHandle
TestMonad
=
EnvTypes
.
ConcreteJobHandle
BackendInternal
Error
type
JobType
TestMonad
=
GargJob
type
JobType
TestMonad
=
GargJob
type
JobOutputType
TestMonad
=
JobLog
type
JobOutputType
TestMonad
=
JobLog
type
JobEventType
TestMonad
=
JobLog
type
JobEventType
TestMonad
=
JobLog
...
@@ -116,17 +117,17 @@ coreNLPConfig =
...
@@ -116,17 +117,17 @@ coreNLPConfig =
instance
HasNLPServer
TestEnv
where
instance
HasNLPServer
TestEnv
where
nlpServer
=
to
$
const
(
Map
.
singleton
EN
coreNLPConfig
)
nlpServer
=
to
$
const
(
Map
.
singleton
EN
coreNLPConfig
)
instance
MonadLogger
(
GargM
TestEnv
Garg
Error
)
where
instance
MonadLogger
(
GargM
TestEnv
BackendInternal
Error
)
where
getLogger
=
asks
test_logger
getLogger
=
asks
test_logger
instance
HasLogger
(
GargM
TestEnv
Garg
Error
)
where
instance
HasLogger
(
GargM
TestEnv
BackendInternal
Error
)
where
data
instance
Logger
(
GargM
TestEnv
Garg
Error
)
=
data
instance
Logger
(
GargM
TestEnv
BackendInternal
Error
)
=
GargTestLogger
{
GargTestLogger
{
test_logger_mode
::
Mode
test_logger_mode
::
Mode
,
test_logger_set
::
FL
.
LoggerSet
,
test_logger_set
::
FL
.
LoggerSet
}
}
type
instance
LogInitParams
(
GargM
TestEnv
Garg
Error
)
=
Mode
type
instance
LogInitParams
(
GargM
TestEnv
BackendInternal
Error
)
=
Mode
type
instance
LogPayload
(
GargM
TestEnv
Garg
Error
)
=
FL
.
LogStr
type
instance
LogPayload
(
GargM
TestEnv
BackendInternal
Error
)
=
FL
.
LogStr
initLogger
=
\
mode
->
do
initLogger
=
\
mode
->
do
test_logger_set
<-
liftIO
$
FL
.
newStderrLoggerSet
FL
.
defaultBufSize
test_logger_set
<-
liftIO
$
FL
.
newStderrLoggerSet
FL
.
defaultBufSize
pure
$
GargTestLogger
mode
test_logger_set
pure
$
GargTestLogger
mode
test_logger_set
...
...
test/Test/Utils/Jobs.hs
View file @
405a3082
...
@@ -26,6 +26,7 @@ import Data.Time
...
@@ -26,6 +26,7 @@ import Data.Time
import
Debug.RecoverRTTI
(
anythingToString
)
import
Debug.RecoverRTTI
(
anythingToString
)
import
Gargantext.API.Admin.EnvTypes
as
EnvTypes
import
Gargantext.API.Admin.EnvTypes
as
EnvTypes
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Errors.Types
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Gargantext.Utils.Jobs.Internal
(
newJob
)
import
Gargantext.Utils.Jobs.Internal
(
newJob
)
...
@@ -215,14 +216,14 @@ testFairness = do
...
@@ -215,14 +216,14 @@ testFairness = do
newtype
MyDummyMonad
a
=
newtype
MyDummyMonad
a
=
MyDummyMonad
{
_MyDummyMonad
::
GargM
Env
Garg
Error
a
}
MyDummyMonad
{
_MyDummyMonad
::
GargM
Env
BackendInternal
Error
a
}
deriving
(
Functor
,
Applicative
,
Monad
,
MonadIO
,
MonadReader
Env
)
deriving
(
Functor
,
Applicative
,
Monad
,
MonadIO
,
MonadReader
Env
)
instance
MonadJob
MyDummyMonad
GargJob
(
Seq
JobLog
)
JobLog
where
instance
MonadJob
MyDummyMonad
GargJob
(
Seq
JobLog
)
JobLog
where
getJobEnv
=
MyDummyMonad
getJobEnv
getJobEnv
=
MyDummyMonad
getJobEnv
instance
MonadJobStatus
MyDummyMonad
where
instance
MonadJobStatus
MyDummyMonad
where
type
JobHandle
MyDummyMonad
=
EnvTypes
.
ConcreteJobHandle
Garg
Error
type
JobHandle
MyDummyMonad
=
EnvTypes
.
ConcreteJobHandle
BackendInternal
Error
type
JobType
MyDummyMonad
=
GargJob
type
JobType
MyDummyMonad
=
GargJob
type
JobOutputType
MyDummyMonad
=
JobLog
type
JobOutputType
MyDummyMonad
=
JobLog
type
JobEventType
MyDummyMonad
=
JobLog
type
JobEventType
MyDummyMonad
=
JobLog
...
@@ -252,7 +253,7 @@ withJob :: Env
...
@@ -252,7 +253,7 @@ withJob :: Env
->
IO
(
SJ
.
JobStatus
'S
J
.
Safe
JobLog
)
->
IO
(
SJ
.
JobStatus
'S
J
.
Safe
JobLog
)
withJob
env
f
=
runMyDummyMonad
env
$
MyDummyMonad
$
withJob
env
f
=
runMyDummyMonad
env
$
MyDummyMonad
$
-- the job type doesn't matter in our tests, we use a random one, as long as it's of type 'GargJob'.
-- the job type doesn't matter in our tests, we use a random one, as long as it's of type 'GargJob'.
newJob
@
_
@
Garg
Error
mkJobHandle
(
pure
env
)
RecomputeGraphJob
(
\
_
hdl
input
->
newJob
@
_
@
BackendInternal
Error
mkJobHandle
(
pure
env
)
RecomputeGraphJob
(
\
_
hdl
input
->
runMyDummyMonad
env
$
(
Right
<$>
(
f
hdl
input
>>
getLatestJobStatus
hdl
)))
(
SJ
.
JobInput
()
Nothing
)
runMyDummyMonad
env
$
(
Right
<$>
(
f
hdl
input
>>
getLatestJobStatus
hdl
)))
(
SJ
.
JobInput
()
Nothing
)
withJob_
::
Env
withJob_
::
Env
...
...
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