William Petit
f169169bc7
- Ajout d'une nouvelle entité "Event" - Affichage d'une "timeline" sur le tableau de bord - Création semi-automatique des évènements lors des modifications par les utilisateurs
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"`
|
|
}
|