Continue phase 2 device ops and dynamic QR lifecycle

This commit is contained in:
2026-05-26 21:25:07 +07:00
parent 5624b92872
commit e0b8f9af9a
22 changed files with 1050 additions and 92 deletions

View File

@ -81,6 +81,13 @@ export async function listDeviceConfigAcks(deviceId, limit = 50) {
LIMIT $2`, [deviceId, Math.min(Math.max(limit, 1), 200)]);
return rows.map(mapAck);
}
export async function getLatestDeviceConfigAck(deviceId) {
const { rows } = await getPool().query(`SELECT * FROM device_config_acks
WHERE device_id = $1
ORDER BY acked_at DESC
LIMIT 1`, [deviceId]);
return rows[0] ? mapAck(rows[0]) : null;
}
export function toDeviceConfigPayload(config) {
return { ...config };
}