【解决todo】AI 音乐:我的音乐修改单独VO

This commit is contained in:
xiaoxin 2024-07-03 11:24:24 +08:00
parent f05f540865
commit b80a76d115
5 changed files with 22 additions and 7 deletions

View File

@ -63,7 +63,7 @@ public class AiMusicController {
@PostMapping("/update-my")
@Operation(summary = "修改【我的】音乐 目前只支持修改标题")
@Parameter(name = "title", required = true, description = "音乐名称", example = "夜空中最亮的星")
public CommonResult<Boolean> updateMy(AiMusicUpdateReqVO updateReqVO) {
public CommonResult<Boolean> updateMy(AiMusicUpdateMyReqVO updateReqVO) {
musicService.updateMyMusic(updateReqVO, getLoginUserId());
return success(true);
}

View File

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.ai.controller.admin.music.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(description = "管理后台 - AI 修改我的音乐 Request VO")
@Data
public class AiMusicUpdateMyReqVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15583")
@NotNull(message = "编号不能为空")
private Long id;
@Schema(description = "音乐名称", example = "夜空中最亮的星")
private String title;
}

View File

@ -15,8 +15,4 @@ public class AiMusicUpdateReqVO {
@Schema(description = "是否发布", example = "true")
private Boolean publicStatus;
// TODO @xin得单独一个 vo因为万一模拟请求就可以改 publicStatus
@Schema(description = "音乐名称", example = "夜空中最亮的星")
private String title;
}

View File

@ -42,7 +42,7 @@ public interface AiMusicService {
*
* @param updateReqVO 更新信息
*/
void updateMyMusic(@Valid AiMusicUpdateReqVO updateReqVO, Long userId);
void updateMyMusic(@Valid AiMusicUpdateMyReqVO updateReqVO, Long userId);
/**
* 删除AI 音乐

View File

@ -9,6 +9,7 @@ import cn.hutool.http.HttpUtil;
import cn.iocoder.yudao.framework.ai.core.model.suno.api.SunoApi;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.ai.controller.admin.music.vo.AiMusicPageReqVO;
import cn.iocoder.yudao.module.ai.controller.admin.music.vo.AiMusicUpdateMyReqVO;
import cn.iocoder.yudao.module.ai.controller.admin.music.vo.AiMusicUpdateReqVO;
import cn.iocoder.yudao.module.ai.controller.admin.music.vo.AiSunoGenerateReqVO;
import cn.iocoder.yudao.module.ai.dal.dataobject.music.AiMusicDO;
@ -111,7 +112,7 @@ public class AiMusicServiceImpl implements AiMusicService {
}
@Override
public void updateMyMusic(AiMusicUpdateReqVO updateReqVO, Long userId) {
public void updateMyMusic(AiMusicUpdateMyReqVO updateReqVO, Long userId) {
// 校验音乐是否存在
AiMusicDO musicDO = validateMusicExists(updateReqVO.getId());
if (ObjUtil.notEqual(musicDO.getUserId(), userId)) {