mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-09-23 08:00:55 +00:00
77 lines
2.8 KiB
Go
77 lines
2.8 KiB
Go
package model
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/google/uuid"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Alert struct {
|
|
BaseModel
|
|
|
|
Title string `gorm:"type:varchar(256);not null" json:"title"`
|
|
Type string `gorm:"type:varchar(64);not null" json:"type"`
|
|
Cycle uint `gorm:"type:integer;not null" json:"cycle"`
|
|
Count uint `gorm:"type:integer;not null" json:"count"`
|
|
Project string `gorm:"type:varchar(64)" json:"project"`
|
|
Status string `gorm:"type:varchar(64);not null" json:"status"`
|
|
Method string `gorm:"type:text;not null" json:"method"`
|
|
SendCount uint `gorm:"type:integer" json:"sendCount"`
|
|
AdvancedParams string `gorm:"type:longText" json:"advancedParams"`
|
|
CreateUser string `gorm:"type:varchar(256)" json:"createUser"`
|
|
UpdateUser string `gorm:"type:varchar(256)" json:"updateUser"`
|
|
}
|
|
|
|
type AlertTask struct {
|
|
BaseModel
|
|
Type string `gorm:"type:varchar(64);not null" json:"type"`
|
|
Quota string `gorm:"type:varchar(64)" json:"quota"`
|
|
QuotaType string `gorm:"type:varchar(64)" json:"quotaType"`
|
|
Method string `gorm:"type:varchar(128);not null;default:'sms'" json:"method"`
|
|
DeliveryLogID *uint `gorm:"uniqueIndex" json:"-"`
|
|
}
|
|
|
|
type AlertLog struct {
|
|
BaseModel
|
|
|
|
Type string `gorm:"type:varchar(64);not null" json:"type"`
|
|
Status string `gorm:"type:varchar(64);not null" json:"status"`
|
|
AlertId uint `gorm:"type:integer;not null" json:"alertId"`
|
|
AlertDetail string `gorm:"type:varchar(256);not null" json:"alertDetail"`
|
|
AlertRule string `gorm:"type:varchar(256);not null" json:"alertRule"`
|
|
Count uint `gorm:"type:integer;not null" json:"count"`
|
|
Message string `gorm:"type:varchar(256);" json:"message"`
|
|
RecordId uint `gorm:"type:integer;" json:"recordId"`
|
|
LicenseId string `gorm:"type:varchar(256);not null;" json:"licenseId" `
|
|
Method string `gorm:"type:varchar(128);not null;default:'sms'" json:"method"`
|
|
}
|
|
|
|
type AlertConfig struct {
|
|
BaseModel
|
|
UID string `gorm:"type:varchar(64);not null;uniqueIndex" json:"uid"`
|
|
Type string `gorm:"type:varchar(64);not null" json:"type"`
|
|
Title string `gorm:"type:varchar(64);not null" json:"title"`
|
|
Status string `gorm:"type:varchar(64);not null" json:"status"`
|
|
Config string `gorm:"type:text;not null" json:"config"`
|
|
SecretConfig string `gorm:"type:text;not null;default:''" json:"-"`
|
|
CreateUser string `gorm:"type:varchar(256)" json:"createUser"`
|
|
UpdateUser string `gorm:"type:varchar(256)" json:"updateUser"`
|
|
}
|
|
|
|
func (a *AlertConfig) BeforeCreate(_ *gorm.DB) error {
|
|
if strings.TrimSpace(a.UID) == "" {
|
|
a.UID = uuid.NewString()
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type LoginLog struct {
|
|
BaseModel
|
|
IP string `json:"ip"`
|
|
Address string `json:"address"`
|
|
Agent string `json:"agent"`
|
|
Status string `json:"status"`
|
|
Message string `json:"message"`
|
|
}
|