chore: add device hierarchy

This commit is contained in:
2026-04-23 23:23:55 +02:00
parent 94a93fb945
commit 97bf4f6842
2 changed files with 22 additions and 2 deletions
+19 -1
View File
@@ -38,8 +38,26 @@ type AccessKey struct {
Timestamps
}
type Tenant struct {
ID int `gorm:"primaryKey;not null;"`
TenantName string `gorm:"not null"`
TenantDescription string
Groups []Group `gorm:"foreignKey:TenantID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
Timestamps
}
type Group struct {
ID int `gorm:"primaryKey;not null;"`
TenantID uint `gorm:"not null;index"`
GroupName string `gorm:"not null;"`
GroupDescription string
Devices []Device `gorm:"foreignKey:GroupID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
Timestamps
}
type Device struct {
ID int `gorm:"primaryKey;not null;"`
ID int `gorm:"primaryKey;not null;"`
GroupID uint `gorm:"not null;index"`
// Device type is meant as a field where can be specified what type of device this is
// eg Raspberry Pi, PC, things like that
DeviceType string