daddy/internal/model/event.go

33 lines
790 B
Go
Raw Permalink Normal View History

package model
import (
"github.com/jinzhu/gorm"
)
type EventType string
const (
EventTypeCreated EventType = "created"
EventTypeUpdated EventType = "updated"
EventTypeLeaved EventType = "leaved"
EventTypeJoined EventType = "joined"
EventTypeClosed EventType = "closed"
EventTypeStatusChanged EventType = "status-changed"
EventTypeTitleChanged EventType = "title-changed"
EventTypeVoted EventType = "voted"
)
type EventObject interface {
ObjectID() uint
ObjectType() string
}
type Event struct {
gorm.Model
UserID uint `json:"-"`
User *User `json:"user" gorm:"association_autoupdate:false"`
ObjectType string `json:"objectType"`
ObjectID uint `json:"objectId"`
Type EventType `json:"type"`
}