From c2d130bb916b64008767de80964baff998b34c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=98=9C=EB=A0=B9?= Date: Fri, 23 Aug 2024 11:35:03 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9D=B4=EB=AF=B8=20=EC=A1=B4=EC=9E=AC?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=ED=94=84=EB=A1=9C=ED=95=84=EC=97=90=20?= =?UTF-8?q?=EC=B0=B8=EC=97=AC=20=EB=AA=BB=ED=95=98=EA=B2=8C=20=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EB=A1=9C=EC=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/shareGroup/service/ShareGroupServiceImpl.java | 5 +++++ .../umc/naoman/global/error/code/ShareGroupErrorCode.java | 3 ++- .../com/umc/naoman/global/security/util/CookieUtils.java | 7 ++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java index 512fe9ca..97ba559e 100644 --- a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java @@ -85,6 +85,11 @@ public ShareGroup joinShareGroup(Long shareGroupId, Long profileId, Member membe throw new BusinessException(ShareGroupErrorCode.INVALID_PROFILE_FOR_GROUP); } + //공유그룹에 해당 profile로 참여한 회원이 이미 있으면 + if (profile.getMember() != null) { + throw new BusinessException(ShareGroupErrorCode.MEMBER_ALREADY_EXIST); + } + //해당 멤버(본인)을 선택한 profile에 세팅, 저장 profile.setInfo(member); profileRepository.save(profile); diff --git a/src/main/java/com/umc/naoman/global/error/code/ShareGroupErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/ShareGroupErrorCode.java index 3ea7d8b2..1b900aa1 100644 --- a/src/main/java/com/umc/naoman/global/error/code/ShareGroupErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/ShareGroupErrorCode.java @@ -18,7 +18,8 @@ public enum ShareGroupErrorCode implements ErrorCode { INVALID_PROFILE_FOR_GROUP(400, "EG007", "해당 프로필은 이 공유 그룹에 속하지 않습니다."), UNAUTHORIZED_DELETE(403, "EG008", "공유 그룹을 삭제할 권한이 없습니다."), - ALREADY_JOINED(400, "EG009", "이미 해당 공유 그룹에 참여하였습니다."); + ALREADY_JOINED(400, "EG009", "이미 해당 공유 그룹에 참여하였습니다."), + MEMBER_ALREADY_EXIST(400, "EG010", "이미 해당 프로필로 공유 그룹에 참여한 멤버가 존재합니다.") ; private final int status; diff --git a/src/main/java/com/umc/naoman/global/security/util/CookieUtils.java b/src/main/java/com/umc/naoman/global/security/util/CookieUtils.java index 37066570..6ebd156d 100644 --- a/src/main/java/com/umc/naoman/global/security/util/CookieUtils.java +++ b/src/main/java/com/umc/naoman/global/security/util/CookieUtils.java @@ -12,15 +12,16 @@ import java.util.Base64; public class CookieUtils { - private static final String COOKIE_DOMAIN = ".naoman.site"; +// private static final String COOKIE_DOMAIN = ".naoman.site"; + private static final String COOKIE_DOMAIN = "localhost"; public static void addCookie(HttpServletResponse response, String name, String value, int maxAge) { ResponseCookie cookie = ResponseCookie.from(name, value) .path("/") .domain(COOKIE_DOMAIN) .maxAge(maxAge) .httpOnly(false) - .secure(true) - .sameSite("None") +// .secure(true) +// .sameSite("None") .build(); response.addHeader(HttpHeaders.SET_COOKIE, cookie.toString());