Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
program-service
Commits
30c1bc7e
Unverified
Commit
30c1bc7e
authored
3 years ago
by
Kartheek Palla
Committed by
GitHub
3 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #246 from vaibhavbhuva/release-4.5.0
Issue #SB-23374 fix : Bulk question link issue fixes
parents
407f0c42
8eabbc55
test-issue
dependabot/npm_and_yarn/src/async-2.6.4
dependabot/npm_and_yarn/src/axios-0.21.2
dependabot/npm_and_yarn/src/decode-uri-component-0.2.2
dependabot/npm_and_yarn/src/jsonwebtoken-9.0.0
dependabot/npm_and_yarn/src/lodash-4.17.21
dependabot/npm_and_yarn/src/moment-2.29.4
dependabot/npm_and_yarn/src/moment-timezone-0.5.37
dependabot/npm_and_yarn/src/node-fetch-2.6.7
dependabot/npm_and_yarn/src/qs-and-body-parser-and-express-6.5.3
dependabot/npm_and_yarn/src/redis-3.1.1
dependabot/npm_and_yarn/src/simple-get-2.8.2
dependabot/npm_and_yarn/src/underscore-1.12.1
master
release-4.5.0
release-4.6.0
release-4.7.0
release-4.8.0
release-4.9.0
release-5.1.0
release-5.1.0_RC1
release-4.9.0_RC1
release-4.8.0_RC3
release-4.8.0_RC2
release-4.8.0_RC1
release-4.7.0_RC6
release-4.7.0_RC5
release-4.7.0_RC4
release-4.7.0_RC3
release-4.7.0_RC2
release-4.7.0_RC1
release-4.6.0_RC6
release-4.6.0_RC5
release-4.6.0_RC4
release-4.6.0_RC3
release-4.6.0_RC2
release-4.6.0_RC1
release-4.5.0_RC1
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/service/kafkaQumlConsumerService.js
+44
-28
src/service/kafkaQumlConsumerService.js
src/service/qumlBulkService.js
+3
-1
src/service/qumlBulkService.js
with
47 additions
and
29 deletions
+47
-29
src/service/kafkaQumlConsumerService.js
+
44
−
28
View file @
30c1bc7e
...
...
@@ -4,7 +4,6 @@ var FormData = require('form-data');
const
fetch
=
require
(
"
node-fetch
"
);
const
logger
=
require
(
"
sb_logger_util_v2
"
);
const
{
v4
:
uuidv4
}
=
require
(
"
uuid
"
);
const
loggerService
=
require
(
"
./loggerService
"
);
const
messageUtils
=
require
(
"
../service/messageUtil
"
);
const
GoogleOauth
=
require
(
"
../helpers/googleOauthHelper
"
);
const
responseCode
=
messageUtils
.
RESPONSE_CODE
;
...
...
@@ -74,26 +73,31 @@ const qumlConsumer = () => {
}
};
const
initQuestionCreateProcess
=
(
question
Data
)
=>
{
const
initQuestionCreateProcess
=
(
question
s
)
=>
{
logger
.
info
({
message
:
"
Question creating process started
"
});
async
.
waterfall
([
async
.
apply
(
createQuestion
,
questionData
),
async
.
apply
(
startDownloadFileProcess
,
questionData
),
async
.
apply
(
prepareQuestionBody
),
async
.
apply
(
updateQuestion
),
async
.
apply
(
reviewQuestion
,
questionData
.
status
),
async
.
apply
(
publishQuestion
,
questionData
.
status
),
async
.
apply
(
linkQuestionToQuestionSet
,
questionData
)
],
function
(
err
,
result
)
{
if
(
err
)
{
return
logger
.
error
(
{
message
:
`Something Went Wrong While Creating the question
${
JSON
.
stringify
(
err
)}
`
,
},
err
);
}
console
.
log
(
'
initQuestionCreateProcess :: SUCCESS :: =====>
'
,
JSON
.
stringify
(
result
));
async
.
eachSeries
(
questions
,
function
(
questionData
,
cb
){
async
.
waterfall
([
async
.
apply
(
createQuestion
,
questionData
),
async
.
apply
(
startDownloadFileProcess
,
questionData
),
async
.
apply
(
prepareQuestionBody
),
async
.
apply
(
updateQuestion
),
async
.
apply
(
reviewQuestion
,
questionData
.
status
),
async
.
apply
(
publishQuestion
,
questionData
.
status
),
async
.
apply
(
linkQuestionToQuestionSet
,
questionData
)
],
function
(
err
,
result
)
{
cb
();
if
(
err
)
{
return
logger
.
error
(
{
message
:
`Something Went Wrong While Creating the question
${
JSON
.
stringify
(
err
)}
`
,
},
err
);
}
console
.
log
(
'
initQuestionCreateProcess :: SUCCESS :: =====>
'
,
JSON
.
stringify
(
result
));
});
},
function
(
err
){
logger
.
info
({
message
:
"
Question creating process completed!
"
});
});
};
...
...
@@ -412,6 +416,10 @@ const updateQuestion = (questionBody, createQuestionRes, callback) => {
if
(
updateResponseData
.
responseCode
&&
_
.
toLower
(
updateResponseData
.
responseCode
)
===
"
ok
"
)
{
callback
(
null
,
updateResponseData
);
}
else
{
updateResponse
(
questionRes
.
result
.
identifier
,
`Something Went wrong while updating the questions:
${
JSON
.
stringify
(
updateResponseData
)}
`
);
callback
(
updateResponseData
);
}
})
...
...
@@ -419,6 +427,10 @@ const updateQuestion = (questionBody, createQuestionRes, callback) => {
logger
.
error
({
message
:
`Error while updating the question ::
${
JSON
.
stringify
(
error
)}
`
,
});
updateResponse
(
questionRes
.
result
.
identifier
,
`Something Went wrong while updating the questions:
${
JSON
.
stringify
(
error
)}
`
);
callback
(
error
);
});
}
...
...
@@ -446,6 +458,10 @@ const reviewQuestion = (status, questionRes, callback) => {
if
(
reviewResponseData
.
responseCode
&&
_
.
toLower
(
reviewResponseData
.
responseCode
)
===
"
ok
"
)
{
callback
(
null
,
reviewResponseData
);
}
else
{
updateResponse
(
questionRes
.
result
.
identifier
,
`Something Went wrong while reviewing the questions:
${
JSON
.
stringify
(
reviewResponseData
)}
`
);
callback
(
reviewResponseData
);
}
})
...
...
@@ -455,7 +471,7 @@ const reviewQuestion = (status, questionRes, callback) => {
});
updateResponse
(
questionRes
.
result
.
identifier
,
`Something Went wrong while reviewing the questions:
${
error
}
`
`Something Went wrong while reviewing the questions:
${
JSON
.
stringify
(
error
)
}
`
);
callback
(
error
);
});
...
...
@@ -482,6 +498,10 @@ const publishQuestion = (status, questionRes, callback) => {
if
(
publishResponseData
.
responseCode
&&
_
.
toLower
(
publishResponseData
.
responseCode
)
===
"
ok
"
)
{
callback
(
null
,
publishResponseData
);
}
else
{
updateResponse
(
questionRes
.
result
.
identifier
,
`Something went wrong while Publishing the question ::
${
JSON
.
stringify
(
publishResponseData
)}
`
);
callback
(
publishResponseData
);
}
})
...
...
@@ -491,7 +511,7 @@ const publishQuestion = (status, questionRes, callback) => {
});
updateResponse
(
questionRes
.
result
.
identifier
,
`Something went wrong while Publishing the question`
`Something went wrong while Publishing the question
::
${
JSON
.
stringify
(
error
)}
`
);
callback
(
error
);
});
...
...
@@ -522,10 +542,6 @@ const linkQuestionToQuestionSet = (questionData, questionRes, callback) => {
.
then
((
response
)
=>
response
.
json
())
.
then
((
linkResponseData
)
=>
{
if
(
linkResponseData
.
responseCode
&&
_
.
toLower
(
linkResponseData
.
responseCode
)
===
"
ok
"
)
{
// updateResponse(
// questionRes.result.identifier,
// `Successfully linked the question for the identifier:${questionRes.result.identifier}`
// );
console
.
log
(
'
Successfully linkQuestionToQuestionSet:: =====>
'
,
JSON
.
stringify
(
linkResponseData
));
callback
(
null
,
linkResponseData
);
}
else
{
...
...
@@ -534,7 +550,7 @@ const linkQuestionToQuestionSet = (questionData, questionRes, callback) => {
});
updateResponse
(
questionRes
.
result
.
identifier
,
`Something went wrong while linking the question`
`Something went wrong while linking the question
::
${
JSON
.
stringify
(
linkResponseData
)}
`
);
callback
(
linkResponseData
);
}
...
...
@@ -545,7 +561,7 @@ const linkQuestionToQuestionSet = (questionData, questionRes, callback) => {
});
updateResponse
(
questionRes
.
result
.
identifier
,
`Something went wrong while linking the question`
`Something went wrong while linking the question
::
${
JSON
.
stringify
(
error
)}
`
);
callback
(
error
);
});
...
...
This diff is collapsed.
Click to expand it.
src/service/qumlBulkService.js
+
3
−
1
View file @
30c1bc7e
...
...
@@ -59,13 +59,15 @@ const bulkUpload = async (req, res) => {
return
res
.
status
(
400
).
send
(
errorResponse
(
rspObj
,
errCode
+
errorCodes
.
CODE3
));
}
qumlData
=
csvData
.
data
;
const
questionsArr
=
[];
_
.
forEach
(
qumlData
,
(
question
)
=>
{
question
=
prepareQuestionData
(
question
,
req
);
question
[
'
questionSetSectionId
'
]
=
flattenHierarchyObj
[
question
.
level1
];
question
[
"
processId
"
]
=
pId
;
console
.
log
(
"
Prepared Question body : =====>
"
,
JSON
.
stringify
(
question
))
sendRecordToKafkaTopic
(
question
);
questionsArr
.
push
(
question
);
});
sendRecordToKafkaTopic
(
questionsArr
);
logger
.
info
({
message
:
"
Bulk Upload process has started successfully for the process Id
"
,
pId
});
rspObj
.
responseCode
=
responseCode
.
SUCCESS
;
rspObj
.
result
=
{
processId
:
pId
,
count
:
qumlData
.
length
};
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Explore
Projects
Groups
Topics
Snippets