From 07a52d88b4a69786dfc4901188e098ddbe1d8597 Mon Sep 17 00:00:00 2001 From: JeonHaeseung <414catherine@gmail.com> Date: Sun, 5 May 2024 18:11:23 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[!HOTFIX]=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EB=84=98=EB=B2=84=20=EB=84=98=EA=B2=A8=EC=A3=BC?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/schedule/ScheduleService.java | 18 +++++++++++------- .../dto/request/PostFastApiScheduleDto.java | 2 +- .../schedule/dto/request/PostScheduleDto.java | 17 ++++++++++++----- .../schedule/dto/request/PutScheduleDto.java | 2 +- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java b/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java index 3e2bf16..8357b21 100644 --- a/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java +++ b/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java @@ -53,7 +53,7 @@ public GetScheduleListDto getOneMonthUserSchedule(Long memberId, String date){ .findOneMonthSchedulesByMember_Id(memberId, year, month)); } - /* 사용자가 직접 변경한 스케쥴 */ + /* 사용자가 직접 변경한 스케쥴 RDB에 저장하는 로직 */ @Transactional public GetScheduleListDto changeSchedule(Long memberId, PutScheduleDto putScheduleDto, String date){ // 년도, 월, 일 추출 @@ -106,6 +106,7 @@ public void deleteSchedule(Long id){ @Transactional public GetChatListDto postAiScheduleAccept(Long memberId, Boolean idAccepted, Long chatId, PostScheduleDto postScheduleDto){ Member member = memberRepository.findMemberById(memberId); + Category category = categoryRepository.findCategoryById(postScheduleDto.getCategoryNum()); if(idAccepted){ /* 사용자가 Accept 했으면 스케쥴 생성하기 */ @@ -118,7 +119,7 @@ public GetChatListDto postAiScheduleAccept(Long memberId, Boolean idAccepted, Lo .startTime(postScheduleDto.getStartTime()) .endTime(postScheduleDto.getEndTime()) .member(member) - //.category() //이 연관관계들은 나중에 넣어야 함 + .category(category) .chat(chat) .build(); @@ -139,6 +140,8 @@ public GetChatListDto postAiScheduleAccept(Long memberId, Boolean idAccepted, Lo public Long postNewUserSchedule(Long id, PostScheduleDto postScheduleDto){ log.info("postNewUserSchedule called by "+ id); Member memberEntity = memberRepository.findMemberById(id); + Category category = categoryRepository.findCategoryById(postScheduleDto.getCategoryNum()); + //새로운 채팅 생성 Schedule newSchedule = Schedule.builder() @@ -148,8 +151,8 @@ public Long postNewUserSchedule(Long id, PostScheduleDto postScheduleDto){ .startTime(postScheduleDto.getStartTime()) .endTime(postScheduleDto.getEndTime()) .member(memberEntity) - //.category() //이 연관관계들은 나중에 넣어야 함 - //.chat() + .category(category) + //.chat() //사용자가 직접 생성했으므로 연관관계 없음 .build(); scheduleRepository.save(newSchedule); @@ -160,16 +163,17 @@ public Long postNewUserSchedule(Long id, PostScheduleDto postScheduleDto){ postScheduleDto.getPerson(), postScheduleDto.getStartTime(), postScheduleDto.getEndTime(), - "카테고리 없음", + postScheduleDto.getCategoryNum(), newSchedule.getMember().getId(), newSchedule.getId()); return newSchedule.getId(); // 저장한 Chat 확인용 } + /* 새로운 스케쥴을 VectorDB에 저장하는 API 호출 */ public void postNewAiSchedule(String info, String location, String person, ZonedDateTime startTime, ZonedDateTime endTime, - String category, Long memberId, Long scheduleId){ + Long category, Long memberId, Long scheduleId){ PostFastApiScheduleDto dto = PostFastApiScheduleDto.builder() .info(info) @@ -177,7 +181,7 @@ public void postNewAiSchedule(String info, String location, String person, .person(person) .startTime(startTime) .endTime(endTime) - .category(category) //일단은 null 처리하기 + .category(category) .member_id(memberId) .schedule_id(scheduleId) .build(); diff --git a/src/main/java/Ness/Backend/domain/schedule/dto/request/PostFastApiScheduleDto.java b/src/main/java/Ness/Backend/domain/schedule/dto/request/PostFastApiScheduleDto.java index d751c8c..447da8d 100644 --- a/src/main/java/Ness/Backend/domain/schedule/dto/request/PostFastApiScheduleDto.java +++ b/src/main/java/Ness/Backend/domain/schedule/dto/request/PostFastApiScheduleDto.java @@ -39,5 +39,5 @@ public class PostFastApiScheduleDto { private ZonedDateTime endTime; @JsonProperty("category") - private String category; + private Long category; } diff --git a/src/main/java/Ness/Backend/domain/schedule/dto/request/PostScheduleDto.java b/src/main/java/Ness/Backend/domain/schedule/dto/request/PostScheduleDto.java index 6c562c5..2038649 100644 --- a/src/main/java/Ness/Backend/domain/schedule/dto/request/PostScheduleDto.java +++ b/src/main/java/Ness/Backend/domain/schedule/dto/request/PostScheduleDto.java @@ -14,10 +14,20 @@ @AllArgsConstructor @Builder public class PostScheduleDto { + @Schema(description = "스케쥴의 DB 기본키", example = "1") + @JsonProperty("id") + private Long id; + @Schema(description = "스케쥴 텍스트 내용", example = "AI 공부") @JsonProperty("title") private String info; + @Schema(description = "스케쥴 위치", example = "이화여대 ECC") + private String location; + + @Schema(description = "스케쥴 사람", example = "영희") + private String person; + @Schema(description = "스케쥴 시작 시간", example = "2024-03-08T15:07:27.056103+09:00") @JsonProperty("start") private ZonedDateTime startTime; @@ -26,9 +36,6 @@ public class PostScheduleDto { @JsonProperty("end") private ZonedDateTime endTime; - @Schema(description = "스케쥴 위치", example = "이화여대 ECC") - private String location; - - @Schema(description = "스케쥴 사람", example = "영희") - private String person; + @Schema(description = "스케쥴 카테고리 DB 넘버", example = "0") + private Long categoryNum; } \ No newline at end of file diff --git a/src/main/java/Ness/Backend/domain/schedule/dto/request/PutScheduleDto.java b/src/main/java/Ness/Backend/domain/schedule/dto/request/PutScheduleDto.java index 683182b..8079daf 100644 --- a/src/main/java/Ness/Backend/domain/schedule/dto/request/PutScheduleDto.java +++ b/src/main/java/Ness/Backend/domain/schedule/dto/request/PutScheduleDto.java @@ -37,6 +37,6 @@ public class PutScheduleDto { @JsonProperty("end") private ZonedDateTime endTime; - @Schema(description = "스케쥴 카테고리 DB 넘버", example = "공부") + @Schema(description = "스케쥴 카테고리 DB 넘버", example = "0") private Long categoryNum; } \ No newline at end of file From 6408878b3999970ecc5589af081d7862021a685d Mon Sep 17 00:00:00 2001 From: JeonHaeseung <414catherine@gmail.com> Date: Sun, 5 May 2024 18:15:57 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[!HOTFIX]=20POST=EC=97=90=EB=8A=94=20ID=20?= =?UTF-8?q?=ED=95=84=EC=9A=94=20=EC=97=86=EB=8F=84=EB=A1=9D=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 --- .../java/Ness/Backend/domain/schedule/ScheduleService.java | 1 - .../Backend/domain/schedule/dto/request/PostScheduleDto.java | 4 ---- 2 files changed, 5 deletions(-) diff --git a/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java b/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java index 8357b21..875b51c 100644 --- a/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java +++ b/src/main/java/Ness/Backend/domain/schedule/ScheduleService.java @@ -142,7 +142,6 @@ public Long postNewUserSchedule(Long id, PostScheduleDto postScheduleDto){ Member memberEntity = memberRepository.findMemberById(id); Category category = categoryRepository.findCategoryById(postScheduleDto.getCategoryNum()); - //새로운 채팅 생성 Schedule newSchedule = Schedule.builder() .info(postScheduleDto.getInfo()) diff --git a/src/main/java/Ness/Backend/domain/schedule/dto/request/PostScheduleDto.java b/src/main/java/Ness/Backend/domain/schedule/dto/request/PostScheduleDto.java index 2038649..7ab36b1 100644 --- a/src/main/java/Ness/Backend/domain/schedule/dto/request/PostScheduleDto.java +++ b/src/main/java/Ness/Backend/domain/schedule/dto/request/PostScheduleDto.java @@ -14,10 +14,6 @@ @AllArgsConstructor @Builder public class PostScheduleDto { - @Schema(description = "스케쥴의 DB 기본키", example = "1") - @JsonProperty("id") - private Long id; - @Schema(description = "스케쥴 텍스트 내용", example = "AI 공부") @JsonProperty("title") private String info;