Change log retrieval period to one day for device logs

This commit is contained in:
faris Aljohari
2024-08-27 17:21:01 +03:00
parent 0b550cbb52
commit d5e076c056

View File

@ -721,8 +721,8 @@ export class DeviceService {
): Promise<getDeviceLogsInterface> {
try {
const now = Date.now();
const oneHourAgo = now - 1 * 60 * 60 * 1000;
const path = `/v2.0/cloud/thing/${deviceId}/report-logs?start_time=${oneHourAgo}&end_time=${now}&codes=${code}&size=50`;
const oneDayAgo = now - 1 * 24 * 60 * 60 * 1000;
const path = `/v2.0/cloud/thing/${deviceId}/report-logs?start_time=${oneDayAgo}&end_time=${now}&codes=${code}&size=50`;
const response = await this.tuya.request({
method: 'GET',
path,
@ -731,7 +731,7 @@ export class DeviceService {
const camelCaseResponse = convertKeysToCamelCase(response);
const logs = camelCaseResponse.result.logs ?? [];
return {
startTime: oneHourAgo,
startTime: oneDayAgo,
endTime: now,
data: logs,
} as getDeviceLogsInterface;