Skip to content

Commit

Permalink
Merge pull request #58 from studio-recoding/!HOTFIX-schedule-create
Browse files Browse the repository at this point in the history
[!HOTFIX] 카테고리 넘버 넘겨주도록 변경
  • Loading branch information
JeonHaeseung authored May 5, 2024
2 parents ce262e8 + 6408878 commit 0fc8152
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
17 changes: 10 additions & 7 deletions src/main/java/Ness/Backend/domain/schedule/ScheduleService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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){
// 년도, 월, 일 추출
Expand Down Expand Up @@ -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 했으면 스케쥴 생성하기 */
Expand All @@ -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();

Expand All @@ -139,6 +140,7 @@ 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()
Expand All @@ -148,8 +150,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);
Expand All @@ -160,24 +162,25 @@ 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)
.location(location)
.person(person)
.startTime(startTime)
.endTime(endTime)
.category(category) //일단은 null 처리하기
.category(category)
.member_id(memberId)
.schedule_id(scheduleId)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ public class PostFastApiScheduleDto {
private ZonedDateTime endTime;

@JsonProperty("category")
private String category;
private Long category;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ public class PostScheduleDto {
@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;
Expand All @@ -26,9 +32,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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public class PutScheduleDto {
@JsonProperty("end")
private ZonedDateTime endTime;

@Schema(description = "스케쥴 카테고리 DB 넘버", example = "공부")
@Schema(description = "스케쥴 카테고리 DB 넘버", example = "0")
private Long categoryNum;
}

0 comments on commit 0fc8152

Please sign in to comment.