这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 30 additions & 10 deletions workers/loc.api/queue/aggregator.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ module.exports = (
await hasGrcService.hasS3AndSendgrid()
)

const newFilePaths = []
const csvFilesMetadata = []

if (isEnableToSendEmail) {
const s3Data = await uploadToS3(
s3Conf,
Expand All @@ -62,38 +65,55 @@ module.exports = (
}))
)

for (const filePath of filePaths) {
for (const [i, filePath] of filePaths.entries()) {
const _name = subParamsArr[i]?.name ?? name

await unlink(filePath)

csvFilesMetadata.push({
name: _name,
filePath: null
})
}

job.done()
aggregatorQueue.emit('completed')
aggregatorQueue.emit('completed', {
newFilePaths,
csvFilesMetadata,
userInfo
})

return
}

const newFilePaths = []
let count = 0
for (const [i, filePath] of filePaths.entries()) {
const _name = subParamsArr[i]?.name ?? name

for (const filePath of filePaths) {
const {
newFilePath
} = await moveFileToLocalStorage(
rootPath,
filePath,
subParamsArr[count].name || name,
{ ...subParamsArr[count] },
_name,
{ ...subParamsArr[i] },
userInfo.username,
isAddedUniqueEndingToCsvName,
chunkCommonFolders[count]
chunkCommonFolders[i]
)

newFilePaths.push(newFilePath)
count += 1
csvFilesMetadata.push({
name: _name,
filePath: newFilePath
})
}

job.done()
aggregatorQueue.emit('completed', { newFilePaths })
aggregatorQueue.emit('completed', {
newFilePaths,
csvFilesMetadata,
userInfo
})
} catch (err) {
if (err.syscall === 'unlink') {
aggregatorQueue.emit('error:unlink', job)
Expand Down
3 changes: 2 additions & 1 deletion workers/loc.api/service.report.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ class ReportService extends Api {
timezone,
email,
id,
isSubAccount: false
isSubAccount: false,
_id: null // to have the same data structure as in framework mode
}
}, 'verifyUser', args, cb)
}
Expand Down