feat(video): add likescount and updatelikescount

This commit is contained in:
Leon
2025-12-09 21:11:29 +08:00
parent d1c0f049d6
commit 8e51de9410
6 changed files with 68 additions and 6 deletions

View File

@@ -40,3 +40,12 @@ func (vr *VideoRepository) GetByID(ctx context.Context, id uint) (*Video, error)
}
return &video, nil
}
func (vr *VideoRepository) UpdateLikesCount(ctx context.Context, id uint, likesCount int64) error {
if err := vr.db.WithContext(ctx).Model(&Video{}).
Where("id = ?", id).
Update("likes_count", likesCount).Error; err != nil {
return err
}
return nil
}