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
4a6898b7
Commit
4a6898b7
authored
6 years ago
by
Yogmatee Roochun
Browse files
Options
Downloads
Patches
Plain Diff
rename file after minio and db upload
parent
4a93b55c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!60
Dev
,
!43
Shared data model
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/ftp-integration/taggedXML.js
+12
-22
12 additions, 22 deletions
server/ftp-integration/taggedXML.js
with
12 additions
and
22 deletions
server/ftp-integration/taggedXML.js
+
12
−
22
View file @
4a6898b7
...
...
@@ -56,9 +56,8 @@ async function processFile(path) {
const
files
=
await
getFilesData
(
extractedFilePath
,
manifestFilename
)
const
[
filesArr
,
promisesArr
]
=
await
checkFiles
(
files
,
tmpPath
,
user
)
await
createFiles
(
filesArr
)
await
Promise
.
all
(
promisesArr
).
catch
(
error
=>
{
logger
.
error
(
error
)
})
await
Promise
.
all
(
promisesArr
)
await
renameFile
(
path
)
logger
.
info
(
'
Uploading to Minio and the database has been completed.
'
)
}
catch
(
err
)
{
logger
.
error
(
'
Error
'
,
err
.
message
)
...
...
@@ -209,13 +208,9 @@ function checkFiles(files, tmpPath, user) {
`
${
uuid
}${
extension
}
`
,
filename
,
extension
,
files
,
file
,
fileSizeInBytes
,
mimeType
,
fileType
,
fileLabel
,
user
,
),
)
}
...
...
@@ -227,13 +222,9 @@ function uploadFile(
filename
,
originalFileName
,
extension
,
files
,
filePath
,
item_size
,
mimeType
,
fileType
,
fileLabel
,
user
,
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
minioClient
.
uploadFile
(
...
...
@@ -249,17 +240,7 @@ function uploadFile(
}
else
{
logger
.
debug
(
`
${
originalFileName
}
file uploaded to minio`
)
fs
.
unlinkSync
(
filePath
)
const
uploadedFile
=
{
url
:
`/download/
${
filename
}
`
,
size
:
item_size
,
filename
:
originalFileName
,
label
:
fileLabel
,
type
:
fileType
,
mimeType
,
updatedBy
:
user
.
userId
,
}
files
.
push
(
uploadedFile
)
// resolve(files)
resolve
(
filePath
)
}
},
)
...
...
@@ -275,3 +256,12 @@ async function createFiles(filesArr) {
logger
.
info
(
filedb
)
}
}
async
function
renameFile
(
path
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
fs
.
rename
(
path
,
`
${
path
}
_
${
Date
.
now
()}
`
,
err
=>
{
if
(
err
)
reject
(
err
)
})
resolve
(
path
)
})
}
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