优化结构

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
+2
View File
@@ -110,10 +110,12 @@ func (uc *MediaUsecase) Upload(ctx context.Context, userID uint, name, suppliedM
if save {
count, countErr := uc.MediaKeyReferences(ctx, key)
if countErr != nil {
_ = uc.files.Delete(ctx, key)
return nil, countErr
}
if count == 0 {
if err = uc.CreateMedia(ctx, media); err != nil {
_ = uc.files.Delete(ctx, key)
return nil, err
}
}