2019-12-11 16:55:18 +01:00
|
|
|
package entity
|
2019-06-17 07:19:44 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/jinzhu/gorm"
|
2019-12-16 23:33:52 +01:00
|
|
|
"github.com/photoprism/photoprism/internal/util"
|
2019-06-17 07:19:44 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// Events
|
|
|
|
type Event struct {
|
|
|
|
EventUUID string `gorm:"primary_key;auto_increment:false"`
|
|
|
|
EventSlug string
|
|
|
|
EventName string
|
|
|
|
EventType string
|
2019-12-21 17:24:29 +01:00
|
|
|
EventDescription string `gorm:"type:text;"`
|
|
|
|
EventNotes string `gorm:"type:text;"`
|
2019-12-19 09:37:10 +01:00
|
|
|
EventBegin time.Time `gorm:"type:datetime;"`
|
|
|
|
EventEnd time.Time `gorm:"type:datetime;"`
|
2019-06-17 07:19:44 +02:00
|
|
|
EventLat float64
|
2019-12-20 20:23:16 +01:00
|
|
|
EventLng float64
|
2019-06-17 07:19:44 +02:00
|
|
|
EventDist float64
|
|
|
|
CreatedAt time.Time
|
|
|
|
UpdatedAt time.Time
|
|
|
|
DeletedAt *time.Time `sql:"index"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (Event) TableName() string {
|
|
|
|
return "events"
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *Event) BeforeCreate(scope *gorm.Scope) error {
|
2019-12-16 23:33:52 +01:00
|
|
|
return scope.SetColumn("EventUUID", util.UUID())
|
2019-06-17 07:19:44 +02:00
|
|
|
}
|