filegate/db/models.go

89 lines
1.5 KiB
Go

// Define all Database Models here
package db
import (
"gorm.io/gorm"
)
type User struct {
gorm.Model
Name string `gorm:"unique;index"`
PassHash string
Email string
DisplayName string
Groups []Group `gorm:"many2many:user_groups"`
Admin bool
Agent bool
}
type Group struct {
gorm.Model
Name string `grom:"unique;index"`
DisplayName string
Users []User `gorm:"many2many:user_groups"`
}
type Pod struct {
gorm.Model
Name string `grom:"unique;index"`
Type PodType
BoundPorts []int
}
type PodType struct {
gorm.Model
Name string
}
type File struct {
gorm.Model
Name string
Comment *string
StatusID uint
Blob string
Attachments []Attachment
Properties FileProperties
CreatorID uint
AssigneeID uint
}
type Status struct {
gorm.Model
Name string `grom:"unique;index"`
Comment *string
}
type Attachment struct {
gorm.Model
Name string
Comment string
Blob string
FileID uint
}
type FileProperties struct {
gorm.Model
Mime string
OriginalName string
Size int64
Sha256 string
Sha1 string
Md5 string
FileCmd string
Extension string
Url string
FileID uint
}
type Container struct {
gorm.Model
ContainerID string
FileID uint
Status int
Port int
User string
Password string //This has to be stored somewhere in plain text...
ProxyFolder string
Image string
}