30 lines
1.2 KiB
Plaintext
30 lines
1.2 KiB
Plaintext
package model
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// Banner represents a platform announcement banner.
|
|
// Reference: P2B M12 spec
|
|
type Banner struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
AccountID *uint `gorm:"index" json:"account_id,omitempty"` // nil = global banner
|
|
Title string `gorm:"size:255;not null" json:"title"`
|
|
Content string `gorm:"type:text" json:"content"`
|
|
BannerType string `gorm:"size:50;default:'info'" json:"banner_type"` // info/warning/critical
|
|
Active bool `gorm:"default:true" json:"active"`
|
|
Enabled bool `gorm:"default:true" json:"enabled"`
|
|
Metadata json.RawMessage `gorm:"type:jsonb" json:"metadata"`
|
|
StartDate *time.Time `json:"start_date,omitempty"`
|
|
EndDate *time.Time `json:"end_date,omitempty"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"`
|
|
|
|
Account *Account `gorm:"foreignKey:AccountID" json:"account,omitempty"`
|
|
}
|
|
|
|
func (Banner) TableName() string { return "banners" } |