From dc7aa6c7b2c9cbf8e0f99919bcc4f847771da27b Mon Sep 17 00:00:00 2001 From: JeonghoPark Date: Tue, 20 Jun 2023 15:33:33 +0900 Subject: [PATCH 01/11] =?UTF-8?q?[LAS-48]=20feat:=20=EB=AA=A8=EC=A7=91?= =?UTF-8?q?=EA=B8=80=20=EA=B8=80=EC=93=B0=EA=B8=B0=20=EC=99=84=EB=A3=8C=20?= =?UTF-8?q?=EC=8B=9C=20=EB=AA=A8=EC=A7=91=EA=B8=80=20id=20=EC=9D=91?= =?UTF-8?q?=EB=8B=B5=20=EB=8D=B0=EC=9D=B4=ED=84=B0=EB=A1=9C=20=EC=A0=84?= =?UTF-8?q?=EC=86=A1=ED=95=98=EB=8A=94=20=EB=A1=9C=EC=A7=81=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apiserver/controller/RecruitmentController.java | 9 +++------ .../service/recruitment/RecruitmentService.java | 2 +- .../service/recruitment/RecruitmentServiceImpl.java | 5 +++-- .../lastone/core/dto/recruitment/RecruitmentIdDto.java | 10 ++++++++++ 4 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 core/src/main/java/com/lastone/core/dto/recruitment/RecruitmentIdDto.java diff --git a/api-server/src/main/java/com/lastone/apiserver/controller/RecruitmentController.java b/api-server/src/main/java/com/lastone/apiserver/controller/RecruitmentController.java index e1873ab9..35db72a4 100644 --- a/api-server/src/main/java/com/lastone/apiserver/controller/RecruitmentController.java +++ b/api-server/src/main/java/com/lastone/apiserver/controller/RecruitmentController.java @@ -4,10 +4,7 @@ import com.lastone.apiserver.service.recruitment.RecruitmentService; import com.lastone.core.common.response.CommonResponse; import com.lastone.core.common.response.SuccessCode; -import com.lastone.core.dto.recruitment.RecruitmentRequestDto; -import com.lastone.core.dto.recruitment.RecruitmentDetailDto; -import com.lastone.core.dto.recruitment.RecruitmentListDto; -import com.lastone.core.dto.recruitment.RecruitmentSearchCondition; +import com.lastone.core.dto.recruitment.*; import com.lastone.core.security.principal.UserDetailsImpl; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -55,10 +52,10 @@ public ResponseEntity getRecruitmentListInMain() { public ResponseEntity createRecruitment(@AuthenticationPrincipal UserDetailsImpl userDetails, @RequestPart @Validated RecruitmentRequestDto recruitment, @RequestPart(required = false) List imgFiles) throws IOException { - recruitmentService.createRecruitment(userDetails.getId(), recruitment, imgFiles); + Long recruitmentId = recruitmentService.createRecruitment(userDetails.getId(), recruitment, imgFiles); return ResponseEntity .status(HttpStatus.CREATED) - .body(CommonResponse.success(SuccessCode.RECRUITMENT_CREATE)); + .body(CommonResponse.success(SuccessCode.RECRUITMENT_CREATE, new RecruitmentIdDto(recruitmentId))); } @PreAuthorize("isAuthenticated()") diff --git a/api-server/src/main/java/com/lastone/apiserver/service/recruitment/RecruitmentService.java b/api-server/src/main/java/com/lastone/apiserver/service/recruitment/RecruitmentService.java index cf211445..4bf666e8 100644 --- a/api-server/src/main/java/com/lastone/apiserver/service/recruitment/RecruitmentService.java +++ b/api-server/src/main/java/com/lastone/apiserver/service/recruitment/RecruitmentService.java @@ -17,7 +17,7 @@ public interface RecruitmentService { List getMainList(); - void createRecruitment(Long memberId, RecruitmentRequestDto recruitmentCreateDto, List imgFiles) throws IOException; + Long createRecruitment(Long memberId, RecruitmentRequestDto recruitmentCreateDto, List imgFiles) throws IOException; void updateRecruitment(Long recruitmentId, Long memberId, RecruitmentRequestDto recruitment, List imgFiles) throws IOException; diff --git a/api-server/src/main/java/com/lastone/apiserver/service/recruitment/RecruitmentServiceImpl.java b/api-server/src/main/java/com/lastone/apiserver/service/recruitment/RecruitmentServiceImpl.java index d15f10fd..c8e6b0e0 100644 --- a/api-server/src/main/java/com/lastone/apiserver/service/recruitment/RecruitmentServiceImpl.java +++ b/api-server/src/main/java/com/lastone/apiserver/service/recruitment/RecruitmentServiceImpl.java @@ -77,7 +77,7 @@ public List getMainList() { @Transactional(rollbackFor = Exception.class) @Override - public void createRecruitment(Long memberId, RecruitmentRequestDto recruitmentRequestDto, List imgFiles) throws IOException { + public Long createRecruitment(Long memberId, RecruitmentRequestDto recruitmentRequestDto, List imgFiles) throws IOException { Gym gym = findGym(recruitmentRequestDto.getGym()); Member member = memberRepository.findById(memberId).orElseThrow(MemberNotFountException::new); Recruitment recruitment = Recruitment.create(member, gym, recruitmentRequestDto); @@ -85,7 +85,8 @@ public void createRecruitment(Long memberId, RecruitmentRequestDto recruitmentRe if (imgFileIsExist(imgFiles)) { recruitment.setImgFiles(saveRecruitmentImg(imgFiles)); } - recruitmentRepository.save(recruitment); + Recruitment saveRecruitment = recruitmentRepository.save(recruitment); + return saveRecruitment.getId(); } @Transactional(rollbackFor = Exception.class) diff --git a/core/src/main/java/com/lastone/core/dto/recruitment/RecruitmentIdDto.java b/core/src/main/java/com/lastone/core/dto/recruitment/RecruitmentIdDto.java new file mode 100644 index 00000000..3a7e50fc --- /dev/null +++ b/core/src/main/java/com/lastone/core/dto/recruitment/RecruitmentIdDto.java @@ -0,0 +1,10 @@ +package com.lastone.core.dto.recruitment; + +public class RecruitmentIdDto { + + private final Long id; + + public RecruitmentIdDto(Long id) { + this.id = id; + } +} \ No newline at end of file From 352d71ce4c5acc90bb9c0a93cd71ef6780792c22 Mon Sep 17 00:00:00 2001 From: JeonghoPark Date: Mon, 26 Jun 2023 00:38:42 +0900 Subject: [PATCH 02/11] =?UTF-8?q?[LAS-48]=20fix:=20=EB=AA=A8=EC=A7=91?= =?UTF-8?q?=EA=B8=80=20=EA=B2=80=EC=83=89=20=EA=B4=80=EB=A0=A8=20=EB=82=A0?= =?UTF-8?q?=EC=A7=9C=20=EA=B2=80=EC=A6=9D=EA=B3=BC=20=EB=AA=A8=EC=A7=91?= =?UTF-8?q?=EA=B8=80=20=EC=83=9D=EC=84=B1=20=EA=B4=80=EB=A0=A8=20=EB=82=A0?= =?UTF-8?q?=EC=A7=9C=20=EA=B2=80=EC=A6=9D=20=EB=A1=9C=EC=A7=81=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../recruitment/RecruitmentCreateDate.java | 17 ++++++++++++ .../RecruitmentCreateDateValidator.java | 26 +++++++++++++++++++ .../recruitment/RecruitmentDateValidator.java | 8 ++---- 3 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 core/src/main/java/com/lastone/core/util/validator/recruitment/RecruitmentCreateDate.java create mode 100644 core/src/main/java/com/lastone/core/util/validator/recruitment/RecruitmentCreateDateValidator.java diff --git a/core/src/main/java/com/lastone/core/util/validator/recruitment/RecruitmentCreateDate.java b/core/src/main/java/com/lastone/core/util/validator/recruitment/RecruitmentCreateDate.java new file mode 100644 index 00000000..484c4ab9 --- /dev/null +++ b/core/src/main/java/com/lastone/core/util/validator/recruitment/RecruitmentCreateDate.java @@ -0,0 +1,17 @@ +package com.lastone.core.util.validator.recruitment; + +import javax.validation.Constraint; +import javax.validation.Payload; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +@Constraint(validatedBy = RecruitmentCreateDateValidator.class) +public @interface RecruitmentCreateDate { + String message() default "유효하지 않은 날짜 형식입니다."; + Class[] groups() default {}; + Class[] payload() default {}; +} \ No newline at end of file diff --git a/core/src/main/java/com/lastone/core/util/validator/recruitment/RecruitmentCreateDateValidator.java b/core/src/main/java/com/lastone/core/util/validator/recruitment/RecruitmentCreateDateValidator.java new file mode 100644 index 00000000..425284a5 --- /dev/null +++ b/core/src/main/java/com/lastone/core/util/validator/recruitment/RecruitmentCreateDateValidator.java @@ -0,0 +1,26 @@ +package com.lastone.core.util.validator.recruitment; + +import org.springframework.util.StringUtils; +import javax.validation.ConstraintValidator; +import javax.validation.ConstraintValidatorContext; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; + +public class RecruitmentCreateDateValidator implements ConstraintValidator { + @Override + public boolean isValid(String date, ConstraintValidatorContext context) { + if (!StringUtils.hasText(date)) { + return false; + } + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd"); + LocalDate dateCondition; + try { + dateCondition = LocalDate.parse(date, formatter); + } catch (DateTimeParseException e) { + return false; + } + LocalDate now = LocalDate.now(); + return !now.isAfter(dateCondition); + } +} diff --git a/core/src/main/java/com/lastone/core/util/validator/recruitment/RecruitmentDateValidator.java b/core/src/main/java/com/lastone/core/util/validator/recruitment/RecruitmentDateValidator.java index 763967db..c8977023 100644 --- a/core/src/main/java/com/lastone/core/util/validator/recruitment/RecruitmentDateValidator.java +++ b/core/src/main/java/com/lastone/core/util/validator/recruitment/RecruitmentDateValidator.java @@ -1,7 +1,6 @@ package com.lastone.core.util.validator.recruitment; import org.springframework.util.StringUtils; - import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; import java.time.LocalDate; @@ -10,20 +9,17 @@ public class RecruitmentDateValidator implements ConstraintValidator { - @Override public boolean isValid(String date, ConstraintValidatorContext context) { if (!StringUtils.hasText(date)) { return true; } DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd"); - LocalDate dateCondition; try { - dateCondition = LocalDate.parse(date, formatter); + LocalDate.parse(date, formatter); } catch (DateTimeParseException e) { return false; } - LocalDate now = LocalDate.now(); - return !now.isAfter(dateCondition); + return true; } } From f48097fefb6c8c24d260f8225a313ed1601e0ecf Mon Sep 17 00:00:00 2001 From: JeonghoPark Date: Mon, 26 Jun 2023 00:39:48 +0900 Subject: [PATCH 03/11] =?UTF-8?q?[LAS-48]=20fix:=20=EB=AA=A8=EC=A7=91?= =?UTF-8?q?=EA=B8=80=20=EC=83=9D=EC=84=B1=20=EC=8B=9C=20=EB=82=A0=EC=A7=9C?= =?UTF-8?q?=20=EC=9C=A0=ED=9A=A8=EC=84=B1=20=EA=B2=80=EC=A6=9D=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/lastone/core/dto/recruitment/StartedAtDto.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/lastone/core/dto/recruitment/StartedAtDto.java b/core/src/main/java/com/lastone/core/dto/recruitment/StartedAtDto.java index 70ffcef1..3c4dc3ac 100644 --- a/core/src/main/java/com/lastone/core/dto/recruitment/StartedAtDto.java +++ b/core/src/main/java/com/lastone/core/dto/recruitment/StartedAtDto.java @@ -1,6 +1,6 @@ package com.lastone.core.dto.recruitment; -import com.lastone.core.util.validator.recruitment.RecruitmentDate; +import com.lastone.core.util.validator.recruitment.RecruitmentCreateDate; import com.lastone.core.util.validator.recruitment.RecruitmentTime; import lombok.Getter; import lombok.Setter; @@ -16,7 +16,7 @@ public class StartedAtDto { @NotBlank - @RecruitmentDate + @RecruitmentCreateDate private String date; @NotNull From 27161f372cc37544e95a9c3cbaa224c710b25e7a Mon Sep 17 00:00:00 2001 From: JeonghoPark Date: Mon, 26 Jun 2023 01:13:50 +0900 Subject: [PATCH 04/11] =?UTF-8?q?[LAS-54]=20feat:=20=EB=8B=89=EB=84=A4?= =?UTF-8?q?=EC=9E=84=20=EC=A4=91=EB=B3=B5=20=EA=B2=80=EC=A6=9D=20=EA=B2=B0?= =?UTF-8?q?=EA=B3=BC=20=EB=B0=98=ED=99=98=EC=9D=84=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?dto=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/lastone/core/dto/mypage/NicknameCheckDto.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 core/src/main/java/com/lastone/core/dto/mypage/NicknameCheckDto.java diff --git a/core/src/main/java/com/lastone/core/dto/mypage/NicknameCheckDto.java b/core/src/main/java/com/lastone/core/dto/mypage/NicknameCheckDto.java new file mode 100644 index 00000000..91abe5bb --- /dev/null +++ b/core/src/main/java/com/lastone/core/dto/mypage/NicknameCheckDto.java @@ -0,0 +1,11 @@ +package com.lastone.core.dto.mypage; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class NicknameCheckDto { + + private Boolean isDuplicated; +} From ddf84cbce5af83de34dc4f87a1ae8ea5b609b2ab Mon Sep 17 00:00:00 2001 From: JeonghoPark Date: Mon, 26 Jun 2023 01:14:53 +0900 Subject: [PATCH 05/11] =?UTF-8?q?[LAS-54]=20feat:=20=EB=8B=89=EB=84=A4?= =?UTF-8?q?=EC=9E=84=20=EC=A4=91=EB=B3=B5=20=EA=B2=80=EC=A6=9D=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20SuccessCode=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/lastone/core/common/response/SuccessCode.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main/java/com/lastone/core/common/response/SuccessCode.java b/core/src/main/java/com/lastone/core/common/response/SuccessCode.java index a702d96c..f3f76507 100644 --- a/core/src/main/java/com/lastone/core/common/response/SuccessCode.java +++ b/core/src/main/java/com/lastone/core/common/response/SuccessCode.java @@ -9,6 +9,7 @@ public enum SuccessCode { GET_CHAT_ROOM_LIST("채팅방 목록 조회에 성공하였습니다."), /* My Page */ + VALIDATE_NICKNAME("닉네임 중복 검증을 완료하였습니다."), INQUIRE_MYPAGE("마이페이지 정보 조회에 성공하였습니다."), UPDATE_MYPAGE("마이페이지 수정 작업에 성공하였습니다."), From 351330a2ec6188a38ae1476eaa3e08cc0d751b71 Mon Sep 17 00:00:00 2001 From: JeonghoPark Date: Mon, 26 Jun 2023 01:15:55 +0900 Subject: [PATCH 06/11] =?UTF-8?q?[LAS-54]=20fix:=20=EA=B8=B0=EC=A1=B4=20me?= =?UTF-8?q?mberService=20=EB=8B=89=EB=84=A4=EC=9E=84=20=EC=A4=91=EB=B3=B5?= =?UTF-8?q?=20=EA=B2=80=EC=A6=9D=20=EA=B4=80=EB=A0=A8=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=A0=91=EA=B7=BC=EC=A0=9C=EC=96=B4=EC=9E=90=20pub?= =?UTF-8?q?lic=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/lastone/apiserver/service/member/MemberService.java | 2 ++ .../com/lastone/apiserver/service/member/MemberServiceImpl.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api-server/src/main/java/com/lastone/apiserver/service/member/MemberService.java b/api-server/src/main/java/com/lastone/apiserver/service/member/MemberService.java index beebea68..31edd273 100644 --- a/api-server/src/main/java/com/lastone/apiserver/service/member/MemberService.java +++ b/api-server/src/main/java/com/lastone/apiserver/service/member/MemberService.java @@ -7,6 +7,8 @@ public interface MemberService { + boolean isDuplicateNickname(String nickname); + Member findById(Long memberId); void update(Member member, MemberUpdateDto memberUpdateDto, MultipartFile profileImg) throws IOException; diff --git a/api-server/src/main/java/com/lastone/apiserver/service/member/MemberServiceImpl.java b/api-server/src/main/java/com/lastone/apiserver/service/member/MemberServiceImpl.java index 6b5b1fbb..af9e83d4 100644 --- a/api-server/src/main/java/com/lastone/apiserver/service/member/MemberServiceImpl.java +++ b/api-server/src/main/java/com/lastone/apiserver/service/member/MemberServiceImpl.java @@ -60,7 +60,7 @@ private boolean isEqualToPrevious(String nickname, String updateNickname) { return nickname.equals(updateNickname); } - private boolean isDuplicateNickname(String updateNickname) { + public boolean isDuplicateNickname(String updateNickname) { Optional findMember = memberRepository.findByNickname(updateNickname); return findMember.isPresent(); } From 060c5b2f1bd17decd02608eeae39561dffd45e71 Mon Sep 17 00:00:00 2001 From: JeonghoPark Date: Mon, 26 Jun 2023 01:16:34 +0900 Subject: [PATCH 07/11] =?UTF-8?q?[LAS-54]=20feat:=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=8B=89=EB=84=A4=EC=9E=84=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=20=EA=B2=80=EC=A6=9D=EC=9D=84=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lastone/apiserver/service/mypage/MyPageService.java | 3 +++ .../apiserver/service/mypage/MyPageServiceImpl.java | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/api-server/src/main/java/com/lastone/apiserver/service/mypage/MyPageService.java b/api-server/src/main/java/com/lastone/apiserver/service/mypage/MyPageService.java index fe0b63cd..eb511fb8 100644 --- a/api-server/src/main/java/com/lastone/apiserver/service/mypage/MyPageService.java +++ b/api-server/src/main/java/com/lastone/apiserver/service/mypage/MyPageService.java @@ -2,11 +2,14 @@ import com.lastone.core.dto.mypage.MyPageDto; import com.lastone.core.dto.mypage.MyPageUpdateDto; +import com.lastone.core.dto.mypage.NicknameCheckDto; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; public interface MyPageService { + NicknameCheckDto isDuplicatedNickname(String nickname); + MyPageDto getMyPage(Long memberId); void updateMyPage(Long memberId, MyPageUpdateDto myPageUpdateDto, MultipartFile profileImg) throws IOException; diff --git a/api-server/src/main/java/com/lastone/apiserver/service/mypage/MyPageServiceImpl.java b/api-server/src/main/java/com/lastone/apiserver/service/mypage/MyPageServiceImpl.java index 3c13d82b..a9e9bf1d 100644 --- a/api-server/src/main/java/com/lastone/apiserver/service/mypage/MyPageServiceImpl.java +++ b/api-server/src/main/java/com/lastone/apiserver/service/mypage/MyPageServiceImpl.java @@ -8,6 +8,7 @@ import com.lastone.core.dto.member.MemberDto; import com.lastone.core.dto.mypage.MyPageDto; import com.lastone.core.dto.mypage.MyPageUpdateDto; +import com.lastone.core.dto.mypage.NicknameCheckDto; import com.lastone.core.dto.sbd.SbdDto; import com.lastone.core.util.mapper.MemberMapper; import lombok.RequiredArgsConstructor; @@ -30,6 +31,12 @@ public class MyPageServiceImpl implements MyPageService { private final MemberMapper memberMapper; + @Override + public NicknameCheckDto isDuplicatedNickname(String nickname) { + boolean result = memberService.isDuplicateNickname(nickname); + return new NicknameCheckDto(result); + } + public MyPageDto getMyPage(Long memberId) { Member member = memberService.findById(memberId); return getMyPageDtoByMember(member); From 0055f4ba3b2f4d4eea79e7fc1b9c723f14e0337d Mon Sep 17 00:00:00 2001 From: JeonghoPark Date: Mon, 26 Jun 2023 01:17:09 +0900 Subject: [PATCH 08/11] =?UTF-8?q?[LAS-54]=20feat:=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=8B=89=EB=84=A4=EC=9E=84=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=20=EA=B2=80=EC=A6=9D=EC=9D=84=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apiserver/controller/MyPageController.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/api-server/src/main/java/com/lastone/apiserver/controller/MyPageController.java b/api-server/src/main/java/com/lastone/apiserver/controller/MyPageController.java index 53281fc1..3b329c35 100644 --- a/api-server/src/main/java/com/lastone/apiserver/controller/MyPageController.java +++ b/api-server/src/main/java/com/lastone/apiserver/controller/MyPageController.java @@ -5,6 +5,7 @@ import com.lastone.core.common.response.SuccessCode; import com.lastone.core.dto.mypage.MyPageDto; import com.lastone.core.dto.mypage.MyPageUpdateDto; +import com.lastone.core.dto.mypage.NicknameCheckDto; import com.lastone.core.security.principal.UserDetailsImpl; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -24,22 +25,28 @@ public class MyPageController { private final MyPageService myPageService; + @GetMapping("/nickname-check") + public ResponseEntity isDuplicatedNickname(String nickname) { + NicknameCheckDto result = myPageService.isDuplicatedNickname(nickname); + return ResponseEntity.ok().body(CommonResponse.success(result, SuccessCode.VALIDATE_NICKNAME.getMessage())); + } + @GetMapping("{memberId}") - public ResponseEntity getMyPageByMemberId(@PathVariable Long memberId) { + public ResponseEntity getMyPageByMemberId(@PathVariable Long memberId) { MyPageDto myPage = myPageService.getMyPage(memberId); return ResponseEntity.ok().body(CommonResponse.success(myPage, SuccessCode.INQUIRE_MYPAGE.getMessage())); } @GetMapping @PreAuthorize("isAuthenticated()") - public ResponseEntity getMyPageByToken(@AuthenticationPrincipal UserDetailsImpl userDetails) { + public ResponseEntity getMyPageByToken(@AuthenticationPrincipal UserDetailsImpl userDetails) { MyPageDto myPagedto = myPageService.getMyPage(userDetails.getId()); return ResponseEntity.ok().body(CommonResponse.success(myPagedto, SuccessCode.INQUIRE_MYPAGE.getMessage())); } @PutMapping @PreAuthorize("isAuthenticated()") - public ResponseEntity updateMyPage(@AuthenticationPrincipal UserDetailsImpl userDetails, + public ResponseEntity updateMyPage(@AuthenticationPrincipal UserDetailsImpl userDetails, @RequestPart(required = false) @Validated MyPageUpdateDto myPage, @RequestPart(required = false) MultipartFile profileImg) throws IOException { myPageService.updateMyPage(userDetails.getId(), myPage, profileImg); From 23f51c9792c18a879a7ec74565757b275f76889b Mon Sep 17 00:00:00 2001 From: JeonghoPark Date: Mon, 26 Jun 2023 01:20:33 +0900 Subject: [PATCH 09/11] =?UTF-8?q?[LAS-54]=20feat:=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=84=B1=EB=B3=84=20=ED=95=84?= =?UTF-8?q?=EC=88=98=20=EC=9E=85=EB=A0=A5=20=EA=B0=92=20=EC=9C=A0=ED=9A=A8?= =?UTF-8?q?=EC=84=B1=20=EA=B2=80=EC=A6=9D=20=EB=A1=9C=EC=A7=81=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/lastone/core/dto/member/MemberUpdateDto.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main/java/com/lastone/core/dto/member/MemberUpdateDto.java b/core/src/main/java/com/lastone/core/dto/member/MemberUpdateDto.java index bc840700..bac0af2b 100644 --- a/core/src/main/java/com/lastone/core/dto/member/MemberUpdateDto.java +++ b/core/src/main/java/com/lastone/core/dto/member/MemberUpdateDto.java @@ -17,6 +17,7 @@ public class MemberUpdateDto { @Size(min = 2, max = 15) private String nickname; + @NotBlank @Pattern(regexp = "^(남성|여성)$", message = "성별은 남성 또는 여성만 가능합니다.") private String gender; From 3d9ebcf651af8001f1ad4ce5fd216a62ad713712 Mon Sep 17 00:00:00 2001 From: JeonghoPark Date: Mon, 26 Jun 2023 01:26:53 +0900 Subject: [PATCH 10/11] =?UTF-8?q?[LAS-54]=20feat:=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=88=98=EC=A0=95=20=EC=8B=9C=20?= =?UTF-8?q?=ED=97=AC=EC=8A=A4=EC=9E=A5=20=ED=95=84=EC=88=98=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=EA=B0=92=20=EC=9C=A0=ED=9A=A8=EC=84=B1=20=EA=B2=80?= =?UTF-8?q?=EC=A6=9D=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/main/java/com/lastone/core/dto/gym/GymDto.java | 1 + .../main/java/com/lastone/core/dto/mypage/MyPageUpdateDto.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/core/src/main/java/com/lastone/core/dto/gym/GymDto.java b/core/src/main/java/com/lastone/core/dto/gym/GymDto.java index b4006d99..90a44cfb 100644 --- a/core/src/main/java/com/lastone/core/dto/gym/GymDto.java +++ b/core/src/main/java/com/lastone/core/dto/gym/GymDto.java @@ -16,6 +16,7 @@ public class GymDto { @NotBlank(message = "헬스장 이름은 필수 입력 값입니다.") private String name; + @NotBlank(message = "헬스장 지역은 필수 입력 값입니다.") private String location; @Coordinate diff --git a/core/src/main/java/com/lastone/core/dto/mypage/MyPageUpdateDto.java b/core/src/main/java/com/lastone/core/dto/mypage/MyPageUpdateDto.java index f8f092eb..02b16a34 100644 --- a/core/src/main/java/com/lastone/core/dto/mypage/MyPageUpdateDto.java +++ b/core/src/main/java/com/lastone/core/dto/mypage/MyPageUpdateDto.java @@ -6,6 +6,7 @@ import lombok.Getter; import lombok.Setter; import javax.validation.Valid; +import javax.validation.constraints.NotNull; import java.util.List; @Getter @@ -13,9 +14,11 @@ public class MyPageUpdateDto { @Valid + @NotNull private MemberUpdateDto member; @Valid + @NotNull private List gyms; @Valid From 8398cb3b8d6202adadb5600966ad50022621464c Mon Sep 17 00:00:00 2001 From: JeonghoPark Date: Mon, 26 Jun 2023 18:31:48 +0900 Subject: [PATCH 11/11] =?UTF-8?q?[LAS-55]=20feat:=20=EB=AA=A8=EC=A7=91?= =?UTF-8?q?=EA=B8=80=20=EC=83=81=EC=84=B8=20=EC=9E=91=EC=84=B1=EC=9E=90=20?= =?UTF-8?q?=EC=84=B1=EB=B3=84=20=EB=B0=98=EC=98=81=20=ED=95=84=EB=93=9C=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/lastone/core/dto/recruitment/RecruitmentDetailDto.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/com/lastone/core/dto/recruitment/RecruitmentDetailDto.java b/core/src/main/java/com/lastone/core/dto/recruitment/RecruitmentDetailDto.java index e2e8ac23..30eadbd2 100644 --- a/core/src/main/java/com/lastone/core/dto/recruitment/RecruitmentDetailDto.java +++ b/core/src/main/java/com/lastone/core/dto/recruitment/RecruitmentDetailDto.java @@ -24,6 +24,7 @@ public class RecruitmentDetailDto { private Long memberId; private String nickname; + private String gender; private String profileUrl; private String workoutPurpose; private SbdDto sbd; @@ -53,6 +54,7 @@ public static RecruitmentDetailDto toDto(Recruitment recruitment) { .memberId(recruitment.getMember().getId()) .nickname(recruitment.getMember().getNickname()) .profileUrl(recruitment.getMember().getProfileUrl()) + .gender(recruitment.getMember().getGender()) .workoutPurpose(recruitment.getMember().getWorkoutPurpose()) .imgUrls(toImgUrls(recruitment.getRecruitmentImgs())) .build();