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
153
Issues
153
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
43f3d9cd
Commit
43f3d9cd
authored
Oct 14, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[document upload] fix to/from json
parent
abb0ce3c
Pipeline
#1974
failed with stage
in 10 minutes and 26 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
11 deletions
+24
-11
DocumentUpload.hs
src/Gargantext/API/Node/DocumentUpload.hs
+24
-11
No files found.
src/Gargantext/API/Node/DocumentUpload.hs
View file @
43f3d9cd
...
...
@@ -14,7 +14,6 @@ import Data.Time.Calendar
import
GHC.Generics
(
Generic
)
import
Servant
import
Servant.Job.Async
import
Web.FormUrlEncoded
(
FromForm
)
import
Gargantext.API.Admin.Orchestrator.Types
(
JobLog
(
..
),
AsyncJobs
)
import
Gargantext.API.Job
(
jobLogSuccess
)
...
...
@@ -22,6 +21,7 @@ import Gargantext.API.Prelude
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.Text.Terms
(
TermType
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Utils.Prefix
(
unCapitalize
,
dropPrefix
)
import
Gargantext.Database.Action.Flow
(
flowDataText
,
DataText
(
..
))
import
Gargantext.Database.Action.Flow.Types
import
Gargantext.Database.Admin.Types.Hyperdata.Document
(
HyperdataDocument
(
..
))
...
...
@@ -30,18 +30,31 @@ import Gargantext.Database.Query.Table.Node (getClosestParentIdByType')
import
Gargantext.Prelude
data
DocumentUpload
=
DocumentUpload
{
_abstract
::
T
.
Text
,
_authors
::
T
.
Text
,
_sources
::
T
.
Text
,
_title
::
T
.
Text
}
{
_
du_
abstract
::
T
.
Text
,
_
du_
authors
::
T
.
Text
,
_
du_
sources
::
T
.
Text
,
_
du_
title
::
T
.
Text
}
deriving
(
Generic
)
$
(
makeLenses
''
D
ocumentUpload
)
instance
FromForm
DocumentUpload
instance
ToSchema
DocumentUpload
instance
FromJSON
DocumentUpload
where
parseJSON
=
genericParseJSON
(
defaultOptions
{
sumEncoding
=
ObjectWithSingleField
,
fieldLabelModifier
=
unCapitalize
.
dropPrefix
"_du_"
,
omitNothingFields
=
True
}
)
instance
ToJSON
DocumentUpload
instance
ToSchema
DocumentUpload
where
toJSON
=
genericToJSON
(
defaultOptions
{
sumEncoding
=
ObjectWithSingleField
,
fieldLabelModifier
=
unCapitalize
.
dropPrefix
"_du_"
,
omitNothingFields
=
True
}
)
type
API
=
Summary
" Document upload"
:>
"document"
...
...
@@ -83,11 +96,11 @@ documentUpload uId nId doc logStatus = do
,
_hd_uniqId
=
Nothing
,
_hd_uniqIdBdd
=
Nothing
,
_hd_page
=
Nothing
,
_hd_title
=
Just
$
view
title
doc
,
_hd_authors
=
Just
$
view
authors
doc
,
_hd_title
=
Just
$
view
du_
title
doc
,
_hd_authors
=
Just
$
view
du_
authors
doc
,
_hd_institutes
=
Nothing
,
_hd_source
=
Just
$
view
sources
doc
,
_hd_abstract
=
Just
$
view
abstract
doc
,
_hd_source
=
Just
$
view
du_
sources
doc
,
_hd_abstract
=
Just
$
view
du_
abstract
doc
,
_hd_publication_date
=
Just
nowS
,
_hd_publication_year
=
Just
$
fromIntegral
year
,
_hd_publication_month
=
Just
month
...
...
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