add: sparepart in detail notification error

This commit is contained in:
2025-12-05 09:21:04 +07:00
parent 20d035a1ca
commit dc7712a79f
2 changed files with 5 additions and 4 deletions

View File

@@ -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'

View File

@@ -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;
} }
} }