feat: align ids to int64
This commit is contained in:
@@ -22,7 +22,6 @@ import (
|
||||
"quyun/v2/providers/storage"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/spf13/cast"
|
||||
"go.ipao.vip/gen/types"
|
||||
)
|
||||
|
||||
@@ -261,17 +260,16 @@ func (s *common) CompleteUpload(ctx context.Context, userID int64, form *common_
|
||||
return s.composeUploadResult(asset), nil
|
||||
}
|
||||
|
||||
func (s *common) DeleteMediaAsset(ctx context.Context, userID int64, id string) error {
|
||||
aid := cast.ToInt64(id)
|
||||
func (s *common) DeleteMediaAsset(ctx context.Context, userID int64, id int64) error {
|
||||
asset, err := models.MediaAssetQuery.WithContext(ctx).
|
||||
Where(models.MediaAssetQuery.ID.Eq(aid), models.MediaAssetQuery.UserID.Eq(userID)).
|
||||
Where(models.MediaAssetQuery.ID.Eq(id), models.MediaAssetQuery.UserID.Eq(userID)).
|
||||
First()
|
||||
if err != nil {
|
||||
return errorx.ErrRecordNotFound
|
||||
}
|
||||
|
||||
// Delete DB record
|
||||
if _, err := models.MediaAssetQuery.WithContext(ctx).Where(models.MediaAssetQuery.ID.Eq(aid)).Delete(); err != nil {
|
||||
if _, err := models.MediaAssetQuery.WithContext(ctx).Where(models.MediaAssetQuery.ID.Eq(id)).Delete(); err != nil {
|
||||
return errorx.ErrDatabaseError.WithCause(err)
|
||||
}
|
||||
|
||||
@@ -411,7 +409,7 @@ func (s *common) composeUploadResult(asset *models.MediaAsset) *common_dto.Uploa
|
||||
size := asset.Meta.Data().Size
|
||||
|
||||
return &common_dto.UploadResult{
|
||||
ID: cast.ToString(asset.ID),
|
||||
ID: asset.ID,
|
||||
URL: url,
|
||||
Filename: filename,
|
||||
Size: size,
|
||||
|
||||
Reference in New Issue
Block a user