feat: notifications

This commit is contained in:
2025-11-30 19:24:51 +08:00
parent 4550720cbb
commit 4a6c214709
14 changed files with 492 additions and 37 deletions

View File

@@ -18,9 +18,10 @@ const (
type Activity struct {
gorm.Model
UserID uint `gorm:"not null"`
Type ActivityType `gorm:"not null;index:idx_type_refid"`
RefID uint `gorm:"not null;index:idx_type_refid"`
UserID uint `gorm:"not null"`
Type ActivityType `gorm:"not null;index:idx_type_refid"`
RefID uint `gorm:"not null;index:idx_type_refid"`
NotifyTo uint `gorm:"default:null;index"`
}
type ActivityView struct {

View File

@@ -9,16 +9,17 @@ import (
type User struct {
gorm.Model
Username string `gorm:"uniqueIndex;not null"`
PasswordHash []byte
IsAdmin bool
CanUpload bool
AvatarVersion int
ResourcesCount int
FilesCount int
CommentsCount int
Resources []Resource `gorm:"foreignKey:UserID"`
Bio string
Username string `gorm:"uniqueIndex;not null"`
PasswordHash []byte
IsAdmin bool
CanUpload bool
AvatarVersion int
ResourcesCount int
FilesCount int
CommentsCount int
Resources []Resource `gorm:"foreignKey:UserID"`
Bio string
UnreadNotificationsCount uint
}
type UserView struct {