From 02326ceb37d532ab97f3272d2b5539d35a89c17c Mon Sep 17 00:00:00 2001 From: JeonHaeseung <414catherine@gmail.com> Date: Tue, 25 Jun 2024 12:15:47 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[fix]=20=EC=9D=B4=EB=AA=A8=EC=A7=80=20?= =?UTF-8?q?=EC=9C=A0=EB=8B=88=EC=BD=94=EB=93=9C=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=EB=B0=A9=EC=A7=80=EB=A5=BC=20=EC=9C=84=ED=95=B4=20=EC=97=AC?= =?UTF-8?q?=EA=B0=80=EC=9D=98=20=EC=9D=B4=EB=AA=A8=EC=A7=80=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Ness/Backend/domain/member/MemberService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/Ness/Backend/domain/member/MemberService.java b/src/main/java/Ness/Backend/domain/member/MemberService.java index 79cb774..400b746 100644 --- a/src/main/java/Ness/Backend/domain/member/MemberService.java +++ b/src/main/java/Ness/Backend/domain/member/MemberService.java @@ -71,7 +71,7 @@ public void createMember(String email, String password, String picture, String n //핑크 Category restCategory = Category.builder() .member(member) - .name("\uD83D\uDEDF여가") + .name("✨여가") .color("#FF75C8") .build(); From 14414a60e53c490665740b08a09abdd9e4e905cd Mon Sep 17 00:00:00 2001 From: JeonHaeseung <414catherine@gmail.com> Date: Tue, 25 Jun 2024 12:16:32 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[fix]=20=EC=8A=A4=EC=BC=80=EC=A5=B4?= =?UTF-8?q?=EC=97=90=20=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EC=97=86?= =?UTF-8?q?=EC=9D=84=20=EA=B2=BD=EC=9A=B0=20=EC=98=88=EC=99=B8=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20#118?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/schedule/ScheduleService.java | 42 +++++++++++-------- .../Ness/Backend/global/error/ErrorCode.java | 1 + .../exception/NotFoundCategoryException.java | 16 +++++++ 3 files changed, 41 insertions(+), 18 deletions(-) create mode 100644 src/main/java/Ness/Backend/global/error/exception/NotFoundCategoryException.java diff --git a/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java b/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java index 209c84c..1313937 100644 --- a/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java +++ b/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java @@ -14,6 +14,7 @@ import Ness.Backend.domain.schedule.dto.response.GetScheduleDto; import Ness.Backend.domain.schedule.dto.response.GetScheduleListDto; import Ness.Backend.domain.schedule.entity.Schedule; +import Ness.Backend.global.error.exception.NotFoundCategoryException; import Ness.Backend.global.fastApi.FastApiDeleteScheduleApi; import Ness.Backend.global.fastApi.FastApiPostScheduleApi; import Ness.Backend.global.fastApi.FastApiPutScheduleApi; @@ -137,25 +138,30 @@ public GetChatListDto postAiScheduleAccept(Long memberId, Boolean idAccepted, Lo Member member = memberRepository.findMemberById(memberId); Category category = categoryRepository.findCategoryById(postScheduleDto.getCategoryNum()); + /* 사용자가 Accept 했으면 스케쥴 생성하기 */ if(idAccepted){ - /* 사용자가 Accept 했으면 스케쥴 생성하기 */ - Chat chat = chatRepository.findChatById(chatId); - - Schedule newSchedule = Schedule.builder() - .info(postScheduleDto.getInfo()) - .location(postScheduleDto.getLocation()) - .person(postScheduleDto.getPerson()) - .startTime(postScheduleDto.getStartTime()) - .endTime(postScheduleDto.getEndTime()) - .member(member) - .category(category) - .chat(chat) - .build(); - - scheduleRepository.save(newSchedule); - - chatService.createNewChat("일정을 추가해드렸습니다:)", ChatType.AI, 1, member); - + /* 카테고리 연견관계가 정상적인 경우*/ + if(category != null){ + Chat chat = chatRepository.findChatById(chatId); + + Schedule newSchedule = Schedule.builder() + .info(postScheduleDto.getInfo()) + .location(postScheduleDto.getLocation()) + .person(postScheduleDto.getPerson()) + .startTime(postScheduleDto.getStartTime()) + .endTime(postScheduleDto.getEndTime()) + .member(member) + .category(category) + .chat(chat) + .build(); + + scheduleRepository.save(newSchedule); + + chatService.createNewChat("일정을 추가해드렸습니다:)", ChatType.AI, 1, member); + } + else{ + throw new NotFoundCategoryException(); + } } else { chatService.createNewChat("일정 추가를 취소했습니다.\n더 필요한 것이 있으시면 알려주세요!", ChatType.AI, 1, member); } diff --git a/src/main/java/Ness/Backend/global/error/ErrorCode.java b/src/main/java/Ness/Backend/global/error/ErrorCode.java index 9b86c74..3d4aafa 100644 --- a/src/main/java/Ness/Backend/global/error/ErrorCode.java +++ b/src/main/java/Ness/Backend/global/error/ErrorCode.java @@ -35,6 +35,7 @@ public enum ErrorCode { /* 카테고리 관련 */ INVALID_CATEGORY_NAME(CONFLICT, "CATE001", "해당 카테고리명이 이미 존재합니다. 카테고리명은 중복될 수 없습니다."), INVALID_CATEGORY_DELETE(BAD_REQUEST, "CATE002", "미분류 카테고리는 삭제 불가능합니다."), + NOTFOUND_CATEGORY(BAD_REQUEST, "CATE003", "해당 카테고리가 해당 맴버에게 존재하지 않습니다."), /* 리포트 관련 */ MISMATCH_REPORT_RECOMMEND(BAD_REQUEST, "RPT001", "한 줄 추천이 존재하지 않습니다."); diff --git a/src/main/java/Ness/Backend/global/error/exception/NotFoundCategoryException.java b/src/main/java/Ness/Backend/global/error/exception/NotFoundCategoryException.java new file mode 100644 index 0000000..c65f97f --- /dev/null +++ b/src/main/java/Ness/Backend/global/error/exception/NotFoundCategoryException.java @@ -0,0 +1,16 @@ +package Ness.Backend.global.error.exception; + +import Ness.Backend.global.error.ErrorCode; +import lombok.Getter; +@Getter +public class NotFoundCategoryException extends BaseException { + public NotFoundCategoryException() { + super(ErrorCode.NOTFOUND_CATEGORY, ErrorCode.NOTFOUND_CATEGORY.getMessage()); + } + public NotFoundCategoryException(String message) { + super(ErrorCode.NOTFOUND_CATEGORY, message); + } + public NotFoundCategoryException(ErrorCode errorCode) { + super(errorCode, errorCode.getMessage()); + } +} From 40a687fa089ee3b13460b6552bd836494bb34736 Mon Sep 17 00:00:00 2001 From: JeonHaeseung <414catherine@gmail.com> Date: Tue, 25 Jun 2024 12:43:29 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[fix]=20VectorDB=EC=97=90=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=EB=90=98=EB=8A=94=20=EC=8B=9C=EA=B0=84=EC=9D=84=20?= =?UTF-8?q?=ED=95=9C=EA=B5=AD=20=EC=8B=9C=EA=B0=84=EB=8C=80=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/Ness/Backend/domain/schedule/ScheduleService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java b/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java index 1313937..01e7a8f 100644 --- a/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java +++ b/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java @@ -210,16 +210,18 @@ public void postNewAiSchedule(String info, String location, String person, ZonedDateTime startTime, ZonedDateTime endTime, String category, Long category_id, Long memberId, Long scheduleId){ + // null 값은 전달되서는 안됨 if(endTime == null){ endTime = startTime; } + // 서울 시간대로 VectorDB에 저장 PostFastApiScheduleDto dto = PostFastApiScheduleDto.builder() .info(info) .location(location) .person(person) - .startTime(startTime) - .endTime(endTime) + .startTime(startTime.withZoneSameInstant(ZoneId.of("Asia/Seoul"))) + .endTime(endTime.withZoneSameInstant(ZoneId.of("Asia/Seoul"))) .category(category) .category_id(category_id) .member_id(memberId) From 6c6d5bc513755c526ec66371ca45dbd2aad4abfc Mon Sep 17 00:00:00 2001 From: JeonHaeseung <414catherine@gmail.com> Date: Tue, 25 Jun 2024 13:56:54 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[feat]=20=EC=97=94=ED=8B=B0=ED=8B=B0=20?= =?UTF-8?q?=EB=B0=8F=20DTO=EC=97=90=20=EC=98=A8=EB=B3=B4=EB=94=A9=20?= =?UTF-8?q?=ED=95=84=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../profile/dto/response/GetOnBoardingDto.java | 15 +++++++++++++++ .../profile/dto/response/GetProfileDto.java | 8 +++++++- .../Backend/domain/profile/entity/Profile.java | 10 +++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 src/main/java/Ness/Backend/domain/profile/dto/response/GetOnBoardingDto.java diff --git a/src/main/java/Ness/Backend/domain/profile/dto/response/GetOnBoardingDto.java b/src/main/java/Ness/Backend/domain/profile/dto/response/GetOnBoardingDto.java new file mode 100644 index 0000000..669c061 --- /dev/null +++ b/src/main/java/Ness/Backend/domain/profile/dto/response/GetOnBoardingDto.java @@ -0,0 +1,15 @@ +package Ness.Backend.domain.profile.dto.response; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +public class GetOnBoardingDto { + @Schema(description = "사용자의 온보딩 여부", example = "false") + @JsonProperty("onBoarding") + private boolean onBoarding; +} diff --git a/src/main/java/Ness/Backend/domain/profile/dto/response/GetProfileDto.java b/src/main/java/Ness/Backend/domain/profile/dto/response/GetProfileDto.java index ad1216c..7df0830 100644 --- a/src/main/java/Ness/Backend/domain/profile/dto/response/GetProfileDto.java +++ b/src/main/java/Ness/Backend/domain/profile/dto/response/GetProfileDto.java @@ -37,8 +37,13 @@ public class GetProfileDto { @JsonProperty("email") private String email; + @Schema(description = "사용자의 온보딩 여부", example = "false") + @JsonProperty("onBoarding") + private boolean onBoarding; + @Builder - public GetProfileDto(Long id, String pictureUrl, String nickname, String name, PersonaType persona, boolean isEmailActive, String email){ + public GetProfileDto(Long id, String pictureUrl, String nickname, String name, + PersonaType persona, boolean isEmailActive, String email, boolean onBoarding){ this.id = id; this.pictureUrl = pictureUrl; this.nickname = nickname; @@ -46,5 +51,6 @@ public GetProfileDto(Long id, String pictureUrl, String nickname, String name, P this.persona = persona; this.isEmailActive = isEmailActive; this.email = email; + this.onBoarding = onBoarding; } } diff --git a/src/main/java/Ness/Backend/domain/profile/entity/Profile.java b/src/main/java/Ness/Backend/domain/profile/entity/Profile.java index 271ea2a..c0280f3 100644 --- a/src/main/java/Ness/Backend/domain/profile/entity/Profile.java +++ b/src/main/java/Ness/Backend/domain/profile/entity/Profile.java @@ -25,6 +25,8 @@ public class Profile { private Boolean isEmailActive; + private Boolean onBoarding; + //유저 페르소나를 구분해주는 타입 값 @Enumerated(EnumType.STRING) private PersonaType personaType; @@ -44,17 +46,23 @@ public void updateMailActive(Boolean isEmailActive){ this.isEmailActive = isEmailActive; } + public void updateOnBoarding(Boolean onBoarding){ + this.onBoarding = onBoarding; + } + public void updatePersona(PersonaType personaType){ this.personaType = personaType; } @Builder - public Profile(String pictureUrl, String nickname, String name, Member member, Boolean isEmailActive, PersonaType personaType){ + public Profile(String pictureUrl, String nickname, String name, Member member, + Boolean isEmailActive, PersonaType personaType, Boolean onBoarding){ this.pictureUrl = pictureUrl; this.nickname = nickname; this.name = name; this.member = member; this.isEmailActive = isEmailActive; this.personaType = personaType; + this.onBoarding = onBoarding; } } From 06e5a8cf06eb7d42a02196ad0a1c3630275ca55b Mon Sep 17 00:00:00 2001 From: JeonHaeseung <414catherine@gmail.com> Date: Tue, 25 Jun 2024 13:57:51 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[feat]=20=EC=98=A8=EB=B3=B4=EB=94=A9=20?= =?UTF-8?q?=EC=97=AC=EB=B6=80=20=EA=B0=80=EC=A0=B8=EC=98=AC=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EB=8A=94=20API=20=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Backend/domain/profile/ProfileController.java | 15 +++++++++++++++ .../Backend/domain/profile/ProfileService.java | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/main/java/Ness/Backend/domain/profile/ProfileController.java b/src/main/java/Ness/Backend/domain/profile/ProfileController.java index 0ba68e6..59c190c 100644 --- a/src/main/java/Ness/Backend/domain/profile/ProfileController.java +++ b/src/main/java/Ness/Backend/domain/profile/ProfileController.java @@ -4,6 +4,7 @@ import Ness.Backend.domain.member.entity.Member; import Ness.Backend.domain.profile.dto.request.PatchPersonaDto; import Ness.Backend.domain.profile.dto.request.PutProfileDto; +import Ness.Backend.domain.profile.dto.response.GetOnBoardingDto; import Ness.Backend.domain.profile.dto.response.GetProfileDto; import Ness.Backend.global.auth.AuthUser; import io.swagger.v3.oas.annotations.Operation; @@ -39,4 +40,18 @@ public ResponseEntity patchPersona(@AuthUser Member member, @RequestBody P Long profileId = profileService.updatePersona(member.getId(), patchPersonaDto.getPersona()); return new ResponseEntity<>(profileId, HttpStatusCode.valueOf(200)); } + + @GetMapping("/onboarding") + @Operation(summary = "온보딩 여부 확인 API", description = "온보딩 여부를 알 수 있는 API 입니다.") + public ResponseEntity getOnBoarding(@AuthUser Member member) { + GetOnBoardingDto getOnBoardingDto = profileService.getOnBoarding(member.getId()); + return new ResponseEntity<>(getOnBoardingDto, HttpStatusCode.valueOf(200)); + } + + @PatchMapping("/onboarding") + @Operation(summary = "온보딩 여부 수정 API", description = "온보딩 여부를 수정할 수 있는 API 입니다.") + public ResponseEntity updateOnBoarding(@AuthUser Member member, @RequestParam Boolean isOnBoarded) { + profileService.updateOnBoarding(member.getId(), isOnBoarded); + return new ResponseEntity<>(HttpStatusCode.valueOf(200)); + } } diff --git a/src/main/java/Ness/Backend/domain/profile/ProfileService.java b/src/main/java/Ness/Backend/domain/profile/ProfileService.java index 74390e9..ffa2a3d 100644 --- a/src/main/java/Ness/Backend/domain/profile/ProfileService.java +++ b/src/main/java/Ness/Backend/domain/profile/ProfileService.java @@ -1,6 +1,7 @@ package Ness.Backend.domain.profile; import Ness.Backend.domain.profile.dto.request.PutProfileDto; +import Ness.Backend.domain.profile.dto.response.GetOnBoardingDto; import Ness.Backend.domain.profile.dto.response.GetProfileDto; import Ness.Backend.domain.profile.entity.PersonaType; import Ness.Backend.domain.profile.entity.Profile; @@ -36,6 +37,19 @@ public Long updatePersona(Long memberId, PersonaType personaType) { return profile.getId(); } + public GetOnBoardingDto getOnBoarding(Long memberId){ + Profile profile = profileRepository.findProfileByMember_Id(memberId); + + return GetOnBoardingDto.builder() + .onBoarding(profile.getOnBoarding()) + .build(); + } + + public void updateOnBoarding(Long memberId, boolean isOnBoarded){ + Profile profile = profileRepository.findProfileByMember_Id(memberId); + profile.updateOnBoarding(isOnBoarded); + } + @Transactional(readOnly = true) public GetProfileDto getProfile(Long memberId, String email) { Profile profile = profileRepository.findProfileByMember_Id(memberId); @@ -47,6 +61,7 @@ public GetProfileDto getProfile(Long memberId, String email) { .isEmailActive(profile.getIsEmailActive()) .email(email) .persona(profile.getPersonaType()) + .onBoarding(profile.getOnBoarding()) .build(); return getProfileDto; From 04506bd4317db46c32eef14e9d011d10a6b5edc8 Mon Sep 17 00:00:00 2001 From: JeonHaeseung <414catherine@gmail.com> Date: Tue, 25 Jun 2024 13:58:23 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[feat]=20=EC=B2=98=EC=9D=8C=20=ED=9A=8C?= =?UTF-8?q?=EC=9B=90=EA=B0=80=EC=9E=85=EC=8B=9C=20=EC=9E=90=EB=8F=99?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=98=A8=EB=B3=B4=EB=94=A9=20=EC=97=AC?= =?UTF-8?q?=EB=B6=80=20=EC=84=A4=EC=A0=95=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Backend/domain/auth/oAuth/OAuth2CustomUserService.java | 2 +- src/main/java/Ness/Backend/domain/member/MemberService.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/Ness/Backend/domain/auth/oAuth/OAuth2CustomUserService.java b/src/main/java/Ness/Backend/domain/auth/oAuth/OAuth2CustomUserService.java index 5625a3a..0476ff6 100644 --- a/src/main/java/Ness/Backend/domain/auth/oAuth/OAuth2CustomUserService.java +++ b/src/main/java/Ness/Backend/domain/auth/oAuth/OAuth2CustomUserService.java @@ -82,7 +82,7 @@ public OAuth2User loadUser(OAuth2UserRequest oAuth2UserRequest) throws OAuth2Aut /*이메일로 회원 가입 여부 확인*/ if (!memberRepository.existsByEmail(email) && !Objects.equals(password, DEFAULT_STRING)) { // 이메일 알림 기능은 디폴트로 false - memberService.createMember(email, password, picture, nickname, name, false); + memberService.createMember(email, password, picture, nickname, name, false, false); } member = memberRepository.findMemberByEmail(email); diff --git a/src/main/java/Ness/Backend/domain/member/MemberService.java b/src/main/java/Ness/Backend/domain/member/MemberService.java index 400b746..eb50a64 100644 --- a/src/main/java/Ness/Backend/domain/member/MemberService.java +++ b/src/main/java/Ness/Backend/domain/member/MemberService.java @@ -26,7 +26,8 @@ public void deleteMember(Member member) { memberRepository.save(member); } - public void createMember(String email, String password, String picture, String nickname, String name, Boolean isEmailActive) { + public void createMember(String email, String password, String picture, String nickname, + String name, Boolean isEmailActive, Boolean isOnBoarded) { Member member = Member.builder() .email(email) .password(bCryptPasswordEncoder.encode(password)) //비밀번호는 해싱해서 DB에 저장 @@ -39,8 +40,9 @@ public void createMember(String email, String password, String picture, String n .nickname(nickname) .name(name) .member(member) - .isEmailActive(isEmailActive) + .isEmailActive(isEmailActive) // 디폴트로 false, 온보딩 마치면 true 변환 .personaType(PersonaType.NESS) //디폴트로 NESS를 저장해줌, 나중에 개인 페이지에서 변경 가능 + .onBoarding(isOnBoarded) .build(); profileRepository.save(profile);