fix: keep existing library files in place

This commit is contained in:
ShukeBta
2026-05-29 03:04:27 +08:00
parent fc0dc70bad
commit 48d33275cb
7 changed files with 168 additions and 31 deletions
+3
View File
@@ -276,6 +276,9 @@ func (r *MediaRepository) Upsert(ctx context.Context, m *model.Media) error {
if m.EpisodeNum > 0 && existing.EpisodeNum != m.EpisodeNum {
updates["episode_num"] = m.EpisodeNum
}
if m.STRMURL != "" {
updates["strm_url"] = m.STRMURL
}
if err := r.db.WithContext(ctx).Unscoped().Model(&model.Media{}).
Where("id = ?", existing.ID).Updates(updates).Error; err != nil {