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
12 changes: 12 additions & 0 deletions src/events/projects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ const indexProject = Promise.coroutine(function* (logger, msg) { // eslint-disab
// removes non required fields from phase objects
data.phases = data.phases.map(phase => _.omit(phase, ['deletedAt', 'deletedBy']));
}
// TEMPORARY FIX: should fix ES mapping instead and reindex all the projects instead
if (typeof _.get(data, 'details.taasDefinition.team.skills') !== 'string') {
_.set(data, 'details.taasDefinition.team.skills', '');
}
// add the record to the index
const result = yield eClient.index({
index: ES_PROJECT_INDEX,
Expand Down Expand Up @@ -91,6 +95,10 @@ const projectUpdatedHandler = Promise.coroutine(function* (logger, msg, channel)
// first get the existing document and than merge the updated changes and save the new document
const doc = yield eClient.get({ index: ES_PROJECT_INDEX, type: ES_PROJECT_TYPE, id: data.original.id });
const merged = _.merge(doc._source, data.updated); // eslint-disable-line no-underscore-dangle
// TEMPORARY FIX: should fix ES mapping instead and reindex all the projects instead
if (typeof _.get(merged, 'details.taasDefinition.team.skills') !== 'string') {
_.set(merged, 'details.taasDefinition.team.skills', '');
}
// update the merged document
yield eClient.update({
index: ES_PROJECT_INDEX,
Expand Down Expand Up @@ -173,6 +181,10 @@ async function projectUpdatedKafkaHandler(app, topic, payload) {
try {
const doc = await eClient.get({ index: ES_PROJECT_INDEX, type: ES_PROJECT_TYPE, id: previousValue.id });
const merged = _.merge(doc._source, project.get({ plain: true })); // eslint-disable-line no-underscore-dangle
// TEMPORARY FIX: should fix ES mapping instead and reindex all the projects instead
if (typeof _.get(merged, 'details.taasDefinition.team.skills') !== 'string') {
_.set(merged, 'details.taasDefinition.team.skills', '');
}
// update the merged document
await eClient.update({
index: ES_PROJECT_INDEX,
Expand Down
4 changes: 4 additions & 0 deletions src/routes/admin/project-index-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ module.exports = [
projectResponses.map((p) => {
if (p) {
body.push({ index: { _index: indexName, _type: docType, _id: p.id } });
// TEMPORARY FIX: should fix ES mapping instead and reindex all the projects instead
if (typeof _.get(p, 'details.taasDefinition.team.skills') !== 'string') {
_.set(p, 'details.taasDefinition.team.skills', '');
}
body.push(p);
}
// dummy return
Expand Down