changed device log table

This commit is contained in:
unknown
2024-10-27 09:56:23 +03:00
parent 9e1e0cb2f4
commit ce9555a5f4
5 changed files with 45 additions and 13 deletions

View File

@ -1,26 +1,43 @@
import { SourceType } from '@app/common/constants/source-type.enum';
import { Entity, Column, PrimaryColumn, Index } from 'typeorm';
@Entity('device-status-log')
@Index('logTime_idx', ['logTime'])
@Index('logTime_idx', ['eventTime'])
export class DeviceStatusLogEntity {
@PrimaryColumn()
id: number;
@Column({ type: 'text' })
eventId: string;
@PrimaryColumn({ type: 'timestamptz' })
logTime: Date;
eventTime: Date;
@Column({
type: 'enum',
enum: SourceType,
default: SourceType.Device,
})
eventFrom: SourceType;
@Column({ type: 'text' })
deviceUuid: string;
deviceId: string;
@Column({ type: 'text' })
deviceTuyaUuid: string;
deviceTuyaId: string;
@Column({ type: 'text' })
productUuid: string;
productId: string;
@Column({ type: 'text' })
productType: string;
code: any;
@Column({ type: 'text' })
value: any;
@Column({ type: 'jsonb' })
status: any; // JSON array of status codes and values
log: any;
@Column({ type: 'timestamptz', default: new Date() })
ingestionTime: Date;
}