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
65750c75
Commit
65750c75
authored
May 28, 2024
by
Alfredo Di Napoli
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove old (unnamed) API
This beefy commit removes the old (unnamed) Servant API.
parent
6240e820
Changes
50
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
50 changed files
with
322 additions
and
918 deletions
+322
-918
Main.hs
bin/gargantext-invitations/Main.hs
+2
-1
cabal.project.freeze
cabal.project.freeze
+1
-1
gargantext.cabal
gargantext.cabal
+6
-1
Auth.hs
src/Gargantext/API/Admin/Auth.hs
+1
-14
Context.hs
src/Gargantext/API/Context.hs
+0
-3
Members.hs
src/Gargantext/API/Members.hs
+0
-3
Metrics.hs
src/Gargantext/API/Metrics.hs
+0
-53
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+2
-47
List.hs
src/Gargantext/API/Ngrams/List.hs
+1
-34
Node.hs
src/Gargantext/API/Node.hs
+10
-120
Contact.hs
src/Gargantext/API/Node/Contact.hs
+1
-11
Export.hs
src/Gargantext/API/Node/Corpus/Export.hs
+2
-9
Types.hs
src/Gargantext/API/Node/Document/Export/Types.hs
+1
-10
DocumentUpload.hs
src/Gargantext/API/Node/DocumentUpload.hs
+5
-43
Types.hs
src/Gargantext/API/Node/DocumentUpload/Types.hs
+39
-0
DocumentsFromWriteNodes.hs
src/Gargantext/API/Node/DocumentsFromWriteNodes.hs
+5
-24
Types.hs
src/Gargantext/API/Node/DocumentsFromWriteNodes/Types.hs
+23
-0
FrameCalcUpload.hs
src/Gargantext/API/Node/FrameCalcUpload.hs
+5
-25
Types.hs
src/Gargantext/API/Node/FrameCalcUpload/Types.hs
+20
-0
Get.hs
src/Gargantext/API/Node/Get.hs
+0
-16
Types.hs
src/Gargantext/API/Node/Phylo/Export/Types.hs
+1
-10
Share.hs
src/Gargantext/API/Node/Share.hs
+5
-33
Types.hs
src/Gargantext/API/Node/Share/Types.hs
+25
-0
ShareURL.hs
src/Gargantext/API/Node/ShareURL.hs
+0
-6
Update.hs
src/Gargantext/API/Node/Update.hs
+6
-86
Types.hs
src/Gargantext/API/Node/Update/Types.hs
+85
-0
Routes.hs
src/Gargantext/API/Routes.hs
+1
-201
Named.hs
src/Gargantext/API/Routes/Named.hs
+1
-1
Document.hs
src/Gargantext/API/Routes/Named/Document.hs
+2
-2
FrameCalc.hs
src/Gargantext/API/Routes/Named/FrameCalc.hs
+1
-1
Node.hs
src/Gargantext/API/Routes/Named/Node.hs
+1
-1
Private.hs
src/Gargantext/API/Routes/Named/Private.hs
+0
-1
Share.hs
src/Gargantext/API/Routes/Named/Share.hs
+1
-1
Viz.hs
src/Gargantext/API/Routes/Named/Viz.hs
+2
-0
Search.hs
src/Gargantext/API/Search.hs
+1
-17
Viz.hs
src/Gargantext/API/Server/Named/Viz.hs
+1
-1
Swagger.hs
src/Gargantext/API/Swagger.hs
+6
-3
Table.hs
src/Gargantext/API/Table.hs
+0
-19
Types.hs
src/Gargantext/API/Viz/Types.hs
+1
-1
API.hs
src/Gargantext/Core/Viz/Graph/API.hs
+4
-28
API.hs
src/Gargantext/Core/Viz/Phylo/API.hs
+0
-34
Authentication.hs
test/Test/API/Authentication.hs
+3
-3
Errors.hs
test/Test/API/Errors.hs
+10
-8
Private.hs
test/Test/API/Private.hs
+10
-11
Routes.hs
test/Test/API/Routes.hs
+24
-25
UpdateList.hs
test/Test/API/UpdateList.hs
+4
-4
Distance.hs
test/Test/Graph/Distance.hs
+0
-2
Types.hs
test/Test/Types.hs
+1
-1
Utils.hs
test/Test/Utils.hs
+0
-1
Crypto.hs
test/Test/Utils/Crypto.hs
+2
-2
No files found.
bin/gargantext-invitations/Main.hs
View file @
65750c75
...
...
@@ -24,7 +24,8 @@ import Gargantext.Database.Prelude (CmdRandom)
import
Gargantext.Prelude
import
Gargantext.Prelude.Config
(
readConfig
)
import
Prelude
(
read
)
import
qualified
Gargantext.API.Node.Share
as
Share
import
Gargantext.API.Node.Share.Types
qualified
as
Share
import
Gargantext.API.Node.Share
qualified
as
Share
main
::
IO
()
main
=
do
...
...
cabal.project.freeze
View file @
65750c75
...
...
@@ -499,7 +499,7 @@ constraints: any.Cabal ==3.8.1.0,
any.servant-multipart ==0.12.1,
any.servant-multipart-api ==0.12.1,
any.servant-server ==0.20,
any.servant-swagger ==1.
1.11
,
any.servant-swagger ==1.
2
,
any.servant-swagger-ui ==0.3.5.5.0.0,
any.servant-swagger-ui-core ==0.3.5,
any.servant-xml-conduit ==0.1.0.4,
...
...
gargantext.cabal
View file @
65750c75
...
...
@@ -134,9 +134,11 @@ library
Gargantext.API.Node.Corpus.Update
Gargantext.API.Node.File
Gargantext.API.Node.Share
Gargantext.API.Node.Share.Types
Gargantext.API.Node.ShareURL
Gargantext.API.Node.Types
Gargantext.API.Node.Update
Gargantext.API.Node.Update.Types
Gargantext.API.Prelude
Gargantext.API.Routes
Gargantext.API.Routes.Named
...
...
@@ -304,8 +306,11 @@ library
Gargantext.API.Node.Phylo.Export
Gargantext.API.Node.Phylo.Export.Types
Gargantext.API.Node.DocumentUpload
Gargantext.API.Node.DocumentUpload.Types
Gargantext.API.Node.DocumentsFromWriteNodes
Gargantext.API.Node.DocumentsFromWriteNodes.Types
Gargantext.API.Node.FrameCalcUpload
Gargantext.API.Node.FrameCalcUpload.Types
Gargantext.API.Node.Get
Gargantext.API.Node.New
Gargantext.API.Node.New.Types
...
...
@@ -635,7 +640,7 @@ library
, servant-job >= 0.2.0.0
, servant-multipart ^>= 0.12.1
, servant-server >= 0.18.3 && < 0.20
, servant-swagger
^>= 1.1.10
, servant-swagger
>= 1.2
, servant-swagger-ui ^>= 0.3.5.3.5.0
, servant-xml-conduit >= 0.1.0.4
, simple-reflect ^>= 0.3.3
...
...
src/Gargantext/API/Admin/Auth.hs
View file @
65750c75
...
...
@@ -38,9 +38,8 @@ module Gargantext.API.Admin.Auth
,
forgotPasswordAsync
,
withAccess
,
withNamedAccess
,
ForgotPasswordAPI
,
ForgotPasswordAsyncParams
,
ForgotPasswordAsyncAPI
)
where
...
...
@@ -51,7 +50,6 @@ import Data.UUID (UUID, fromText, toText)
import
Data.UUID.V4
(
nextRandom
)
import
Gargantext.API.Admin.Auth.Types
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Types
import
Gargantext.API.Auth.PolicyCheck
import
Gargantext.API.Prelude
(
authenticationError
,
HasServerError
,
GargServerC
,
_ServerError
,
GargM
,
IsGargServer
)
...
...
@@ -232,14 +230,6 @@ User can invite User in Team as NodeNode only if Team in his parents.
All users can access to the Team folder as if they were owner.
-}
type
ForgotPasswordAPI
=
Summary
"Forgot password POST API"
:>
ReqBody
'[
J
SON
]
ForgotPasswordRequest
:>
Post
'[
J
SON
]
ForgotPasswordResponse
:<|>
Summary
"Forgot password GET API"
:>
QueryParam
"uuid"
Text
:>
Get
'[
J
SON
]
ForgotPasswordGet
forgotPassword
::
IsGargServer
env
err
m
=>
Named
.
ForgotPasswordAPI
(
AsServerT
m
)
-- => ForgotPasswordRequest -> Cmd' env err ForgotPasswordResponse
forgotPassword
=
Named
.
ForgotPasswordAPI
...
...
@@ -334,9 +324,6 @@ generateForgotPasswordUUID = do
-- NOTE THe async endpoint is better for the "forget password"
-- request, because the delay in email sending etc won't reveal to
-- malicious users emails of our users in the db
type
ForgotPasswordAsyncAPI
=
Summary
"Forgot password asnc"
:>
AsyncJobs
JobLog
'[
J
SON
]
ForgotPasswordAsyncParams
JobLog
forgotPasswordAsync
::
Named
.
ForgotPasswordAsyncAPI
(
AsServerT
(
GargM
Env
BackendInternalError
))
forgotPasswordAsync
=
Named
.
ForgotPasswordAsyncAPI
$
serveJobsAPI
ForgotPasswordJob
$
\
jHandle
p
->
forgotPasswordAsync'
p
jHandle
...
...
src/Gargantext/API/Context.hs
View file @
65750c75
...
...
@@ -34,9 +34,6 @@ import Gargantext.API.Routes.Named.Context qualified as Named
-------------------------------------------------------------------
-- TODO use Context instead of Node
type
ContextAPI
a
=
Get
'[
J
SON
]
(
Node
a
)
------------------------------------------------------------------------
-- TODO NodeAPI -> ContextAPI
contextAPI
::
(
IsGargServer
env
err
m
,
JSONB
a
...
...
src/Gargantext/API/Members.hs
View file @
65750c75
...
...
@@ -16,11 +16,8 @@ import Gargantext.Database.Action.Share (membersOf)
import
Gargantext.Database.Admin.Types.Node
(
NodeType
(
NodeTeam
))
import
Gargantext.Database.Query.Table.Node
(
getNodesIdWithType
)
import
Gargantext.Prelude
import
Servant
import
Servant.Server.Generic
(
AsServerT
)
type
MembersAPI
=
Get
'[
J
SON
]
[
Text
]
members
::
IsGargServer
err
env
m
=>
Named
.
MembersAPI
(
AsServerT
m
)
members
=
Named
.
MembersAPI
getMembers
...
...
src/Gargantext/API/Metrics.hs
View file @
65750c75
...
...
@@ -47,22 +47,6 @@ import Servant
import
Servant.Server.Generic
(
AsServerT
)
-------------------------------------------------------------
-- | Scatter metrics API
type
ScatterAPI
=
Summary
"SepGen IncExc metrics"
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParam
"limit"
Limit
:>
Get
'[
J
SON
]
(
HashedResponse
Metrics
)
:<|>
Summary
"Scatter update"
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParam
"limit"
Limit
:>
Post
'[
J
SON
]
()
:<|>
"hash"
:>
Summary
"Scatter Hash"
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
Get
'[
J
SON
]
Text
scatterApi
::
IsGargServer
err
env
m
=>
NodeId
->
Named
.
ScatterAPI
(
AsServerT
m
)
scatterApi
id'
=
Named
.
ScatterAPI
{
sepGenEp
=
getScatter
id'
...
...
@@ -143,23 +127,6 @@ getScatterHash cId maybeListId tabType = do
-------------------------------------------------------------
-- | Chart metrics API
type
ChartApi
=
Summary
" Chart API"
:>
QueryParam
"from"
UTCTime
:>
QueryParam
"to"
UTCTime
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
Get
'[
J
SON
]
(
HashedResponse
(
ChartMetrics
Histo
))
:<|>
Summary
"Chart update"
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParam
"limit"
Limit
:>
Post
'[
J
SON
]
()
:<|>
"hash"
:>
Summary
"Chart Hash"
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
Get
'[
J
SON
]
Text
chartApi
::
IsGargServer
err
env
m
=>
NodeId
->
Named
.
ChartAPI
(
AsServerT
m
)
chartApi
id'
=
Named
.
ChartAPI
{
getChartEp
=
getChart
id'
...
...
@@ -321,26 +288,6 @@ getPieHash cId maybeListId tabType = do
-------------------------------------------------------------
-- | Tree metrics API
type
TreeApi
=
Summary
" Tree API"
:>
QueryParam
"from"
UTCTime
:>
QueryParam
"to"
UTCTime
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParamR
"listType"
ListType
:>
Get
'[
J
SON
]
(
HashedResponse
(
ChartMetrics
(
Vector
NgramsTree
)))
:<|>
Summary
"Tree Chart update"
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParamR
"listType"
ListType
:>
Post
'[
J
SON
]
()
:<|>
"hash"
:>
Summary
"Tree Hash"
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParamR
"listType"
ListType
:>
Get
'[
J
SON
]
Text
treeApi
::
IsGargServer
err
env
m
=>
NodeId
->
Named
.
TreeAPI
(
AsServerT
m
)
treeApi
id'
=
Named
.
TreeAPI
{
treeChartEp
=
getTree
id'
...
...
src/Gargantext/API/Ngrams.hs
View file @
65750c75
...
...
@@ -26,11 +26,8 @@ add get
module
Gargantext.API.Ngrams
(
TableNgramsApi
,
TableNgramsApiGet
,
TableNgramsApiPut
,
commitStatePatch
(
commitStatePatch
,
searchTableNgrams
,
getTableNgrams
...
...
@@ -94,7 +91,6 @@ import Data.Set qualified as Set
import
Data.Text
(
isInfixOf
,
toLower
,
unpack
)
import
Data.Text.Lazy.IO
as
DTL
(
writeFile
)
import
Formatting
(
hprint
,
int
,
(
%
))
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Ngrams.Tools
(
getNodeStory
)
import
Gargantext.API.Ngrams.Types
import
Gargantext.Core.NodeStory
(
ArchiveList
,
HasNodeStory
,
HasNodeArchiveStoryImmediateSaver
(
..
),
HasNodeStoryImmediateSaver
(
..
),
NgramsStatePatch
'
,
a_history
,
a_state
,
a_version
,
currentVersion
)
...
...
@@ -106,7 +102,6 @@ import Gargantext.Database.Query.Table.Ngrams ( text2ngrams, insertNgrams )
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
)
import
Gargantext.Prelude
hiding
(
log
,
to
,
toLower
,
(
%
),
isInfixOf
)
import
Gargantext.Prelude.Clock
(
hasTime
,
getTime
)
import
Servant
hiding
(
Patch
)
import
Text.Collate
qualified
as
Unicode
...
...
@@ -591,46 +586,6 @@ needsScores (Just ScoreAsc) = True
needsScores
(
Just
ScoreDesc
)
=
True
needsScores
_
=
False
type
TableNgramsApiGet
=
Summary
" Table Ngrams API Get"
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParamR
"list"
ListId
:>
QueryParamR
"limit"
Limit
:>
QueryParam
"offset"
Offset
:>
QueryParam
"listType"
ListType
:>
QueryParam
"minTermSize"
MinSize
:>
QueryParam
"maxTermSize"
MaxSize
:>
QueryParam
"orderBy"
OrderBy
:>
QueryParam
"search"
Text
:>
Get
'[
J
SON
]
(
VersionedWithCount
NgramsTable
)
type
TableNgramsApiPut
=
Summary
" Table Ngrams API Change"
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParamR
"list"
ListId
:>
ReqBody
'[
J
SON
]
(
Versioned
NgramsTablePatch
)
:>
Put
'[
J
SON
]
(
Versioned
NgramsTablePatch
)
type
RecomputeScoresNgramsApiGet
=
Summary
" Recompute scores for ngrams table"
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParamR
"list"
ListId
:>
"recompute"
:>
Post
'[
J
SON
]
Int
type
TableNgramsApiGetVersion
=
Summary
" Table Ngrams API Get Version"
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParamR
"list"
ListId
:>
Get
'[
J
SON
]
Version
type
TableNgramsApi
=
TableNgramsApiGet
:<|>
TableNgramsApiPut
:<|>
RecomputeScoresNgramsApiGet
:<|>
"version"
:>
TableNgramsApiGetVersion
:<|>
TableNgramsAsyncApi
type
TableNgramsAsyncApi
=
Summary
"Table Ngrams Async API"
:>
"async"
:>
"charts"
:>
"update"
:>
AsyncJobs
JobLog
'[
J
SON
]
UpdateTableNgramsCharts
JobLog
getTableNgramsCorpus
::
(
HasNodeStory
env
err
m
,
HasNodeError
err
)
=>
NodeId
...
...
src/Gargantext/API/Ngrams/List.hs
View file @
65750c75
...
...
@@ -28,15 +28,13 @@ import Data.Text (concat, pack, splitOn)
import
Data.Vector
(
Vector
)
import
Data.Vector
qualified
as
Vec
import
Gargantext.API.Admin.EnvTypes
(
Env
,
GargJob
(
..
))
import
Gargantext.API.Admin.Orchestrator.Types
(
AsyncJobs
,
JobLog
)
import
Gargantext.API.Errors.Types
(
BackendInternalError
)
import
Gargantext.API.Ngrams
(
setListNgrams
)
import
Gargantext.API.Ngrams.List.Types
import
Gargantext.API.Ngrams.Prelude
(
getNgramsList
)
import
Gargantext.API.Ngrams.Types
import
Gargantext.API.Prelude
(
Garg
Server
,
Garg
M
,
serverError
,
HasServerError
)
import
Gargantext.API.Prelude
(
GargM
,
serverError
,
HasServerError
)
import
Gargantext.API.Routes.Named.List
qualified
as
Named
import
Gargantext.API.Types
(
HTML
)
import
Gargantext.Core.NodeStory.Types
(
HasNodeStory
)
import
Gargantext.Core.Text.Ngrams
(
Ngrams
,
NgramsType
(
NgramsTerms
))
import
Gargantext.Core.Types.Main
(
ListType
(
..
))
...
...
@@ -48,24 +46,12 @@ import Gargantext.Database.Schema.Node (_node_parent_id)
import
Gargantext.Database.Types
(
Indexed
(
..
))
import
Gargantext.Prelude
hiding
(
concat
,
toList
)
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
))
import
Gargantext.Utils.Servant
qualified
as
GUS
import
Prelude
qualified
import
Protolude
qualified
as
P
import
Servant
import
Servant.Server.Generic
(
AsServerT
)
------------------------------------------------------------------------
type
GETAPI
=
Summary
"Get List"
:>
"lists"
:>
Capture
"listId"
ListId
:>
(
"json"
:>
Get
'[
J
SON
,
HTML
]
(
Headers
'[
H
eader
"Content-Disposition"
Text
]
NgramsList
)
:<|>
"json.zip"
:>
Get
'[
G
US
.
ZIP
]
(
Headers
'[
H
eader
"Content-Disposition"
Text
]
NgramsListZIP
)
:<|>
"csv"
:>
Get
'[
G
US
.
CSV
]
(
Headers
'[
H
eader
"Content-Disposition"
Text
]
NgramsTableMap
)
)
getAPI
::
Named
.
GETAPI
(
AsServerT
(
GargM
Env
BackendInternalError
))
getAPI
=
Named
.
GETAPI
$
\
listId
->
Named
.
ListEndpoints
{
listJSONEp
=
getJson
listId
...
...
@@ -77,15 +63,6 @@ getAPI = Named.GETAPI $ \listId -> Named.ListEndpoints
-- JSON API
--
----------------------
type
JSONAPI
=
Summary
"Update List"
:>
"lists"
:>
Capture
"listId"
ListId
:>
"add"
:>
"form"
:>
"async"
:>
AsyncJobs
JobLog
'[
F
ormUrlEncoded
]
WithJsonFile
JobLog
jsonAPI
::
Named
.
JSONAPI
(
AsServerT
(
GargM
Env
BackendInternalError
))
jsonAPI
=
jsonPostAsync
...
...
@@ -165,16 +142,6 @@ postAsyncJSON l ngramsList jobHandle = do
-- CSV API
--
----------------------
type
CSVAPI
=
Summary
"Update List (legacy v3 CSV)"
:>
"lists"
:>
Capture
"listId"
ListId
:>
"csv"
:>
"add"
:>
"form"
:>
"async"
:>
AsyncJobs
JobLog
'[
F
ormUrlEncoded
]
WithTextFile
JobLog
csvAPI
::
Named
.
CSVAPI
(
AsServerT
(
GargM
Env
BackendInternalError
))
csvAPI
=
csvPostAsync
...
...
src/Gargantext/API/Node.hs
View file @
65750c75
This diff is collapsed.
Click to expand it.
src/Gargantext/API/Node/Contact.hs
View file @
65750c75
...
...
@@ -23,10 +23,9 @@ module Gargantext.API.Node.Contact
import
Conduit
(
yield
)
import
Gargantext.API.Admin.Auth.Types
(
AuthenticatedUser
(
AuthenticatedUser
)
)
import
Gargantext.API.Admin.EnvTypes
(
Env
,
GargJob
(
..
))
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Errors.Types
(
BackendInternalError
)
import
Gargantext.API.Node
(
nodeNodeAPI
,
NodeNodeAPI
)
import
Gargantext.API.Node
(
nodeNodeAPI
)
import
Gargantext.API.Node.Contact.Types
import
Gargantext.API.Prelude
(
GargM
,
simuLogs
)
import
Gargantext.API.Routes.Named.Contact
qualified
as
Named
...
...
@@ -44,21 +43,12 @@ import Gargantext.Utils.Jobs (serveJobsAPI, MonadJobStatus(..))
import
Servant
import
Servant.Server.Generic
(
AsServerT
)
------------------------------------------------------------------------
type
API
=
"contact"
:>
Summary
"Contact endpoint"
:>
API_Async
:<|>
Capture
"contact_id"
NodeId
:>
NodeNodeAPI
HyperdataContact
contactAPI
::
AuthenticatedUser
->
CorpusId
->
Named
.
ContactAPI
(
AsServerT
(
GargM
Env
BackendInternalError
))
contactAPI
authUser
@
(
AuthenticatedUser
userNodeId
_userUserId
)
cid
=
Named
.
ContactAPI
{
contactAsyncAPI
=
api_async
(
RootId
userNodeId
)
cid
,
getContactEp
=
nodeNodeAPI
(
Proxy
::
Proxy
HyperdataContact
)
authUser
cid
}
type
API_Async
=
AsyncJobs
JobLog
'[
J
SON
]
AddContactParams
JobLog
----------------------------------------------------------------------
api_async
::
User
->
NodeId
->
Named
.
ContactAsyncAPI
(
AsServerT
(
GargM
Env
BackendInternalError
))
api_async
u
nId
=
Named
.
ContactAsyncAPI
$
...
...
src/Gargantext/API/Node/Corpus/Export.hs
View file @
65750c75
...
...
@@ -26,7 +26,7 @@ import Gargantext.API.Ngrams.Tools (filterListWithRoot, mapTermListRoot, getRepo
import
Gargantext.API.Ngrams.Types
(
NgramsTerm
(
unNgramsTerm
)
)
import
Gargantext.API.Node.Corpus.Export.Types
(
Corpus
(
..
)
)
import
Gargantext.API.Node.Document.Export.Types
qualified
as
DocumentExport
import
Gargantext.API.Prelude
(
GargNoServer
,
IsGargServer
)
import
Gargantext.API.Prelude
(
IsGargServer
)
import
Gargantext.Core.NodeStory.Types
(
NodeListStory
)
import
Gargantext.Core.Text.Ngrams
(
NgramsType
(
..
))
import
Gargantext.Core.Types.Main
(
ListType
(
MapTerm
)
)
...
...
@@ -42,17 +42,10 @@ import Gargantext.Database.Query.Table.NodeContext (selectDocNodes)
import
Gargantext.Database.Schema.Context
(
_context_id
)
import
Gargantext.Prelude
hiding
(
hash
)
import
Gargantext.Prelude.Crypto.Hash
(
hash
)
import
Servant
(
Headers
,
Header
,
addHeader
,
Summary
,
(
:>
),
JSON
,
Get
,
QueryParam
)
import
Servant
(
Headers
,
Header
,
addHeader
)
import
Servant.Server.Generic
(
AsServerT
)
import
qualified
Gargantext.API.Routes.Named.Corpus
as
Named
--------------------------------------------------
type
API
=
Summary
"Corpus Export"
:>
"export"
:>
QueryParam
"listId"
ListId
:>
QueryParam
"ngramsType"
NgramsType
:>
Get
'[
J
SON
]
(
Headers
'[
S
ervant
.
Header
"Content-Disposition"
Text
]
Corpus
)
--------------------------------------------------
-- | Hashes are ordered by Set
getCorpus
::
forall
env
err
m
.
IsGargServer
env
err
m
...
...
src/Gargantext/API/Node/Document/Export/Types.hs
View file @
65750c75
...
...
@@ -27,7 +27,7 @@ import Gargantext.Database.Schema.Node (NodePoly(..))
import
Gargantext.Utils.Servant
(
ZIP
)
import
Gargantext.Utils.Zip
(
zipContentsPureWithLastModified
)
import
Protolude
import
Servant
(
(
:>
),
(
:<|>
),
Get
,
Header
,
Headers
(
..
),
JSON
,
MimeRender
(
..
),
PlainText
,
Summary
)
import
Servant
(
MimeRender
(
..
)
)
-- | Document Export
...
...
@@ -101,15 +101,6 @@ instance ToParamSchema Document where
instance
ToParamSchema
Ngrams
where
toParamSchema
_
=
toParamSchema
(
Proxy
::
Proxy
TODO
)
--------------------------------------------------
type
API
=
Summary
"Document Export"
:>
"export"
:>
(
"json"
:>
Get
'[
J
SON
]
(
Headers
'[
S
ervant
.
Header
"Content-Disposition"
Text
]
DocumentExport
)
:<|>
"json.zip"
:>
Get
'[
Z
IP
]
(
Headers
'[
S
ervant
.
Header
"Content-Disposition"
Text
]
DocumentExportZIP
)
:<|>
"csv"
:>
Get
'[
P
lainText
]
(
Headers
'[
S
ervant
.
Header
"Content-Disposition"
Text
]
Text
)
)
$
(
deriveJSON
(
unPrefix
"_ng_"
)
''
N
grams
)
$
(
deriveJSON
(
unPrefix
"_d_"
)
''
D
ocument
)
...
...
src/Gargantext/API/Node/DocumentUpload.hs
View file @
65750c75
...
...
@@ -17,18 +17,16 @@ Portability : POSIX
module
Gargantext.API.Node.DocumentUpload
where
import
Control.Lens
(
view
)
import
Data.Aeson
(
Options
(
..
),
genericParseJSON
,
defaultOptions
,
genericToJSON
,
SumEncoding
(
..
)
)
import
Data.Swagger
(
ToSchema
)
import
Data.Text
qualified
as
T
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Errors.Types
(
BackendInternalError
)
import
Gargantext.API.Node.DocumentUpload.Types
import
Gargantext.API.Prelude
(
GargM
)
import
Gargantext.API.Routes.Named.Document
qualified
as
Named
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.NLP
(
nlpServerGet
)
import
Gargantext.Core.Text.Corpus.Parsers.Date
(
mDateSplit
)
import
Gargantext.Core.Text.Terms
(
TermType
(
..
))
import
Gargantext.Core.Utils.Prefix
(
unCapitalize
,
dropPrefix
)
import
Gargantext.Database.Action.Flow
(
addDocumentsToHyperCorpus
)
import
Gargantext.Database.Action.Flow.Types
(
FlowCmdM
)
import
Gargantext.Database.Admin.Types.Hyperdata.Corpus
(
HyperdataCorpus
)
...
...
@@ -37,47 +35,11 @@ import Gargantext.Database.Admin.Types.Node ( DocId, NodeId, NodeType(NodeCorpus
import
Gargantext.Database.Query.Table.Node
(
getClosestParentIdByType'
)
import
Gargantext.Prelude
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
))
import
Servant
(
JSON
,
Summary
,
type
(
:>
),
HasServer
(
ServerT
)
)
import
Servant
.Server.Generic
(
AsServerT
)
data
DocumentUpload
=
DocumentUpload
{
_du_abstract
::
T
.
Text
,
_du_authors
::
T
.
Text
,
_du_sources
::
T
.
Text
,
_du_title
::
T
.
Text
,
_du_date
::
T
.
Text
,
_du_language
::
T
.
Text
}
deriving
(
Generic
)
$
(
makeLenses
''
D
ocumentUpload
)
instance
ToSchema
DocumentUpload
instance
FromJSON
DocumentUpload
where
parseJSON
=
genericParseJSON
(
defaultOptions
{
sumEncoding
=
ObjectWithSingleField
,
fieldLabelModifier
=
unCapitalize
.
dropPrefix
"_du_"
,
omitNothingFields
=
True
}
)
instance
ToJSON
DocumentUpload
where
toJSON
=
genericToJSON
(
defaultOptions
{
sumEncoding
=
ObjectWithSingleField
,
fieldLabelModifier
=
unCapitalize
.
dropPrefix
"_du_"
,
omitNothingFields
=
True
}
)
type
API
=
Summary
" Document upload"
:>
"document"
:>
"upload"
:>
"async"
:>
AsyncJobs
JobLog
'[
J
SON
]
DocumentUpload
JobLog
api
::
NodeId
->
ServerT
API
(
GargM
Env
BackendInternalError
)
api
nId
=
api
::
NodeId
->
Named
.
DocumentUploadAPI
(
AsServerT
(
GargM
Env
BackendInternalError
))
api
nId
=
Named
.
DocumentUploadAPI
$
serveJobsAPI
UploadDocumentJob
$
\
jHandle
q
->
do
documentUploadAsync
nId
q
jHandle
...
...
src/Gargantext/API/Node/DocumentUpload/Types.hs
0 → 100644
View file @
65750c75
{-# LANGUAGE TemplateHaskell #-}
module
Gargantext.API.Node.DocumentUpload.Types
where
import
Data.Aeson
(
Options
(
..
),
genericParseJSON
,
defaultOptions
,
genericToJSON
,
SumEncoding
(
..
)
)
import
Data.Swagger
(
ToSchema
)
import
Data.Text
qualified
as
T
import
Gargantext.Core.Utils.Prefix
(
unCapitalize
,
dropPrefix
)
import
Gargantext.Prelude
data
DocumentUpload
=
DocumentUpload
{
_du_abstract
::
T
.
Text
,
_du_authors
::
T
.
Text
,
_du_sources
::
T
.
Text
,
_du_title
::
T
.
Text
,
_du_date
::
T
.
Text
,
_du_language
::
T
.
Text
}
deriving
(
Generic
)
$
(
makeLenses
''
D
ocumentUpload
)
instance
ToSchema
DocumentUpload
instance
FromJSON
DocumentUpload
where
parseJSON
=
genericParseJSON
(
defaultOptions
{
sumEncoding
=
ObjectWithSingleField
,
fieldLabelModifier
=
unCapitalize
.
dropPrefix
"_du_"
,
omitNothingFields
=
True
}
)
instance
ToJSON
DocumentUpload
where
toJSON
=
genericToJSON
(
defaultOptions
{
sumEncoding
=
ObjectWithSingleField
,
fieldLabelModifier
=
unCapitalize
.
dropPrefix
"_du_"
,
omitNothingFields
=
True
}
)
src/Gargantext/API/Node/DocumentsFromWriteNodes.hs
View file @
65750c75
...
...
@@ -17,22 +17,20 @@ module Gargantext.API.Node.DocumentsFromWriteNodes
where
import
Conduit
(
yieldMany
)
import
Data.Aeson
(
genericParseJSON
,
defaultOptions
,
genericToJSON
)
import
Data.List
qualified
as
List
import
Data.Swagger
(
ToSchema
)
import
Data.Text
qualified
as
T
import
Gargantext.API.Admin.Auth.Types
(
AuthenticatedUser
,
auth_node_id
,
auth_user_id
)
import
Gargantext.API.Admin.EnvTypes
(
Env
,
GargJob
(
..
))
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Admin.Types
(
HasSettings
)
import
Gargantext.API.Errors.Types
(
BackendInternalError
)
import
Gargantext.API.Ngrams
(
commitStatePatch
,
Versioned
(
..
))
import
Gargantext.API.Node.DocumentsFromWriteNodes.Types
import
Gargantext.API.Prelude
(
GargM
)
import
Gargantext.API.Routes.Named.Document
qualified
as
Named
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.NodeStory
(
HasNodeStoryImmediateSaver
,
HasNodeArchiveStoryImmediateSaver
,
currentVersion
)
import
Gargantext.Core.Text.Corpus.Parsers.Date
(
split'
)
import
Gargantext.Core.Text.Corpus.Parsers.FrameWrite
import
Gargantext.Core.Text.List.Social
(
FlowSocialListWith
)
import
Gargantext.Core.Text.Terms
(
TermType
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Database.Action.Flow
(
flowDataText
,
DataText
(
..
))
...
...
@@ -46,30 +44,13 @@ import Gargantext.Prelude
import
Gargantext.System.Logging
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
))
import
Gargantext.Utils.Jobs.Error
import
Servant
(
JSON
,
Summary
,
type
(
:>
),
HasServer
(
ServerT
)
)
import
Servant
.Server.Generic
(
AsServerT
)
------------------------------------------------------------------------
type
API
=
Summary
" Documents from Write nodes."
:>
AsyncJobs
JobLog
'[
J
SON
]
Params
JobLog
------------------------------------------------------------------------
data
Params
=
Params
{
id
::
Int
,
paragraphs
::
Text
,
lang
::
Lang
,
selection
::
FlowSocialListWith
}
deriving
(
Generic
,
Show
)
instance
FromJSON
Params
where
parseJSON
=
genericParseJSON
defaultOptions
instance
ToJSON
Params
where
toJSON
=
genericToJSON
defaultOptions
instance
ToSchema
Params
------------------------------------------------------------------------
api
::
AuthenticatedUser
-- ^ The logged-in user
->
NodeId
->
ServerT
API
(
GargM
Env
BackendInternalError
)
api
authenticatedUser
nId
=
->
Named
.
DocumentsFromWriteNodesAPI
(
AsServerT
(
GargM
Env
BackendInternalError
)
)
api
authenticatedUser
nId
=
Named
.
DocumentsFromWriteNodesAPI
$
serveJobsAPI
DocumentFromWriteNodeJob
$
\
jHandle
p
->
documentsFromWriteNodes
authenticatedUser
nId
p
jHandle
...
...
src/Gargantext/API/Node/DocumentsFromWriteNodes/Types.hs
0 → 100644
View file @
65750c75
module
Gargantext.API.Node.DocumentsFromWriteNodes.Types
where
import
Data.Aeson
(
genericParseJSON
,
defaultOptions
,
genericToJSON
)
import
Data.Swagger
(
ToSchema
)
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.Text.List.Social
(
FlowSocialListWith
)
import
Gargantext.Prelude
------------------------------------------------------------------------
data
Params
=
Params
{
id
::
Int
,
paragraphs
::
Text
,
lang
::
Lang
,
selection
::
FlowSocialListWith
}
deriving
(
Generic
,
Show
)
instance
FromJSON
Params
where
parseJSON
=
genericParseJSON
defaultOptions
instance
ToJSON
Params
where
toJSON
=
genericToJSON
defaultOptions
instance
ToSchema
Params
------------------------------------------------------------------------
src/Gargantext/API/Node/FrameCalcUpload.hs
View file @
65750c75
...
...
@@ -17,19 +17,17 @@ module Gargantext.API.Node.FrameCalcUpload where
import
Data.ByteString.Lazy
qualified
as
BSL
import
Data.ByteString.UTF8
qualified
as
BSU8
import
Data.Swagger
(
ToSchema
)
import
Data.Text
qualified
as
T
import
Gargantext.API.Admin.Auth.Types
(
auth_node_id
,
AuthenticatedUser
)
import
Gargantext.API.Admin.EnvTypes
(
GargJob
(
..
),
Env
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Errors.Types
(
BackendInternalError
)
import
Gargantext.API.Node.Corpus.New
(
addToCorpusWithForm
)
import
Gargantext.API.Node.Corpus.New.Types
(
FileFormat
(
..
),
FileType
(
..
))
import
Gargantext.API.Node.FrameCalcUpload.Types
import
Gargantext.API.Node.Types
(
NewWithForm
(
..
))
import
Gargantext.API.Prelude
(
GargM
)
import
Gargantext.
Core
(
Lang
)
import
Gargantext.
API.Routes.Named.FrameCalc
qualified
as
Named
import
Gargantext.Core.NodeStory.Types
(
HasNodeArchiveStoryImmediateSaver
)
import
Gargantext.Core.Text.List.Social
(
FlowSocialListWith
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Database.Action.Flow.Types
(
FlowCmdM
)
import
Gargantext.Database.Admin.Types.Hyperdata.Frame
(
HyperdataFrame
(
..
)
)
...
...
@@ -41,29 +39,11 @@ import Gargantext.Prelude
import
Gargantext.Utils.Jobs
(
serveJobsAPI
,
MonadJobStatus
(
..
),
markFailureNoErr
)
import
Network.HTTP.Client
(
newManager
,
httpLbs
,
parseRequest
,
responseBody
)
import
Network.HTTP.Client.TLS
(
tlsManagerSettings
)
import
Servant
(
type
(
:>
),
JSON
,
Summary
,
HasServer
(
ServerT
)
)
import
Web.FormUrlEncoded
(
FromForm
)
import
Servant.Server.Generic
(
AsServerT
)
data
FrameCalcUpload
=
FrameCalcUpload
{
_wf_lang
::
!
(
Maybe
Lang
)
,
_wf_selection
::
!
FlowSocialListWith
}
deriving
(
Generic
)
instance
FromForm
FrameCalcUpload
instance
FromJSON
FrameCalcUpload
instance
ToJSON
FrameCalcUpload
instance
ToSchema
FrameCalcUpload
type
API
=
Summary
" FrameCalc upload"
:>
"add"
:>
"framecalc"
:>
"async"
:>
AsyncJobs
JobLog
'[
J
SON
]
FrameCalcUpload
JobLog
api
::
AuthenticatedUser
->
NodeId
->
ServerT
API
(
GargM
Env
BackendInternalError
)
api
authenticatedUser
nId
=
api
::
AuthenticatedUser
->
NodeId
->
Named
.
FrameCalcAPI
(
AsServerT
(
GargM
Env
BackendInternalError
))
api
authenticatedUser
nId
=
Named
.
FrameCalcAPI
$
serveJobsAPI
UploadFrameCalcJob
$
\
jHandle
p
->
frameCalcUploadAsync
authenticatedUser
nId
p
jHandle
...
...
src/Gargantext/API/Node/FrameCalcUpload/Types.hs
0 → 100644
View file @
65750c75
module
Gargantext.API.Node.FrameCalcUpload.Types
where
import
Data.Swagger
(
ToSchema
)
import
Gargantext.Core
(
Lang
)
import
Gargantext.Core.Text.List.Social
(
FlowSocialListWith
(
..
))
import
Gargantext.Prelude
import
Web.FormUrlEncoded
(
FromForm
)
data
FrameCalcUpload
=
FrameCalcUpload
{
_wf_lang
::
!
(
Maybe
Lang
)
,
_wf_selection
::
!
FlowSocialListWith
}
<