tfk-search-index-ansatte
Version:
Index employees in elasticsearch
30 lines (20 loc) • 641 B
JavaScript
function buildDescription (data) {
if (!data) {
throw new Error('Missing required input')
}
var content = []
content.push(data.givenName + ' ' + data.familyName)
content.push(data.positions[0].departmentName)
if (data.workPhone && data.workPhone.length > 0) {
content.push('Telefon: ' + data.workPhone)
}
if (data.mobilePhone && data.mobilePhone.length > 0) {
content.push('Mobil: ' + data.mobilePhone)
}
if (data.email && data.email.length > 0) {
content.push('E-post: ' + data.email)
}
return content.join(', ')
}
module.exports = buildDescription