mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 18:52:56 +00:00
44 lines
1.4 KiB
Go
44 lines
1.4 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type EventType string
|
|
|
|
const (
|
|
EventTypeMatch EventType = "match"
|
|
EventTypeTraining EventType = "training"
|
|
EventTypeMeeting EventType = "meeting"
|
|
EventTypeOther EventType = "other"
|
|
)
|
|
|
|
type Event struct {
|
|
BaseModel
|
|
Title string `json:"title" gorm:"not null"`
|
|
Description string `json:"description"`
|
|
StartTime time.Time `json:"start_time" gorm:"not null"`
|
|
EndTime *time.Time `json:"end_time"`
|
|
Location string `json:"location"`
|
|
Type EventType `json:"type" gorm:"type:varchar(20);not null;default:'other'"`
|
|
CategoryName string `json:"category_name" gorm:"type:varchar(255)"`
|
|
IsPublic bool `json:"is_public" gorm:"default:true"`
|
|
CreatedByID uint `json:"created_by_id"`
|
|
CreatedBy User `json:"created_by" gorm:"foreignKey:CreatedByID"`
|
|
ImageURL string `json:"image_url"`
|
|
FileURL string `json:"file_url"`
|
|
Attachments []EventAttachment `json:"attachments" gorm:"constraint:OnDelete:CASCADE"`
|
|
YoutubeURL string `json:"youtube_url" gorm:"type:varchar(500)"`
|
|
Latitude *float64 `json:"latitude"`
|
|
Longitude *float64 `json:"longitude"`
|
|
}
|
|
|
|
type EventAttachment struct {
|
|
BaseModel
|
|
EventID uint `json:"event_id" gorm:"index;not null"`
|
|
Name string `json:"name"`
|
|
URL string `json:"url"`
|
|
MimeType string `json:"mime_type"`
|
|
Size int64 `json:"size"`
|
|
}
|