feat: add new features such as database watchdog

This commit is contained in:
DaanSelen
2026-04-21 16:27:04 +02:00
parent 610fdffdb8
commit c4a4fafb52
16 changed files with 428 additions and 158 deletions
+43 -13
View File
@@ -1,19 +1,49 @@
package database
type AppState struct {
import (
"time"
"gorm.io/datatypes"
)
type Mode string
const (
ModeUnspecified Mode = "unspecified"
ModeVideo Mode = "video"
ModePresentation Mode = "presentation"
ModeInternet Mode = "internet"
)
type State struct {
ID int `gorm:"primaryKey"`
// Mode =
// 0: unspecified
// 1: video
// 2: presentation
// 3: internet URL
Mode string
Running bool
// unspecified
// video
// presentation
// internet URL
Mode Mode `gorm:"type:varchar(20);not null"` // Must specify what kind of file it is
Targets datatypes.JSON
Location string // Must be the location where the file is downloadable on the API
UpdatedAt time.Time
}
type Files struct {
ID int `gorm:"primaryKey"`
Mode string
Filename string
Filepath string
type Device struct {
ID int `gorm:"primaryKey"`
DeviceType string
Hostname string
RemoteAddress string
Alive bool
Compliant bool
CreatedAt time.Time
UpdatedAt time.Time
}
type File struct {
ID int `gorm:"primaryKey"`
Mode Mode `gorm:"type:varchar(20);not null"`
GivenName string
Filepath string
Checksum string // base64 encoded sha512 checksum
CreatedAt time.Time
UpdatedAt time.Time
}