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