Merge pull request 'fix: update notification query to use COALESCE for device details and add additional LEFT JOIN for fallback handling' (#53) from wisdom into main
Reviewed-on: #53
This commit is contained in:
@@ -17,10 +17,10 @@ const getNotificationByIdDb = async (id) => {
|
|||||||
a.*,
|
a.*,
|
||||||
b.plant_sub_section_id,
|
b.plant_sub_section_id,
|
||||||
c.plant_sub_section_name,
|
c.plant_sub_section_name,
|
||||||
d.device_code,
|
COALESCE(d.device_code, f.device_code) AS device_code,
|
||||||
d.device_name,
|
COALESCE(d.device_name, f.device_name) AS device_name,
|
||||||
d.device_location,
|
COALESCE(d.device_location, f.device_location) AS device_location,
|
||||||
d.listen_channel,
|
COALESCE(d.listen_channel, f.listen_channel_reminder) AS listen_channel
|
||||||
e.brand_name,
|
e.brand_name,
|
||||||
e.brand_id
|
e.brand_id
|
||||||
|
|
||||||
@@ -35,6 +35,9 @@ const getNotificationByIdDb = async (id) => {
|
|||||||
LEFT JOIN m_device d
|
LEFT JOIN m_device d
|
||||||
ON a.error_chanel = d.listen_channel AND d.deleted_at IS NULL
|
ON a.error_chanel = d.listen_channel AND d.deleted_at IS NULL
|
||||||
|
|
||||||
|
LEFT JOIN m_device f
|
||||||
|
ON a.error_chanel = f.listen_channel_reminder AND d.deleted_at IS NULL
|
||||||
|
|
||||||
LEFT JOIN m_brands e
|
LEFT JOIN m_brands e
|
||||||
ON d.brand_id = e.brand_id AND d.deleted_at IS NULL
|
ON d.brand_id = e.brand_id AND d.deleted_at IS NULL
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user