created device config, created new UI elements in device dashboard
This commit is contained in:
@@ -11,4 +11,6 @@ type Device struct {
|
||||
Certs []DeviceCertificate `gorm:"foreignKey:DeviceGUID;references:GUID;constraint:OnDelete:CASCADE"`
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
|
||||
Config *DeviceConfig `gorm:"foreignKey:DeviceGUID;references:GUID;constraint:OnDelete:CASCADE"`
|
||||
}
|
||||
|
||||
19
server/internal/models/device_config.go
Normal file
19
server/internal/models/device_config.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
// One-to-one config bound to a device GUID.
|
||||
type DeviceConfig struct {
|
||||
DeviceGUID string `gorm:"primaryKey;size:64"` // 1:1 with Device.GUID
|
||||
// Fields reflect your device JSON keys (m_*)
|
||||
MGuid string `gorm:"size:64;not null"` // duplicate for device FW convenience
|
||||
MRecordingDuration int `gorm:"not null;default:240"`
|
||||
MBaseURL string `gorm:"size:512;not null"`
|
||||
MPolling int `gorm:"not null;default:30"`
|
||||
MJitter int `gorm:"not null;default:10"`
|
||||
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
|
||||
Device Device `gorm:"constraint:OnDelete:CASCADE;foreignKey:DeviceGUID;references:GUID"`
|
||||
}
|
||||
Reference in New Issue
Block a user