wisdom #2

Merged
yogiedigital merged 126 commits from wisdom into main 2025-10-20 03:26:33 +00:00
Showing only changes of commit b2399d486e - Show all commits

View File

@@ -40,22 +40,10 @@ const getAllDevicesDb = async (searchParams = {}) => {
const queryText = `
SELECT
COUNT(*) OVER() AS total_data,
a.device_id,
a.device_code,
a.device_name,
a.is_active,
a.device_location,
a.device_description,
a.ip_address,
a.created_by,
a.updated_by,
a.deleted_by,
a.created_at,
a.updated_at,
a.deleted_at,
b.brand_id,
b.brand_name
COUNT(*) OVER() AS total_data,
a.*,
b.brand_name,
COALESCE(a.device_code, '') + ' - ' + COALESCE(a.device_name, '') AS device_code_name
FROM m_device a
LEFT JOIN m_brands b ON a.brand_id = b.brand_id
WHERE a.deleted_at IS NULL
@@ -78,20 +66,10 @@ const getAllDevicesDb = async (searchParams = {}) => {
const getDeviceByIdDb = async (id) => {
const queryText = `
SELECT
a.device_id,
a.device_name,
a.is_active,
a.device_location,
a.device_description,
a.ip_address,
a.created_by,
a.updated_by,
a.deleted_by,
a.created_at,
a.updated_at,
a.deleted_at,
b.brand_name
SELECT
a.*,
b.brand_name,
COALESCE(a.device_code, '') + ' - ' + COALESCE(a.device_name, '') AS device_code_name
FROM m_device a
LEFT JOIN m_brands b ON a.brand_id = b.brand_id
WHERE a.device_id = $1 AND a.deleted_at IS NULL