Files
silk/server-go/internal/model/inspection.go
T

25 lines
1.3 KiB
Go

package model
import (
"encoding/json"
"time"
)
// InspectionRecord AI 巡检记录
type InspectionRecord struct {
ID string `gorm:"type:uuid;primaryKey;default:gen_random_uuid()" json:"id"`
UserID *string `gorm:"column:user_id;type:uuid;index" json:"userId,omitempty"`
RoomID *string `gorm:"column:room_id;type:uuid;index" json:"roomId,omitempty"`
ImageURL *string `gorm:"column:image_url;size:512" json:"imageUrl,omitempty"`
Detections json.RawMessage `gorm:"column:detections;type:jsonb" json:"detections,omitempty"`
RiskScore *float64 `gorm:"column:risk_score;type:float" json:"riskScore,omitempty"`
RiskLevel *string `gorm:"column:risk_level;size:16" json:"riskLevel,omitempty"`
AIStatus string `gorm:"column:ai_status;size:16;default:done" json:"aiStatus"`
IdempotencyKey *string `gorm:"column:idempotency_key;size:128;uniqueIndex" json:"idempotencyKey,omitempty"`
CreatedAt time.Time `gorm:"type:timestamptz" json:"createdAt"`
UpdatedAt time.Time `gorm:"type:timestamptz" json:"updatedAt"`
RoomName *string `gorm:"-" json:"roomName,omitempty"`
}
func (InspectionRecord) TableName() string { return "inspection_records" }