From a1f191b77a4a526adcd7bf89a25d85c78bce84e0 Mon Sep 17 00:00:00 2001 From: shinhn Date: Fri, 24 Mar 2023 22:37:25 +0900 Subject: [PATCH] =?UTF-8?q?#9=20fix=20:=20=EB=AA=A8=EC=9E=84=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A4=EC=8B=9C,=20city=20=EC=83=9D=EC=84=B1=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yogit/server/user/service/UserServiceImpl.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 0a1d12b..6b64c27 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 @@ -105,15 +105,13 @@ public ApplicationResponse enterProfile(CreateUserProfileReq cre user.addAdditionalProfile(createUserProfileReq.getLatitude(), createUserProfileReq.getLongitude(), createUserProfileReq.getAboutMe(), createUserProfileReq.getJob()); // 기존에 존재하는 city인 경우 + City city = new City(); if(cityRepository.existsByCityName(createUserProfileReq.getCityName())){ - City city = cityRepository.findByCityName(createUserProfileReq.getCityName()); + city = cityRepository.findByCityName(createUserProfileReq.getCityName()); city.addUser(user); } else{ // 기존에 존재하지 않는 city인 경우 - City city = City.builder() - .user(user) - .cityName(createUserProfileReq.getCityName()) - .build(); + city.changeCityName(createUserProfileReq.getCityName()); cityRepository.save(city); city.addUser(user); }