mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 10:25:23 +00:00
fix issue in real time
This commit is contained in:
@ -150,7 +150,6 @@ export class DeviceStatusFirebaseService {
|
||||
async createDeviceStatusFirebase(
|
||||
addDeviceStatusDto: AddDeviceStatusDto,
|
||||
): Promise<any> {
|
||||
console.log(addDeviceStatusDto);
|
||||
const dataRef = ref(
|
||||
this.firebaseDb,
|
||||
`device-status/${addDeviceStatusDto.deviceUuid}`,
|
||||
@ -191,14 +190,15 @@ export class DeviceStatusFirebaseService {
|
||||
const newLog = this.deviceStatusLogRepository.create({
|
||||
deviceId: addDeviceStatusDto.deviceUuid,
|
||||
deviceTuyaId: addDeviceStatusDto.deviceTuyaUuid,
|
||||
productId: addDeviceStatusDto.productUuid,
|
||||
productId: addDeviceStatusDto.log.productId,
|
||||
log: addDeviceStatusDto.log,
|
||||
code: existingData.status[0].code,
|
||||
value: existingData.status[0].value,
|
||||
eventId: addDeviceStatusDto.log.dataId,
|
||||
eventTime: addDeviceStatusDto.log.properties[0].time,
|
||||
eventTime: new Date(
|
||||
addDeviceStatusDto.log.properties[0].time,
|
||||
).toLocaleDateString(),
|
||||
});
|
||||
|
||||
await this.deviceStatusLogRepository.save(newLog);
|
||||
// Save the updated data to Firebase
|
||||
await set(dataRef, existingData);
|
||||
|
@ -4,7 +4,11 @@ import { Entity, Column, PrimaryColumn, Index } from 'typeorm';
|
||||
@Entity('device-status-log')
|
||||
@Index('logTime_idx', ['eventTime'])
|
||||
export class DeviceStatusLogEntity {
|
||||
@PrimaryColumn()
|
||||
@PrimaryColumn({
|
||||
type: 'int',
|
||||
generated: true,
|
||||
unsigned: true,
|
||||
})
|
||||
id: number;
|
||||
|
||||
@Column({ type: 'text' })
|
||||
|
Reference in New Issue
Block a user