feat: add tags

This commit is contained in:
2024-11-18 01:28:31 +07:00
parent 95f9f76edd
commit b0932c39b1
17 changed files with 409 additions and 67 deletions
+7
View File
@@ -28,6 +28,7 @@ type Host struct {
Port int `json:"port" gorm:"type:smallint"`
OS string `json:"os" gorm:"type:varchar(32)"`
Metadata datatypes.JSONMap `json:"metadata"`
Tags []*HostTag `json:"tags" gorm:"foreignKey:HostID"`
ParentID *string `json:"parentId" gorm:"type:varchar(26)"`
Parent *Host `json:"parent" gorm:"foreignKey:ParentID"`
@@ -40,6 +41,12 @@ type Host struct {
SoftDeletes
}
type HostTag struct {
HostID string `gorm:"primarykey;type:varchar(26)" json:"-"`
Host *Host `gorm:"foreignKey:HostID;references:ID" json:"-"`
Name string `gorm:"primarykey;type:varchar(64)" json:"name"`
}
type HostDecrypted struct {
Host
Key map[string]interface{}