app/calendar/event.go

29 lines
365 B
Go

package calendar
import (
"time"
"github.com/rs/xid"
"gorm.io/gorm"
)
type Event struct {
ID string `gorm:"primaryKey"`
Start time.Time
End time.Time
CalendarID string
EventGroupID string
CreatedAt time.Time
UpdatedAt time.Time
}
func (e *Event) BeforeCreate(tx *gorm.DB) (err error) {
if e.ID == "" {
e.ID = xid.New().String()
}
return
}