add: sparepart in detail notification error
This commit is contained in:
@@ -18,7 +18,7 @@ const InsertNotificationErrorDb = async () => {
|
|||||||
1 AS is_send,
|
1 AS is_send,
|
||||||
|
|
||||||
CONCAT(
|
CONCAT(
|
||||||
COALESCE(b.error_code_description, '-'),
|
COALESCE(b.error_code_name, '-'),
|
||||||
' pada ',
|
' pada ',
|
||||||
COALESCE(d.device_name, '-'),
|
COALESCE(d.device_name, '-'),
|
||||||
'. Pengecekan potensi kerusakan dibutuhkan'
|
'. Pengecekan potensi kerusakan dibutuhkan'
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ class NotificationService {
|
|||||||
// Get solutions for this error code
|
// Get solutions for this error code
|
||||||
const solutions = (await getSolutionsByErrorCodeIdDb(errorCode.error_code_id)) || [];
|
const solutions = (await getSolutionsByErrorCodeIdDb(errorCode.error_code_id)) || [];
|
||||||
|
|
||||||
|
const spareparts = await getSparepartsByErrorCodeIdDb(errorCode.error_code_id);
|
||||||
|
|
||||||
const solutionsWithDetails = await Promise.all(
|
const solutionsWithDetails = await Promise.all(
|
||||||
solutions.map(async (solution) => {
|
solutions.map(async (solution) => {
|
||||||
let fileData = null;
|
let fileData = null;
|
||||||
@@ -75,13 +77,12 @@ class NotificationService {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const spareparts = await getSparepartsByErrorCodeIdDb(errorCode.error_code_id);
|
|
||||||
|
|
||||||
notification.error_code = {
|
notification.error_code = {
|
||||||
...errorCode,
|
...errorCode,
|
||||||
solution: solutionsWithDetails
|
solution: solutionsWithDetails,
|
||||||
|
spareparts: spareparts
|
||||||
};
|
};
|
||||||
notification.spareparts = spareparts;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user