William Petit
1eaaa9065f
- Enregistrement et prise en compte dans l'affichage des évènements de vote/clotûre d'un DAD
33 lines
790 B
Go
33 lines
790 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"
|
|
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"`
|
|
}
|