Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xpub-epmc
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Literature-services
public-projects
xpub-epmc
Commits
9a6216ac
Commit
9a6216ac
authored
6 years ago
by
Nikos Marinos
Browse files
Options
Downloads
Patches
Plain Diff
massive refactor of pdfconversion to accommodate knex.destroy
parent
9339b4d3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!90
Dev
,
!89
Shared data model
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/seed.js
+1
-6
1 addition, 6 deletions
scripts/seed.js
server/pdf-conversion/api.js
+6
-3
6 additions, 3 deletions
server/pdf-conversion/api.js
with
7 additions
and
9 deletions
scripts/seed.js
+
1
−
6
View file @
9a6216ac
...
...
@@ -13,7 +13,6 @@ async function seed() {
await
Journal
.
upsertMulti
(
journals
)
const
users
=
config
.
get
(
'
users
'
)
let
counter
=
0
/* eslint-disable no-await-in-loop */
/* eslint-disable no-restricted-syntax */
for
(
const
user
of
users
)
{
...
...
@@ -31,11 +30,7 @@ async function seed() {
}
// if there are not null identities
if
(
user
.
identities
.
find
(
identity
=>
identity
!==
null
))
{
await
new
User
(
user
).
save
().
catch
(()
=>
{
counter
+=
1
logger
.
info
(
`User
${
user
.
email
}
exists.`
)
if
(
counter
===
users
.
length
)
process
.
exit
()
})
await
new
User
(
user
).
save
()
}
}
}
catch
(
e
)
{
...
...
This diff is collapsed.
Click to expand it.
server/pdf-conversion/api.js
+
6
−
3
View file @
9a6216ac
...
...
@@ -48,6 +48,8 @@ async function getDeposits() {
'
WAITING_FOR_PDF_CONVERSION
'
,
'
files
'
,
).
then
(
async
resultSet
=>
{
/* eslint-disable no-await-in-loop */
/* eslint-disable no-restricted-syntax */
for
(
const
manuscript
of
resultSet
)
{
await
deposit
(
manuscript
)
}
...
...
@@ -60,6 +62,8 @@ async function getDeposits() {
await
manuscript
.
findByFieldValuesIn
(
'
pdf_deposit_state
'
,
pdfDepositStates
,
'
files
'
)
.
then
(
async
resultSet
=>
{
/* eslint-disable no-await-in-loop */
/* eslint-disable no-restricted-syntax */
for
(
const
manuscript
of
resultSet
)
{
logger
.
info
(
`Check status of conversion:
${
manuscript
.
id
}
`
)
await
ncbiApiCall
(
...
...
@@ -166,9 +170,8 @@ async function processDeposit(manuscript, deposit) {
const
filename
=
`
${
uuidv
}
.pdf`
const
filePath
=
`/tmp/
${
filename
}
`
await
getFile
(
s3_get_url
,
filePath
)
.
then
(
async
()
=>
await
uploadToMinio
(
filename
,
manuscript
,
filePath
,
item_size
,
item
),
.
then
(
async
()
=>
uploadToMinio
(
filename
,
manuscript
,
filePath
,
item_size
,
item
),
)
.
catch
(
async
error
=>
{
manuscript
.
pdfDepositState
=
'
RESULT_FAILED_TO_BE_RETRIEVED
'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment