// entity/push/isapi.raw.entity.ts
|
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn } from 'typeorm';
|
import { IsapiEventType } from './isapieventtype';
|
|
@Entity('t_push_isapi_raw')
|
export class PushIsapiRawEntity {
|
@PrimaryGeneratedColumn()
|
id: number;
|
|
/** 萤石 webhook messageId(幂等) */
|
@Column({ unique: true, comment: '消息ID' })
|
messageId: string;
|
|
/** 设备序列号 */
|
@Column({ comment: '设备序列号' })
|
deviceId: string;
|
|
/** 通道号 */
|
@Column({ comment: '通道号' })
|
channelNo: number;
|
|
/** ISAPI 事件类型(枚举约束) */
|
@Column({
|
type: 'enum',
|
enum: IsapiEventType,
|
default: IsapiEventType.UNKNOWN,
|
comment: 'ISAPI 事件类型',
|
})
|
eventType: IsapiEventType;
|
|
/** 事件状态:active / inactive */
|
@Column({ comment: '事件状态' })
|
eventState: string;
|
|
/** 海康 ISAPI 原始 payload(字符串) */
|
@Column({ type: 'text', comment: '原始 ISAPI payload' })
|
rawPayload: string;
|
|
/** 解析后的 JSON(方便后期扩展) */
|
@Column({ type: 'json', nullable: true, comment: '解析后的 payload' })
|
parsed: any;
|
|
/** 设备上报时间 */
|
@Column({ type: 'datetime', comment: '事件时间' })
|
eventTime: Date;
|
|
/** 入库时间 */
|
@CreateDateColumn({ comment: '创建时间' })
|
createTime: Date;
|
}
|