mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
File download
This commit is contained in:
@@ -85,7 +85,7 @@ func CreateFile(filename string, description string, resourceID uint, storageID
|
||||
|
||||
func GetFile(id uint) (*model.File, error) {
|
||||
f := &model.File{}
|
||||
if err := db.Where("id = ?", id).First(f).Error; err != nil {
|
||||
if err := db.Preload("Storage").Where("id = ?", id).First(f).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, model.NewNotFoundError("file not found")
|
||||
}
|
||||
|
Reference in New Issue
Block a user