This commit is contained in:
Tomáš Dvořák
2025-10-16 13:32:05 +02:00
commit 12cba639b9
663 changed files with 168914 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
package models
import (
"encoding/json"
"time"
"gorm.io/gorm"
)
type SetupStatus string
const (
SetupStatusPending SetupStatus = "pending"
SetupStatusCompleted SetupStatus = "completed"
SetupStatusSkipped SetupStatus = "skipped"
)
type SetupInfo struct {
gorm.Model
Status SetupStatus `gorm:"not null;default:'pending'" json:"status"`
SkippedAt *time.Time `json:"skipped_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
SMTPConfigured bool `gorm:"default:false" json:"smtp_configured"`
ClubImported bool `gorm:"default:false" json:"club_imported"`
}
type ClubInfo struct {
gorm.Model
SetupInfoID uint `gorm:"not null" json:"-"`
FACRClubID string `gorm:"uniqueIndex" json:"facr_club_id"`
Name string `gorm:"not null" json:"name"`
ShortName string `json:"short_name"`
LogoURL string `json:"logo_url"`
PrimaryColor string `json:"primary_color"`
SecondaryColor string `json:"secondary_color"`
TextColor string `json:"text_color"`
}
// TableName specifies the table name for the SetupInfo model
func (SetupInfo) TableName() string {
return "setup_info"
}
// TableName specifies the table name for the ClubInfo model
func (ClubInfo) TableName() string {
return "club_info"
}
// ToJSON returns the JSON representation of the club info
func (c *ClubInfo) ToJSON() (string, error) {
data, err := json.Marshal(c)
if err != nil {
return "", err
}
return string(data), nil
}
// FromJSON populates the club info from JSON data
func (c *ClubInfo) FromJSON(jsonData string) error {
return json.Unmarshal([]byte(jsonData), c)
}