mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Add CollectionResource model and update collection handling methods
This commit is contained in:
@@ -4,14 +4,13 @@ import "gorm.io/gorm"
|
||||
|
||||
type Collection struct {
|
||||
gorm.Model
|
||||
Title string `gorm:"not null"`
|
||||
Article string `gorm:"not null"`
|
||||
UserID uint `gorm:"not null"`
|
||||
User User `gorm:"foreignKey:UserID;references:ID"`
|
||||
ResourcesCount int `gorm:"default:0"`
|
||||
Images []Image `gorm:"many2many:collection_images;"`
|
||||
Resources []Resource `gorm:"many2many:collection_resources;"`
|
||||
Public bool `gorm:"default:false"` // 新增公开/私有字段
|
||||
Title string `gorm:"not null"`
|
||||
Article string `gorm:"not null"`
|
||||
UserID uint `gorm:"not null"`
|
||||
User User `gorm:"foreignKey:UserID;references:ID"`
|
||||
ResourcesCount int `gorm:"default:0"`
|
||||
Images []Image `gorm:"many2many:collection_images;"`
|
||||
Public bool `gorm:"default:false"` // 新增公开/私有字段
|
||||
}
|
||||
|
||||
type CollectionView struct {
|
||||
|
9
server/model/collection_resource.go
Normal file
9
server/model/collection_resource.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type CollectionResource struct {
|
||||
CollectionID uint `gorm:"primaryKey"`
|
||||
ResourceID uint `gorm:"primaryKey"`
|
||||
CreatedAt time.Time
|
||||
}
|
Reference in New Issue
Block a user