feat: add collection

This commit is contained in:
2025-07-31 15:41:15 +08:00
parent 1e5b12f531
commit 08c70a0b52
38 changed files with 1079 additions and 418 deletions

View File

@@ -35,6 +35,9 @@ func CreateCollection(uid uint, title string, article string, images []uint) (mo
func UpdateCollection(id uint, title string, article string, images []uint) error {
return db.Transaction(func(tx *gorm.DB) error {
collection := &model.Collection{
Model: gorm.Model{
ID: id,
},
Title: title,
Article: article,
}

View File

@@ -34,8 +34,8 @@ func UpdateCollection(uid, id uint, title, article string, host string) error {
}
// Delete a collection by ID.
func DeleteCollection(uint, id uint) error {
user, err := dao.GetUserByID(id)
func DeleteCollection(uid, id uint) error {
user, err := dao.GetUserByID(uid)
if err != nil {
return err
}