Skip to content

Commit

Permalink
Merge branch 'dev' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
gouyeonch committed Oct 15, 2024
2 parents d7f4300 + 37c44e3 commit 9731ec6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,13 @@ public ResponseDto<String> deleteViewNews(
log.info("deleteViewNews controller");
return ResponseDto.ok(newsLogService.deleteNewsHist(newsIdList));
}

@Operation(summary = "뉴스 시청기록 일괄삭제")
@DeleteMapping("/user")
public ResponseDto<String> deleteViewNewsByUser(
@UserId Long userId
) {
log.info("deleteViewNewsByUser controller");
return ResponseDto.ok(newsLogService.deleteNewsHistByUserId(userId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,16 @@ public String deleteNewsHist(String newsHistIdList) {
return "success";
}

@Transactional
public String deleteNewsHistByUserId(Long userId) {
log.info("deleteNewsHistByUserId service");
User user = userLookupService.findUserById(userId);

newsViewHistRepository.deleteAllByUser(user);

return "success";
}

private NewsHistInfoDto getNewsHistInfo(NewsViewHist newsViewHist) {
return NewsHistInfoDto.builder()
.id(newsViewHist.getId())
Expand Down

0 comments on commit 9731ec6

Please sign in to comment.