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
d4c9edc7
Commit
d4c9edc7
authored
5 years ago
by
Yogmatee Roochun
Browse files
Options
Downloads
Patches
Plain Diff
removed data-access methods to use index.js
parent
41fb619d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!116
Shared data model
,
!117
Dev
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/ftp-integration/taggedXML.js
+12
-6
12 additions, 6 deletions
server/ftp-integration/taggedXML.js
server/utils/db.js
+2
-2
2 additions, 2 deletions
server/utils/db.js
with
14 additions
and
8 deletions
server/ftp-integration/taggedXML.js
+
12
−
6
View file @
d4c9edc7
...
...
@@ -7,7 +7,7 @@ const db = require('../utils/db.js')
const
{
execSync
}
=
require
(
'
child_process
'
)
const
uuidv4
=
require
(
'
uuid/v4
'
)
const
config
=
require
(
'
config
'
)
const
manuscriptModel
=
require
(
'
../xpub-model/entities/manuscript
/data-access
'
)
const
manuscriptModel
=
require
(
'
../xpub-model/entities/manuscript
'
)
const
ftpTagger
=
config
.
get
(
'
ftp_tagger
'
)
const
{
...
...
@@ -74,7 +74,8 @@ async function processFile(path) {
try
{
logger
.
info
(
`Processing tagged XML packages:
${
path
}
`
)
const
user
=
await
getUser
.
getFTPUser
(
rootPath
,
path
)
const
user
=
await
getUser
.
getFTPUser
()
const
userId
=
user
.
userId
const
tmpPath
=
await
tar
.
createTempDir
()
const
extractedFilePath
=
await
tar
.
untar
(
path
,
tmpPath
)
const
manifestFilename
=
await
files
.
getManifestFilename
(
extractedFilePath
)
...
...
@@ -82,10 +83,10 @@ async function processFile(path) {
extractedFilePath
,
manifestFilename
,
)
const
filesArr
=
await
files
.
checkFiles
(
filesData
,
tmpPath
,
user
)
const
filesArr
=
await
files
.
checkFiles
(
filesData
,
tmpPath
,
user
Id
)
// delete current existing 'tagging' files
await
db
.
deleteTaggingFiles
(
manuscriptId
,
user
)
await
db
.
deleteTaggingFiles
(
manuscriptId
,
user
Id
)
// upload to minio
for
(
let
i
=
0
;
i
<
filesArr
.
length
;
i
+=
1
)
{
...
...
@@ -108,17 +109,22 @@ async function processFile(path) {
// create rows in 'file' table
await
db
.
createTaggersFiles
(
dbFilesArr
)
manuscriptModel
.
update
(
{
id
:
manuscriptId
,
pdfDepositState
:
'
WAITING_FOR_PDF_CONVERSION
'
},
user
.
id
,
)
await
files
.
renameFile
(
path
)
logger
.
info
(
'
Uploading to Minio and the database has been completed.
'
)
const
manuscriptObj
=
await
manuscriptModel
.
getManuscript
ById
(
manuscriptId
)
const
manuscriptObj
=
await
manuscriptModel
.
find
ById
(
manuscriptId
,
userId
)
// send email to taggers
processedTaggerEmail
(
ftpTagger
.
email
,
manuscriptId
,
manuscriptObj
[
0
][
'
meta,title
'
],
manuscriptObj
[
'
meta,title
'
],
`
${
path
}
`
,
)
// clean up tmp folder
...
...
This diff is collapsed.
Click to expand it.
server/utils/db.js
+
2
−
2
View file @
d4c9edc7
...
...
@@ -60,7 +60,7 @@ module.exports.upsertHtmlPrevFile = async function upsertHtmlPrevFile(
module
.
exports
.
deleteTaggingFiles
=
async
function
deleteTaggingFiles
(
manuscriptId
,
user
,
user
Id
,
)
{
const
manFiles
=
await
FileModel
.
selectByManuscriptId
(
manuscriptId
)
const
submissionFilesTypes
=
[
'
manuscript
'
,
'
figure
'
,
'
table
'
,
'
supplement
'
]
...
...
@@ -69,7 +69,7 @@ module.exports.deleteTaggingFiles = async function deleteTaggingFiles(
)
// delete tagging files
for
(
let
i
=
0
;
i
<
taggingFiles
.
length
;
i
+=
1
)
{
await
FileModel
.
deleteById
(
taggingFiles
[
i
].
id
,
user
.
userId
)
await
FileModel
.
deleteById
(
taggingFiles
[
i
].
id
,
userId
)
}
logger
.
info
(
`
${
taggingFiles
.
length
}
files deleted.`
)
}
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