fix mockup data

This commit is contained in:
2025-12-08 12:07:27 +07:00
parent edd5c5284a
commit fc82461119
3 changed files with 52 additions and 4 deletions
+35 -2
View File
@@ -1,9 +1,8 @@
import { verify } from '~/helpers/signature'
import { DeviceQueryParams } from '../schema'
import { queryDeviceStatus } from './query'
export default abstract class QueryService {
static async getDeviceStatus(query: DeviceQueryParams, headers: Record<string, string | undefined>): Promise<{
static async getDeviceStatus(query: DeviceQueryParams): Promise<{
status: 'success'
message: 'command accepted'
data: {
@@ -21,6 +20,40 @@ export default abstract class QueryService {
const topic = `${query.merchantName}/${query.floorName}_${query.unitNumber}-${query.deviceName}-${query.roomName}-${query.deviceType}-S-${query.towerNumber}`
if (topic == 'SAVY/01_L2-BL-LV-S-S-T1') {
return {
status: 'success',
message: 'command accepted',
data: {
floor: 'L2',
unit: '01',
device: 'BL',
room: 'LV',
devType: 'S',
code: 'S',
tower: 'T1',
payload: 'Open',
},
}
}
if (topic == 'SAVY/01_L2-L-LV-S-C-T1') {
return {
status: 'success',
message: 'command accepted',
data: {
floor: 'L2',
unit: '01',
device: 'L',
room: 'LV',
devType: 'S',
code: 'C',
tower: 'T1',
payload: 'On',
},
}
}
const deviceData = await queryDeviceStatus(topic)
if (deviceData) {