32 lines
746 B
Go
32 lines
746 B
Go
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"
|
|
)
|
|
|
|
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"`
|
|
}
|