From 6595b98b3683fcc14dce6c1f5a19ea31754abb8e Mon Sep 17 00:00:00 2001 From: Seoyoung2222 Date: Sat, 7 Dec 2024 20:42:23 +0900 Subject: [PATCH] =?UTF-8?q?BE:=20[fix]=20=EA=B3=B5=EC=A7=80=EA=B8=80=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=ED=9B=84=20postId=20=EB=B0=98=ED=99=98=20?= =?UTF-8?q?#83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../R2R/domain/crew/common/controller/CrewController.java | 1 - .../crew/post/notice/controller/NoticePostController.java | 4 ++-- .../crew/post/notice/service/NoticePostCommandService.java | 5 +++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/src/main/java/RunningMachines/R2R/domain/crew/common/controller/CrewController.java b/src/backend/src/main/java/RunningMachines/R2R/domain/crew/common/controller/CrewController.java index 2175f6cb..44b1d967 100644 --- a/src/backend/src/main/java/RunningMachines/R2R/domain/crew/common/controller/CrewController.java +++ b/src/backend/src/main/java/RunningMachines/R2R/domain/crew/common/controller/CrewController.java @@ -24,7 +24,6 @@ public class CrewController { public ResponseEntity createCrew(@RequestParam String title, @RequestPart MultipartFile certificationImage,@RequestPart MultipartFile profileImage) { CrewCreateCommandDto crewCreateCommandDto = CrewCreateCommandDto.builder() .title(title) - .certificationImage(certificationImage) .profileImage(profileImage) .build(); diff --git a/src/backend/src/main/java/RunningMachines/R2R/domain/crew/post/notice/controller/NoticePostController.java b/src/backend/src/main/java/RunningMachines/R2R/domain/crew/post/notice/controller/NoticePostController.java index 055557f7..07aa7d31 100644 --- a/src/backend/src/main/java/RunningMachines/R2R/domain/crew/post/notice/controller/NoticePostController.java +++ b/src/backend/src/main/java/RunningMachines/R2R/domain/crew/post/notice/controller/NoticePostController.java @@ -27,8 +27,8 @@ public class NoticePostController { @PostMapping public ResponseEntity createNoticePost(@PathVariable Long crewId, @RequestBody NoticePostCreateRequestDto requestDto) { User currentUser = authCommandService.getCurrentUser(); - noticePostCommandService.createNoticePost(crewId, currentUser, requestDto); - return ResponseEntity.ok(crewId); + Long crewPostId = noticePostCommandService.createNoticePost(crewId, currentUser, requestDto); + return ResponseEntity.ok(crewPostId); } @GetMapping("/{crewPostId}") diff --git a/src/backend/src/main/java/RunningMachines/R2R/domain/crew/post/notice/service/NoticePostCommandService.java b/src/backend/src/main/java/RunningMachines/R2R/domain/crew/post/notice/service/NoticePostCommandService.java index c562baf7..f48f83e2 100644 --- a/src/backend/src/main/java/RunningMachines/R2R/domain/crew/post/notice/service/NoticePostCommandService.java +++ b/src/backend/src/main/java/RunningMachines/R2R/domain/crew/post/notice/service/NoticePostCommandService.java @@ -22,7 +22,7 @@ public class NoticePostCommandService { private final CrewRepository crewRepository; @Transactional - public void createNoticePost(Long crewId, User user, NoticePostCreateRequestDto noticePostCreateRequestDto) { + public Long createNoticePost(Long crewId, User user, NoticePostCreateRequestDto noticePostCreateRequestDto) { Crew crew = validateCrew(crewId); validateLeader(crew, user); @@ -34,7 +34,8 @@ public void createNoticePost(Long crewId, User user, NoticePostCreateRequestDto .user(user) .build(); - crewPostRepository.save(crewPost); + CrewPost savedPost = crewPostRepository.save(crewPost); + return savedPost.getId(); } private Crew validateCrew(Long crewId) {