Skip to content

Conversation

@kdomo
Copy link
Member

@kdomo kdomo commented Jan 18, 2023

관련 이슈 번호

설명

레코드 삭제 API 구현

변경사항

  • NotMatchLoginUserWithRecordWriterException

질문사항

@kdomo kdomo added the ✨ Feature 기능 개발 label Jan 18, 2023
@kdomo kdomo self-assigned this Jan 18, 2023
Comment on lines 80 to 93
@ApiOperation(
value = "레코드 단건 조회",
notes = "레코드를 단건 조회합니다."
)
@ApiResponses({
@ApiResponse(
code = 200, message = "레코드 조회 성공",
response = RecordDetailResponseDto.class
),
@ApiResponse(
code = 400, message = "레코드가 없는 경우",
response = ErrorMessage.class
)
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@ApiOperation(
value = "레코드 단건 조회",
notes = "레코드를 단건 조회합니다."
)
@ApiResponses({
@ApiResponse(
code = 200, message = "레코드 조회 성공",
response = RecordDetailResponseDto.class
),
@ApiResponse(
code = 400, message = "레코드가 없는 경우",
response = ErrorMessage.class
)
})
@ApiOperation(
value = "레코드 단건 조회",
notes = "레코드를 단건 조회합니다."
)
@ApiResponses({
@ApiResponse(
code = 200, message = "레코드 조회 성공",
response = RecordDetailResponseDto.class
),
@ApiResponse(
code = 400, message = "레코드가 없는 경우",
response = ErrorMessage.class
)
})

삭제로 바꿔야 될듯용

@Transactional
public WriteRecordResponseDto writeRecord(WriteRecordRequestDto writeRecordRequestDto,
List<MultipartFile> attachments) {
sessionUtil.saveUserIdInSession(1L);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지워야 될듯용


@Transactional
public void deleteRecord(Long recordId) {
sessionUtil.saveUserIdInSession(1L);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도

Comment on lines +124 to +132
Member member = memberRepository.findById(userIdBySession)
.orElseThrow(() -> new MemberNotFoundException("회원 정보를 찾을 수 없습니다."));

Record record = recordRepository.findByIdFetchWriter(recordId)
.orElseThrow(() -> new RecordNotFoundException("레코드 정보를 찾을 수 없습니다."));

if (record.getWriter().getId() != member.getId()) {
throw new NotMatchLoginUserWithRecordWriterException("로그인 한 사용자와 글 작성자가 일치하지 않습니다.");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

관련 테스트 코드도 작성해주세요

@Jaeyeop-Jung Jaeyeop-Jung merged commit a572249 into develop Jan 20, 2023
@Jaeyeop-Jung Jaeyeop-Jung deleted the feature/BE-115 branch January 20, 2023 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 기능 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants