photoprism/internal/entity/event.go
Michael Mayer fc5d327494 Photo: DATETIME instead of TIMESTAMP for TakenAt #162
Error logging and labels were also improved along the way.

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2019-12-19 09:37:10 +01:00

35 lines
821 B
Go

package entity
import (
"time"
"github.com/jinzhu/gorm"
"github.com/photoprism/photoprism/internal/util"
)
// Events
type Event struct {
EventUUID string `gorm:"primary_key;auto_increment:false"`
EventSlug string
EventName string
EventType string
EventDescription string `gorm:"type:text;"`
EventNotes string `gorm:"type:text;"`
EventBegin time.Time `gorm:"type:datetime;"`
EventEnd time.Time `gorm:"type:datetime;"`
EventLat float64
EventLong float64
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 {
return scope.SetColumn("EventUUID", util.UUID())
}