Skip to content

Commit

Permalink
fix: 트랙 커버 사진 제거, 가수이름 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jihyo-j committed May 5, 2024
1 parent d77b7fc commit 9f744b7
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ public AnswerDetailResponse updateAnswer(Long answerId, AnswerCreateRequest requ
public void deleteAnswer(Long answerId) {
answerService.deleteAnswer(answerId);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ public enum AnswerError implements ErrorCode {
private final String errorCode;
private final String message;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public Answer updateAnswer(Long answerId, AnswerCreateRequest request, Multipart
@Transactional
public void deleteAnswer(Long answerId) {
Answer answer = answerRepository.findByAnswerId(answerId)
.orElseThrow(() -> new IllegalArgumentException("No answer found with id " + answerId));
.orElseThrow(() -> new BusinessException(AnswerError.NO_EXIST_QUESTION));
answer.getImageFiles().forEach(url -> {
String fileName = url.substring(url.lastIndexOf("/") + 1);
s3ImageStorageService.deleteFile("answers/images", fileName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public class Answer {
@Column(name = "music_name")
private String musicName;

@Column(name = "music_picture")
private String musicPicture;
@Column(name = "muic_singer")
private String musicSinger;

@Column(name = "music_audio")
private String musicAudio;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@
public interface AnswerJpaRepository extends JpaRepository<Answer, Long> {
Page<Answer> findAllByMemberId(Long memberId, Pageable pageable);
}

Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public Answer toEntity(AnswerCreateRequest request, Question question, Member me
.content(request.getContent())
.linkAttachments(request.getLinkAttachments()) // 링크 첨부 리스트 처리
.musicName(request.getMusicName())
.musicPicture(request.getMusicPicture())
.musicSinger(request.getMusicSinger())
.musicAudio(request.getMusicAudio())
.createdDate(LocalDateTime.now())
.heartCount(0) // 초기 감정 횟수 설정
.curiousCount(0) // 초기 궁금함 횟수
.sadCount(0) // 초기 슬픔 횟수
.heartCount(0)
.curiousCount(0)
.sadCount(0)
.build();
}

Expand All @@ -38,7 +38,7 @@ public AnswerDetailResponse toDomain(Answer answer) {
answer.getContent(),
answer.getLinkAttachments(),
answer.getMusicName(),
answer.getMusicPicture(),
answer.getMusicSinger(),
answer.getMusicAudio(),
answer.getImageFiles(),
answer.getCreatedDate(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ public interface AnswerRepository {
Answer save(Answer answer);
Page<Answer> findAllByMemberId(Long memberId, Pageable pageable);
void delete(Answer answer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ public Page<Answer> findAllByMemberId(Long memberId, Pageable pageable) {
public void delete(Answer answerEntity) {
jpaRepository.delete(answerEntity);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ public ResponseEntity<Void> deleteAnswer(@PathVariable Long answerId) {
answerApplication.deleteAnswer(answerId);
return ResponseEntity.noContent().build();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@ public class AnswerCreateRequest {
private String content;
private List<String> linkAttachments;
private String musicName;
private String musicPicture;
private String musicSinger;
private String musicAudio;
private List<String> imageUrls; // 이미지 URL 리스트
private List<MultipartFile> imageFiles; // MultipartFile 리스트, 파일 업로드용

public AnswerCreateRequest(Long questionId, String content, List<String> linkAttachments,
String musicName, String musicPicture, String musicAudio,
String musicName, String musicSinger, String musicAudio,
List<String> imageUrls, List<MultipartFile> imageFiles) {
this.questionId = questionId;
this.content = content;
this.linkAttachments = linkAttachments;
this.musicName = musicName;
this.musicPicture = musicPicture;
this.musicSinger = musicSinger;
this.musicAudio = musicAudio;
this.imageUrls = imageUrls;
this.imageFiles = imageFiles;
}

public static AnswerCreateRequest of(Long questionId, String content, List<String> linkAttachments,
String musicName, String musicPicture, String musicAudio,
String musicName, String musicSinger, String musicAudio,
List<String> imageUrls, List<MultipartFile> imageFiles) {
return new AnswerCreateRequest(questionId, content, linkAttachments, musicName, musicPicture,
musicAudio, imageUrls,imageFiles);
return new AnswerCreateRequest(questionId, content, linkAttachments, musicName,
musicSinger, musicAudio, imageUrls,imageFiles);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class AnswerDetailResponse {
private String content;
private List<String> linkAttachments;
private String musicName;
private String musicPictureUrl;
private String musicSinger;
private String musicAudioUrl;
private List<String> imageUrls;
private LocalDateTime createdDate;
Expand All @@ -24,7 +24,7 @@ public class AnswerDetailResponse {
private Integer sadCount;

public AnswerDetailResponse(Long answerId, Long questionId, Long memberId, String content,
List<String> linkAttachments, String musicName, String musicPictureUrl,
List<String> linkAttachments, String musicName, String musicSinger,
String musicAudioUrl, List<String> imageUrls, LocalDateTime createdDate,
Integer heartCount, Integer curiousCount, Integer sadCount) {
this.answerId = answerId;
Expand All @@ -33,7 +33,7 @@ public AnswerDetailResponse(Long answerId, Long questionId, Long memberId, Strin
this.content = content;
this.linkAttachments = linkAttachments;
this.musicName = musicName;
this.musicPictureUrl = musicPictureUrl;
this.musicSinger = musicSinger;
this.musicAudioUrl = musicAudioUrl;
this.imageUrls = imageUrls;
this.createdDate = createdDate;
Expand All @@ -43,11 +43,11 @@ public AnswerDetailResponse(Long answerId, Long questionId, Long memberId, Strin
}

public static AnswerDetailResponse of(Long answerId, Long questionId, Long memberId, String content,
List<String> linkAttachments, String musicName, String musicPictureUrl,
List<String> linkAttachments, String musicName, String musicSinger,
String musicAudioUrl, List<String> imageUrls, LocalDateTime createdDate,
Integer heartCount, Integer curiousCount, Integer sadCount) {
return new AnswerDetailResponse(answerId, questionId, memberId, content, linkAttachments, musicName,
musicPictureUrl, musicAudioUrl, imageUrls, createdDate,
musicSinger, musicAudioUrl, imageUrls, createdDate,
heartCount, curiousCount, sadCount);
}
}

0 comments on commit 9f744b7

Please sign in to comment.