Skip to content

Commit

Permalink
Merge branch 'backend/feature/openai-api-10' into dev_backend
Browse files Browse the repository at this point in the history
  • Loading branch information
yo0oni committed Feb 25, 2024
2 parents ef16dbd + 44a9b9c commit 2579316
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.isp.backend.domain.schedule.dto.ScheduleListResponseDTO;
import com.isp.backend.domain.schedule.dto.ScheduleRequestDTO;
import com.isp.backend.domain.schedule.dto.ScheduleResponseDTO;
import com.isp.backend.domain.schedule.dto.ScheduleSaveRequestDTO;
import com.isp.backend.domain.schedule.entity.Schedule;
import com.isp.backend.domain.schedule.service.ScheduleService;
Expand All @@ -21,13 +22,12 @@ public class ScheduleController {

private final ScheduleService scheduleService;

// @PostMapping("/")
// @ResponseStatus(HttpStatus.OK)
// public ScheduleResponseDTO login(@RequestBody ScheduleRequestDTO scheduleRequestDTO) {
// return new ScheduleResponseDTO(schedule);
// Schedule schedule = scheduleService.create(scheduleRequestDTO.toEntity());
// }
@PostMapping("/")
public ResponseEntity<ScheduleResponseDTO> createSchedule(@RequestBody ScheduleRequestDTO scheduleRequestDTO) {

ScheduleResponseDTO scheduleResponseDTO = scheduleService.createSchedule(scheduleRequestDTO);
return ResponseEntity.ok(scheduleResponseDTO);
}
/**
* 여행 일정 저장 API
*/
Expand All @@ -49,7 +49,6 @@ public ResponseEntity<List<ScheduleListResponseDTO>> getScheduleList(@Authentica
return ResponseEntity.ok(scheduleList);
}


/**
* 여행 일정 상세 조회 API
*/
Expand All @@ -61,7 +60,6 @@ public ResponseEntity<ScheduleSaveRequestDTO> getScheduleDetail(@AuthenticationP
return ResponseEntity.ok(scheduleDetail);
}


/**
* 여행 일정 삭제 API
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.isp.backend.domain.schedule.dto;

import com.isp.backend.domain.country.entity.Country;
import com.isp.backend.domain.schedule.entity.Schedule;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
Expand All @@ -10,8 +12,16 @@
@NoArgsConstructor
@AllArgsConstructor
public class ScheduleRequestDTO {
private String destination;
private Country country;
private String purpose;
private String departureDate;
private String returnDate;
private String startDate;
private String endDate;

public Schedule toEntity() {
return Schedule.builder()
.country(country)
.startDate(startDate)
.endDate(endDate)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.isp.backend.domain.schedule.dto;

import com.isp.backend.domain.schedule.entity.Schedule;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class ScheduleResponseDTO {
private String name;
private String email;

public ScheduleResponseDTO(Schedule schedule) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@
import com.isp.backend.domain.country.repository.CountryRepository;
import com.isp.backend.domain.member.entity.Member;
import com.isp.backend.domain.member.repository.MemberRepository;
import com.isp.backend.domain.scheduleDetail.entity.ScheduleDetail;
import com.isp.backend.domain.scheduleDetail.repository.ScheduleDetailRepository;
import com.isp.backend.domain.schedule.dto.ScheduleListResponseDTO;
import com.isp.backend.domain.schedule.dto.ScheduleRequestDTO;
import com.isp.backend.domain.schedule.dto.ScheduleResponseDTO;
import com.isp.backend.domain.schedule.dto.ScheduleSaveRequestDTO;
import com.isp.backend.domain.schedule.entity.Schedule;
import com.isp.backend.domain.schedule.mapper.ScheduleMapper;
import com.isp.backend.domain.schedule.repository.ScheduleRepository;
import com.isp.backend.domain.scheduleDetail.entity.ScheduleDetail;
import com.isp.backend.domain.scheduleDetail.repository.ScheduleDetailRepository;
import com.isp.backend.global.exception.member.MemberNotFoundException;
import com.isp.backend.global.exception.schedule.CountryNotFoundException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand All @@ -34,6 +38,12 @@ public class ScheduleService {
private final MemberRepository memberRepository ;
private final ScheduleMapper scheduleMapper;

@Transactional
public ScheduleResponseDTO createSchedule(ScheduleRequestDTO scheduleRequestDTO) {
// 프롬프트 생성하고
// schedule 일정 생성하기 openai 써서
return null;
}


/**
Expand Down Expand Up @@ -185,9 +195,4 @@ private void calculateTotalPrice(Schedule schedule) {
.sum();
schedule.setTotalPrice(totalPrice);
}





}

0 comments on commit 2579316

Please sign in to comment.