mirror of
https://github.com/wgh136/nysoure.git
synced 2025-12-16 15:51:14 +00:00
feat: notifications
This commit is contained in:
@@ -693,3 +693,14 @@ func UpdateResourceImage(resourceID, oldImageID, newImageID uint) error {
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func GetResourceOwnerID(resourceID uint) (uint, error) {
|
||||
var uid uint
|
||||
if err := db.Model(&model.Resource{}).Select("user_id").Where("id = ?", resourceID).First(&uid).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return 0, model.NewNotFoundError("Resource not found")
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
return uid, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user