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 512fe9c..97ba559 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 3ea7d8b..1b900aa 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 3706657..6ebd156 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());