优化结构

This commit is contained in:
Yvan
2026-08-28 16:23:52 +08:00
parent 9b1daaf3f6
commit 295ee5c49e
24 changed files with 128 additions and 145 deletions
+3
View File
@@ -60,6 +60,9 @@ func (r *mediaRepo) CreateMedia(ctx context.Context, v *system.MediaFile) error
func (r *mediaRepo) FindMedia(ctx context.Context, id uint) (*system.MediaFile, error) {
var po mediaPO
if err := r.data.DB().WithContext(ctx).First(&po, id).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, system.ErrMediaNotFound
}
return nil, err
}
return mediaFromPO(po), nil