-
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.
Browse files
Browse the repository at this point in the history
최근 조회한 모델,모델 추천 API 추가 + swagger 문서 수정
- Loading branch information
Showing
10 changed files
with
156 additions
and
19 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
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: 15 additions & 0 deletions
15
src/main/java/com/backend/soullive_a/dto/response/ModelRecommendResponse.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,15 @@ | ||
package com.backend.soullive_a.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(name = "모델 추천 응답 model") | ||
public record ModelRecommendResponse( | ||
@Schema(name = "imageUrl", example = "https://soullive-bucket.s3.ap-northeast-2.amazonaws.com/heeae_profile.png", description = "모델 이미지 url입니다.") | ||
String imageUrl, | ||
@Schema(name = "name", example = "김희애", description = "모델 이름입니다.") | ||
String name, | ||
@Schema(name = "job", example = "텔런트/영화배우", description = "모델 직업(구분자)입니다.") | ||
String job | ||
) { | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/backend/soullive_a/dto/response/RecentModelResponse.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,19 @@ | ||
package com.backend.soullive_a.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "최근 조회한 모델 model 객체") | ||
public record RecentModelResponse( | ||
@Schema(name = "modelId", example = "1", description = "모델 기본키") | ||
Long modelId, | ||
@Schema(name = "imageUrl", example = "https://soullive-bucket.s3.ap-northeast-2.amazonaws.com/heeae_profile.png", description = "모델 이미지 url입니다.") | ||
String imageUrl, | ||
@Schema(name = "modelName", example = "한지민", description = "모델 이름입니다.") | ||
String modelName, | ||
@Schema(name = "aiRate", example = "3.0", description = "ai 추천 점수입니다.") | ||
Float aiRate, | ||
@Schema(name = "job", example = "배우", description = "직업에 대한 값입니다.") | ||
String job | ||
) { | ||
|
||
} |
10 changes: 9 additions & 1 deletion
10
src/main/java/com/backend/soullive_a/repository/ModelRepository.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,12 +1,20 @@ | ||
package com.backend.soullive_a.repository; | ||
|
||
import com.backend.soullive_a.dto.response.ModelRecommendResponse; | ||
import com.backend.soullive_a.entity.model.Model; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
import org.springframework.data.jpa.repository.Query; | ||
|
||
import java.util.Optional; | ||
|
||
|
||
public interface ModelRepository extends JpaRepository<Model, Long> { | ||
|
||
public Optional<Model> findByModelName(String modelName); | ||
|
||
@Query("select " | ||
+ "new com.backend.soullive_a.dto.response.ModelRecommendResponse(m.imageUrl,m.modelName,m.job) " | ||
+ "From Model m ") | ||
List<ModelRecommendResponse> findAllRecommendModel(); | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/backend/soullive_a/repository/ProductModelRepository.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,8 +1,19 @@ | ||
package com.backend.soullive_a.repository; | ||
|
||
import com.backend.soullive_a.dto.response.RecentModelResponse; | ||
import com.backend.soullive_a.entity.model.ProductModel; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
public interface ProductModelRepository extends JpaRepository<ProductModel, Long> { | ||
|
||
@Query("Select " | ||
+ "new com.backend.soullive_a.dto.response.RecentModelResponse(m.id,m.imageUrl,m.modelName,m.aiRate,m.job) " | ||
+ "From ProductModel p " | ||
+ "Inner Join Model m On p.model.id = m.id " | ||
+ "Where p.product.id = :productId " | ||
+ "ORDER BY p.searchTime DESC") | ||
List<RecentModelResponse> getRecentModels(@Param("productId") Long productId); | ||
} |
8 changes: 6 additions & 2 deletions
8
src/main/java/com/backend/soullive_a/service/ModelService.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,14 @@ | ||
package com.backend.soullive_a.service; | ||
|
||
import com.backend.soullive_a.dto.request.ModelRequest; | ||
import com.backend.soullive_a.dto.response.ModelRecommendResponse; | ||
import com.backend.soullive_a.dto.response.ModelResponse; | ||
import com.backend.soullive_a.dto.response.RecentModelResponse; | ||
import java.util.List; | ||
|
||
public interface ModelService { | ||
public ModelResponse getModel(String modelName ); | ||
public ModelResponse getModel(String modelName, Long productId); | ||
|
||
public List<RecentModelResponse> getRecentModel(Long productId); | ||
|
||
public List<ModelRecommendResponse> getRecommendModel(); | ||
} |
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