mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-10 15:17:41 +00:00
44 lines
931 B
TypeScript
44 lines
931 B
TypeScript
import { SourceType } from '@app/common/constants/source-type.enum';
|
|
import { Entity, Column, PrimaryColumn, Unique } from 'typeorm';
|
|
|
|
@Entity('device-status-log')
|
|
@Unique('event_time_idx', ['eventTime', 'deviceId', 'code', 'value'])
|
|
export class DeviceStatusLogEntity {
|
|
@PrimaryColumn({ type: 'int', generated: true, unsigned: true })
|
|
id: number;
|
|
|
|
@Column({ type: 'text' })
|
|
eventId: string;
|
|
|
|
@Column({ type: 'timestamptz' })
|
|
eventTime: Date;
|
|
|
|
@Column({
|
|
type: 'enum',
|
|
enum: SourceType,
|
|
default: SourceType.Device,
|
|
})
|
|
eventFrom: SourceType;
|
|
|
|
@Column({ type: 'uuid' })
|
|
deviceId: string;
|
|
|
|
@Column({ type: 'text' })
|
|
deviceTuyaId: string;
|
|
|
|
@Column({ type: 'text' })
|
|
productId: string;
|
|
|
|
@Column({ type: 'text' })
|
|
code: any;
|
|
|
|
@Column({ type: 'text' })
|
|
value: any;
|
|
|
|
@Column({ type: 'jsonb' })
|
|
log: any;
|
|
|
|
@Column({ type: 'timestamptz', default: new Date() })
|
|
ingestionTime: Date;
|
|
}
|