diff --git a/src/main/java/com/gdg/kkia/dailyresponse/controller/DailyQuestionResponseController.java b/src/main/java/com/gdg/kkia/dailyresponse/controller/DailyQuestionResponseController.java index e94544b..355148b 100644 --- a/src/main/java/com/gdg/kkia/dailyresponse/controller/DailyQuestionResponseController.java +++ b/src/main/java/com/gdg/kkia/dailyresponse/controller/DailyQuestionResponseController.java @@ -75,8 +75,8 @@ public ResponseEntity getOneResponseOfDailyQuestion(@Requ return ResponseEntity.ok().body(dailyResponseResponse); } - @Operation(summary = "본인이 모든 답변 조회", description = "본인이 작성한 모든 답변을 조회합니다.") - @GetMapping("/response/{localDate}") + @Operation(summary = "날짜별 본인이 모든 답변 조회", description = "localDate에 본인이 작성한 모든 답변을 조회합니다.") + @GetMapping("/response/all/{localDate}") public ResponseEntity> getAllResponseOfDailyQuestion(@RequestAttribute("memberId") Long memberId, @PathVariable("localDate") LocalDate localDate) { List dailyResponseResponses = dailyResponseService.getAllResponseOfDailyQuestionInLocalDate(memberId, localDate); return ResponseEntity.ok().body(dailyResponseResponses); diff --git a/src/main/java/com/gdg/kkia/diary/controller/DiaryController.java b/src/main/java/com/gdg/kkia/diary/controller/DiaryController.java index fcbebc9..299bd24 100644 --- a/src/main/java/com/gdg/kkia/diary/controller/DiaryController.java +++ b/src/main/java/com/gdg/kkia/diary/controller/DiaryController.java @@ -22,15 +22,15 @@ public class DiaryController { private final DiaryService diaryService; - @Operation(summary = "일기 작성", description = "사용자가 일기를 작성합니다.") + @Operation(summary = "일기 작성", description = "사용자가 일기를 작성합니다. 리스트형태로 여러개를 넣을 수 있습니다.") @PostMapping - public ResponseEntity writeDiary(@RequestAttribute("memberId") Long memberId, @RequestBody DiaryWriteRequest diaryWriteRequest) { - diaryService.writeDiary(memberId, diaryWriteRequest); + public ResponseEntity writeDiary(@RequestAttribute("memberId") Long memberId, @RequestBody List diaryWriteRequests) { + diaryService.writeDiary(memberId, diaryWriteRequests); return ResponseEntity.status(HttpStatus.CREATED).body(new StringTypeMessageResponse("일기가 작성되었습니다.")); } @Operation(summary = "유저의 날짜별 작성 일기 조회", description = "localDate에 해당하는 날짜에 사용자가 작성했던 모든 일기를 조회합니다.") - @GetMapping("/{localDate}") + @GetMapping("/all/{localDate}") public ResponseEntity> getAllDiary(@RequestAttribute("memberId") Long memberId, @PathVariable("localDate") LocalDate localDate) { List diaryReadResponses = diaryService.getAllDiaryWrittenByMemberInLocalDate(memberId, localDate); return ResponseEntity.ok().body(diaryReadResponses); diff --git a/src/main/java/com/gdg/kkia/diary/dto/DiaryReadResponse.java b/src/main/java/com/gdg/kkia/diary/dto/DiaryReadResponse.java index caf678a..42a436c 100644 --- a/src/main/java/com/gdg/kkia/diary/dto/DiaryReadResponse.java +++ b/src/main/java/com/gdg/kkia/diary/dto/DiaryReadResponse.java @@ -6,7 +6,7 @@ public record DiaryReadResponse( Long diaryId, - LocalDateTime localDateTime, + LocalDateTime writtenDateTime, Diary.Type type, String content ) { diff --git a/src/main/java/com/gdg/kkia/diary/service/DiaryService.java b/src/main/java/com/gdg/kkia/diary/service/DiaryService.java index 64f0c81..b0fdf80 100644 --- a/src/main/java/com/gdg/kkia/diary/service/DiaryService.java +++ b/src/main/java/com/gdg/kkia/diary/service/DiaryService.java @@ -24,12 +24,14 @@ public class DiaryService { private final MemberRepository memberRepository; @Transactional - public void writeDiary(Long memberId, DiaryWriteRequest diaryWriteRequest) { + public void writeDiary(Long memberId, List diaryWriteRequests) { Member member = memberRepository.findById(memberId) .orElseThrow(() -> new NotFoundException("id에 해당하는 멤버가 없습니다.")); - Diary diary = new Diary(diaryWriteRequest.type(), diaryWriteRequest.content(), member); - diaryRepository.save(diary); + for (DiaryWriteRequest diaryWriteRequest : diaryWriteRequests) { + Diary diary = new Diary(diaryWriteRequest.type(), diaryWriteRequest.content(), member); + diaryRepository.save(diary); + } } @Transactional(readOnly = true) diff --git a/src/main/java/com/gdg/kkia/member/controller/MemberController.java b/src/main/java/com/gdg/kkia/member/controller/MemberController.java index dc4d3a0..9e5559b 100644 --- a/src/main/java/com/gdg/kkia/member/controller/MemberController.java +++ b/src/main/java/com/gdg/kkia/member/controller/MemberController.java @@ -14,7 +14,7 @@ @RestController @RequiredArgsConstructor @RequestMapping("/api") -@Tag(name = "인증", description = "인증 관련 API") +@Tag(name = "회원 관리", description = "회원 관리 관련 API") public class MemberController { private final MemberService memberService;