-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from studio-recoding/feat-main-api
[🚀feat] [⚠️ !HOTFIX] 한줄 추천 기능 생성 및 JWT 에러 처리시 모든 에러 catch하는 것 수정
- Loading branch information
Showing
9 changed files
with
150 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 14 additions & 1 deletion
15
src/main/java/Ness/Backend/domain/report/ReportRecommendRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
package Ness.Backend.domain.report; | ||
|
||
import Ness.Backend.domain.chat.entity.Chat; | ||
import Ness.Backend.domain.report.entity.ReportRecommend; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.List; | ||
|
||
public interface ReportRecommendRepository extends JpaRepository<ReportRecommend, Long> { | ||
ReportRecommend findReportRecommendByMember_IdAndCreatedDateBetween(Long id, ZonedDateTime startOfDay, ZonedDateTime now); | ||
// 특정 맴버의 오늘 하루 생성된 데이터만 반환 | ||
@Query( value = "SELECT * FROM report_recommend " + | ||
"WHERE member_id = :memberId " + | ||
"AND DATE(created_date) = CURDATE() " + | ||
"ORDER BY created_date ASC", | ||
nativeQuery = true) | ||
ReportRecommend findTodayReportRecommendByMember_Id( | ||
@Param("memberId") Long memberId); | ||
|
||
//ReportRecommend findReportRecommendByMember_IdAndCreatedDateBetween(Long id, ZonedDateTime startOfDay, ZonedDateTime now); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/Ness/Backend/domain/report/dto/request/PostFastApiUserRecommendDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package Ness.Backend.domain.report.dto.request; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.ZonedDateTime; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
public class PostFastApiUserRecommendDto { | ||
@JsonProperty("member_id") | ||
private int member_id; | ||
|
||
@JsonProperty("user_persona") | ||
private String user_persona; | ||
|
||
@JsonProperty("schedule_datetime_start") | ||
@JsonFormat(shape = JsonFormat.Shape.STRING) | ||
private ZonedDateTime schedule_datetime_start; | ||
|
||
@JsonProperty("schedule_datetime_end") | ||
@JsonFormat(shape = JsonFormat.Shape.STRING) | ||
private ZonedDateTime schedule_datetime_end; | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/Ness/Backend/domain/report/dto/response/PostFastApiAiRecommendDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package Ness.Backend.domain.report.dto.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
public class PostFastApiAiRecommendDto { | ||
@JsonProperty("ness") | ||
private String answer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/Ness/Backend/global/fastApi/FastApiRecommendApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package Ness.Backend.global.fastApi; | ||
|
||
|
||
import Ness.Backend.domain.report.dto.request.PostFastApiUserRecommendDto; | ||
import Ness.Backend.domain.report.dto.response.PostFastApiAiRecommendDto; | ||
import org.springframework.cloud.openfeign.FeignClient; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
@FeignClient( | ||
name = "FastApiRecommend", | ||
url = "${spring.cloud.openfeign.client.config.fastapi.url}") | ||
public interface FastApiRecommendApi { | ||
@PostMapping(value = "/recommendation/main") | ||
PostFastApiAiRecommendDto creatFastApiRecommend(PostFastApiUserRecommendDto postFastApiUserRecommendDto); | ||
} |