repair: notification error sparepart
This commit is contained in:
@@ -1,6 +1,34 @@
|
||||
const pool = require("../config");
|
||||
|
||||
const insertNotificationErrorSparepartDb = async () => {
|
||||
const insertQuery = `
|
||||
INSERT INTO notification_error_sparepart (
|
||||
notification_error_id,
|
||||
brand_sparepart_id
|
||||
)
|
||||
SELECT
|
||||
ne.notification_error_id,
|
||||
bs.brand_sparepart_id
|
||||
|
||||
FROM notification_error ne
|
||||
|
||||
INNER JOIN brand_sparepart bs
|
||||
ON ne.error_code_id = bs.error_code_id
|
||||
|
||||
LEFT JOIN notification_error_sparepart nes
|
||||
ON nes.notification_error_id = ne.notification_error_id
|
||||
AND nes.brand_sparepart_id = bs.brand_sparepart_id
|
||||
AND nes.deleted_at IS NULL
|
||||
|
||||
WHERE ne.deleted_at IS NULL
|
||||
AND nes.notification_error_sparepart_id IS NULL;
|
||||
`;
|
||||
|
||||
await pool.query(insertQuery);
|
||||
};
|
||||
|
||||
const getAllNotificationErrorSparepartDb = async (searchParams = {}) => {
|
||||
await insertNotificationErrorSparepartDb();
|
||||
let queryParams = [];
|
||||
|
||||
if (searchParams.limit) {
|
||||
|
||||
Reference in New Issue
Block a user