Add activities page.

This commit is contained in:
2025-06-13 19:32:25 +08:00
parent 0b3b54a0c4
commit 1f238c56f3
18 changed files with 424 additions and 70 deletions

31
server/model/activity.go Normal file
View 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"`
}