From e3967de5dc10e9c3540959751ee59d33cb69625a Mon Sep 17 00:00:00 2001 From: shinhn Date: Wed, 2 Nov 2022 20:45:08 +0900 Subject: [PATCH 1/2] =?UTF-8?q?#8=20Refactor:=20=EC=9C=A0=EC=A0=80=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EC=A0=95=EB=B3=B4=20=EB=93=B1=EB=A1=9D=20?= =?UTF-8?q?API=20-=20swagger=20=EC=9A=94=EC=B2=AD=20=EC=98=88=EC=A0=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yogit/server/user/controller/UserController.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/com/yogit/server/user/controller/UserController.java b/server/src/main/java/com/yogit/server/user/controller/UserController.java index 0afac9c..154485d 100644 --- a/server/src/main/java/com/yogit/server/user/controller/UserController.java +++ b/server/src/main/java/com/yogit/server/user/controller/UserController.java @@ -83,7 +83,13 @@ public ApplicationResponse enterUserImage(@ModelAttribute CreateU * @author 강신현 */ @ApiOperation(value = "유저 추가 정보 입력") - @ApiImplicitParam(name = "userId", required = true, dataTypeClass = Long.class, example = "0") + @ApiImplicitParams({ + @ApiImplicitParam(name = "userId", required = true, dataTypeClass = Long.class, example = "1"), + @ApiImplicitParam(name = "latitude", dataTypeClass = Float.class, example = "10.23"), + @ApiImplicitParam(name = "longitude", dataTypeClass = Float.class, example = "10.23"), + @ApiImplicitParam(name = "aboutMe", dataTypeClass = String.class, example = "캠핑 모임에 관심이 많습니다."), + @ApiImplicitParam(name = "city", dataTypeClass = Nationality.class, example = "SEOUL") + }) @PatchMapping("/additional-profile") public ApplicationResponse enterAdditionalProfile(@ModelAttribute AddUserAdditionalProfileReq addUserAdditionalProfileReq){ return userService.enterAdditionalProfile(addUserAdditionalProfileReq); From afbc751373a1ac0205c738c264f3c04a4e5325d7 Mon Sep 17 00:00:00 2001 From: shinhn Date: Sun, 6 Nov 2022 14:15:30 +0900 Subject: [PATCH 2/2] =?UTF-8?q?#24=20refactor:=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=ED=8F=B0=EB=B2=88=ED=98=B8=20=EB=93=B1=EB=A1=9D=20(=ED=95=84?= =?UTF-8?q?=EC=88=98=20=EC=A0=95=EB=B3=B4=20->=20=ED=9A=8C=EC=9B=90?= =?UTF-8?q?=EA=B0=80=EC=9E=85=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/yogit/server/user/controller/UserController.java | 8 +++++--- .../user/dto/request/CreateUserEssentialProfileReq.java | 1 - .../com/yogit/server/user/dto/request/CreateUserReq.java | 2 ++ .../src/main/java/com/yogit/server/user/entity/User.java | 6 +++--- .../com/yogit/server/user/service/UserServiceImpl.java | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/server/src/main/java/com/yogit/server/user/controller/UserController.java b/server/src/main/java/com/yogit/server/user/controller/UserController.java index 154485d..7d7a074 100644 --- a/server/src/main/java/com/yogit/server/user/controller/UserController.java +++ b/server/src/main/java/com/yogit/server/user/controller/UserController.java @@ -37,8 +37,7 @@ public class UserController { @ApiImplicitParam(name = "userName", dataTypeClass = String.class, example = "강신현"), @ApiImplicitParam(name = "userAge", dataTypeClass = int.class, example = "25"), @ApiImplicitParam(name = "gender", dataTypeClass = Gender.class, example = "FEMALE"), - @ApiImplicitParam(name = "nationality", dataTypeClass = Nationality.class, example = "Korea"), - @ApiImplicitParam(name = "phoneNum", dataTypeClass = String.class, example = "01012345678") + @ApiImplicitParam(name = "nationality", dataTypeClass = Nationality.class, example = "Korea") }) @PatchMapping("/essential-profile") public ApplicationResponse enterEssentialProfile(@ModelAttribute CreateUserEssentialProfileReq createUserEssentialProfileReq){ @@ -99,7 +98,10 @@ public ApplicationResponse enterAdditionalProfile(@Mod * 유저 회원가입 (일반) */ @ApiOperation(value = "유저 회원가입", notes = "sms 인증이 완료되어야 회원가입이 가능합니다.") - @ApiImplicitParam(name = "loginId", required = true, dataTypeClass = String.class) + @ApiImplicitParams({ + @ApiImplicitParam(name = "loginId", required = true, dataTypeClass = String.class, example = "kang123"), + @ApiImplicitParam(name = "phoneNum", required = true, dataTypeClass = String.class, example = "01012345678") + }) @PostMapping("/join") public ApplicationResponse createUser(@ModelAttribute CreateUserReq createUserReq){ return userService.createUser(createUserReq); diff --git a/server/src/main/java/com/yogit/server/user/dto/request/CreateUserEssentialProfileReq.java b/server/src/main/java/com/yogit/server/user/dto/request/CreateUserEssentialProfileReq.java index f8c00b5..6a7319e 100644 --- a/server/src/main/java/com/yogit/server/user/dto/request/CreateUserEssentialProfileReq.java +++ b/server/src/main/java/com/yogit/server/user/dto/request/CreateUserEssentialProfileReq.java @@ -19,7 +19,6 @@ public class CreateUserEssentialProfileReq { int userAge; Gender gender; Nationality nationality; - String phoneNum; List languageNames; List languageLevels; diff --git a/server/src/main/java/com/yogit/server/user/dto/request/CreateUserReq.java b/server/src/main/java/com/yogit/server/user/dto/request/CreateUserReq.java index 853c756..40de766 100644 --- a/server/src/main/java/com/yogit/server/user/dto/request/CreateUserReq.java +++ b/server/src/main/java/com/yogit/server/user/dto/request/CreateUserReq.java @@ -11,10 +11,12 @@ public class CreateUserReq { String loginId; + String phoneNum; public static User toEntityUser(CreateUserReq createUserReq){ return User.builder() .loginId(createUserReq.getLoginId()) + .phoneNum(createUserReq.getPhoneNum()) .build(); } } diff --git a/server/src/main/java/com/yogit/server/user/entity/User.java b/server/src/main/java/com/yogit/server/user/entity/User.java index 7449d69..610a886 100644 --- a/server/src/main/java/com/yogit/server/user/entity/User.java +++ b/server/src/main/java/com/yogit/server/user/entity/User.java @@ -74,20 +74,20 @@ public class User extends BaseEntity { private List userImages = new ArrayList<>(); @Builder - public User (String loginId){ + public User (String loginId, String phoneNum){ this.loginId = loginId; + this.phoneNum = phoneNum; } public void addLanguage(Language language){ this.languages.add(language); } - public void changeUserInfo(String userName, Integer userAge, Gender gender, Nationality nationality, String phoneNum){ + public void changeUserInfo(String userName, Integer userAge, Gender gender, Nationality nationality){ if(userName != null) this.name = userName; if(userAge != 0) this.age = userAge; if(gender != null) this.gender = gender; if(nationality != null) this.nationality = nationality; - if(phoneNum != null) this.phoneNum = phoneNum; } public void delUser(){ diff --git a/server/src/main/java/com/yogit/server/user/service/UserServiceImpl.java b/server/src/main/java/com/yogit/server/user/service/UserServiceImpl.java index bd8297f..14b8ba2 100644 --- a/server/src/main/java/com/yogit/server/user/service/UserServiceImpl.java +++ b/server/src/main/java/com/yogit/server/user/service/UserServiceImpl.java @@ -39,7 +39,7 @@ public class UserServiceImpl implements UserService { public ApplicationResponse enterEssentialProfile(CreateUserEssentialProfileReq createUserEssentialProfileReq){ User user = userRepository.findById(createUserEssentialProfileReq.getUserId()).orElseThrow(NotFoundUserException::new); - user.changeUserInfo(createUserEssentialProfileReq.getUserName(), createUserEssentialProfileReq.getUserAge(), createUserEssentialProfileReq.getGender(), createUserEssentialProfileReq.getNationality(), createUserEssentialProfileReq.getPhoneNum()); + user.changeUserInfo(createUserEssentialProfileReq.getUserName(), createUserEssentialProfileReq.getUserAge(), createUserEssentialProfileReq.getGender(), createUserEssentialProfileReq.getNationality()); UserEssentialProfileRes userEssentialProfileRes = UserEssentialProfileRes.create(createUserEssentialProfileReq.getUserId(), createUserEssentialProfileReq.getUserName(), createUserEssentialProfileReq.getUserAge(), createUserEssentialProfileReq.getGender(), createUserEssentialProfileReq.getNationality());