mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Add activities page.
This commit is contained in:
31
server/model/activity.go
Normal file
31
server/model/activity.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ActivityType uint
|
||||
|
||||
const (
|
||||
ActivityTypeUnknown ActivityType = iota
|
||||
ActivityTypeNewResource
|
||||
ActivityTypeUpdateResource
|
||||
ActivityTypeNewComment
|
||||
)
|
||||
|
||||
type Activity struct {
|
||||
gorm.Model
|
||||
UserID uint `gorm:"not null"`
|
||||
Type ActivityType `gorm:"not null"`
|
||||
RefID uint `gorm:"not null"` // Reference ID for the resource or comment
|
||||
}
|
||||
|
||||
type ActivityView struct {
|
||||
ID uint `json:"id"`
|
||||
Time time.Time `json:"time"`
|
||||
Type ActivityType `json:"type"`
|
||||
User UserView `json:"user"`
|
||||
Comment *CommentWithResourceView `json:"comment,omitempty"`
|
||||
Resource *ResourceView `json:"resource,omitempty"`
|
||||
}
|
Reference in New Issue
Block a user