切换批次和文件的 ID 类型为 UUID,更新相关逻辑和文档
This commit is contained in:
@@ -57,9 +57,9 @@ func (s *BatchService) MarkAsExpired(batch *model.FileBatch) error {
|
||||
return s.db.Model(batch).Update("status", "expired").Error
|
||||
}
|
||||
|
||||
func (s *BatchService) DeleteBatch(ctx context.Context, batchID uint) error {
|
||||
func (s *BatchService) DeleteBatch(ctx context.Context, batchID string) error {
|
||||
var batch model.FileBatch
|
||||
if err := s.db.Preload("FileItems").First(&batch, batchID).Error; err != nil {
|
||||
if err := s.db.Preload("FileItems").First(&batch, "id = ?", batchID).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ func (s *BatchService) DeleteBatch(ctx context.Context, batchID uint) error {
|
||||
})
|
||||
}
|
||||
|
||||
func (s *BatchService) IncrementDownloadCount(batchID uint) error {
|
||||
func (s *BatchService) IncrementDownloadCount(batchID string) error {
|
||||
return s.db.Model(&model.FileBatch{}).Where("id = ?", batchID).
|
||||
UpdateColumn("download_count", gorm.Expr("download_count + ?", 1)).Error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user