Skip to content

Commit

Permalink
#24 feat: 유저 필수 정보 등록 API - 전화번호 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
shinhn committed Oct 31, 2022
1 parent e2a409e commit 186b834
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class CreateUserEssentialProfileReq {
int userAge;
Gender gender;
Nationality nationality;
String phoneNum;

List<String> languageNames;
List<String> languageLevels;
Expand Down
9 changes: 7 additions & 2 deletions server/src/main/java/com/yogit/server/user/entity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class User extends BaseEntity {

private Integer age;
private float memberTemp;
private String phone;
private String phoneNum;

@Enumerated(EnumType.STRING)
private UserStatus userStatus;
Expand Down Expand Up @@ -82,11 +82,12 @@ public void addLanguage(Language language){
this.languages.add(language);
}

public void changeUserInfo(String userName, Integer userAge, Gender gender, Nationality nationality){
public void changeUserInfo(String userName, Integer userAge, Gender gender, Nationality nationality, String phoneNum){
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(){
Expand Down Expand Up @@ -116,4 +117,8 @@ public void addAdditionalProfile(float latitude, float longitude, String aboutMe
public void addCity(City city){
this.city = city;
}

public void addPhoneNum(String phoneNum){
this.phoneNum = phoneNum;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class UserServiceImpl implements UserService {
public ApplicationResponse<UserEssentialProfileRes> enterEssentialProfile(CreateUserEssentialProfileReq createUserEssentialProfileReq){

User user = userRepository.findById(createUserEssentialProfileReq.getUserId()).orElseThrow(NotFoundUserException::new);
user.changeUserInfo(createUserEssentialProfileReq.getUserName(), createUserEssentialProfileReq.getUserAge(), createUserEssentialProfileReq.getGender(), createUserEssentialProfileReq.getNationality());
user.changeUserInfo(createUserEssentialProfileReq.getUserName(), createUserEssentialProfileReq.getUserAge(), createUserEssentialProfileReq.getGender(), createUserEssentialProfileReq.getNationality(), createUserEssentialProfileReq.getPhoneNum());

UserEssentialProfileRes userEssentialProfileRes = UserEssentialProfileRes.create(createUserEssentialProfileReq.getUserId(), createUserEssentialProfileReq.getUserName(), createUserEssentialProfileReq.getUserAge(), createUserEssentialProfileReq.getGender(), createUserEssentialProfileReq.getNationality());

Expand Down

0 comments on commit 186b834

Please sign in to comment.