-
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.
- Loading branch information
Showing
11 changed files
with
151 additions
and
2 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/main/java/com/backend/soullive_a/controller/ModelIntroductionController.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,27 @@ | ||
package com.backend.soullive_a.controller; | ||
|
||
import com.backend.soullive_a.dto.response.ModelIntroductionResponse; | ||
import com.backend.soullive_a.service.ModelIntroductionService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/model/introduction") | ||
public class ModelIntroductionController { | ||
|
||
private final ModelIntroductionService modelIntroductionService; | ||
|
||
/** | ||
* 모델소개 조회 api | ||
* @param modelId | ||
* @return | ||
*/ | ||
@GetMapping("/{modelId}") | ||
public ModelIntroductionResponse getModelInroduction(@PathVariable Long modelId) { | ||
return modelIntroductionService.getModelIntroduction(modelId); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/backend/soullive_a/dto/response/ModelIntroductionResponse.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,16 @@ | ||
package com.backend.soullive_a.dto.response; | ||
|
||
import com.backend.soullive_a.entity.model.introduction.ModelImageKeyword; | ||
import com.backend.soullive_a.entity.model.introduction.ModelRecentAdvertisement; | ||
import com.backend.soullive_a.entity.model.introduction.ModelRecentWork; | ||
import lombok.Builder; | ||
|
||
import java.util.List; | ||
|
||
@Builder | ||
public record ModelIntroductionResponse( | ||
List<ModelImageKeyword> modelImageKeywords, | ||
List<ModelRecentWork> modelRecentWorks, | ||
List<ModelRecentAdvertisement> modelRecentAdvertisements | ||
) { | ||
} |
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
12 changes: 12 additions & 0 deletions
12
src/main/java/com/backend/soullive_a/repository/ModelImageKeywordRepository.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,12 @@ | ||
package com.backend.soullive_a.repository; | ||
|
||
import com.backend.soullive_a.dto.response.ModelImageKeywordResponse; | ||
import com.backend.soullive_a.entity.model.introduction.ModelImageKeyword; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface ModelImageKeywordRepository extends JpaRepository<ModelImageKeyword, Long> { | ||
public List<ModelImageKeyword> findAllById(Long modelId); | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
src/main/java/com/backend/soullive_a/repository/ModelIntroductionRepository.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,12 @@ | ||
package com.backend.soullive_a.repository; | ||
|
||
import com.backend.soullive_a.dto.response.ModelImageKeywordResponse; | ||
import com.backend.soullive_a.entity.model.introduction.ModelIntroduction; | ||
import com.backend.soullive_a.entity.model.introduction.ModelRecentWork; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface ModelIntroductionRepository extends JpaRepository<ModelIntroduction, Long> { | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
src/main/java/com/backend/soullive_a/repository/ModelRecentAdvertisementRepository.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,12 @@ | ||
package com.backend.soullive_a.repository; | ||
|
||
import com.backend.soullive_a.entity.model.introduction.ModelRecentAdvertisement; | ||
import com.backend.soullive_a.entity.model.introduction.ModelRecentWork; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface ModelRecentAdvertisementRepository extends JpaRepository<ModelRecentAdvertisement, Long> { | ||
public List<ModelRecentAdvertisement> findAllById(Long modelId); | ||
} | ||
|
13 changes: 13 additions & 0 deletions
13
src/main/java/com/backend/soullive_a/repository/ModelRecentWorkRepository.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,13 @@ | ||
package com.backend.soullive_a.repository; | ||
|
||
import com.backend.soullive_a.dto.response.ModelImageKeywordResponse; | ||
import com.backend.soullive_a.entity.model.Model; | ||
import com.backend.soullive_a.entity.model.introduction.ModelRecentWork; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface ModelRecentWorkRepository extends JpaRepository<ModelRecentWork, Long> { | ||
public List<ModelRecentWork> findAllById(Long modelId); | ||
} | ||
|
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
10 changes: 10 additions & 0 deletions
10
src/main/java/com/backend/soullive_a/service/ModelIntroductionService.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,10 @@ | ||
package com.backend.soullive_a.service; | ||
|
||
import com.backend.soullive_a.dto.response.ModelIntroductionResponse; | ||
|
||
import java.util.List; | ||
|
||
public interface ModelIntroductionService { | ||
public ModelIntroductionResponse getModelIntroduction(Long modelId); | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/com/backend/soullive_a/service/impl/ModelIntroductionServiceImpl.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,39 @@ | ||
package com.backend.soullive_a.service.impl; | ||
|
||
import com.backend.soullive_a.dto.response.ModelImageKeywordResponse; | ||
import com.backend.soullive_a.dto.response.ModelIntroductionResponse; | ||
import com.backend.soullive_a.entity.model.introduction.ModelRecentAdvertisement; | ||
import com.backend.soullive_a.entity.model.introduction.ModelRecentWork; | ||
import com.backend.soullive_a.repository.ModelImageKeywordRepository; | ||
import com.backend.soullive_a.repository.ModelRecentAdvertisementRepository; | ||
import com.backend.soullive_a.repository.ModelRecentWorkRepository; | ||
import com.backend.soullive_a.service.ModelIntroductionService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ModelIntroductionServiceImpl implements ModelIntroductionService { | ||
|
||
private final ModelImageKeywordRepository modelImageKeywordRepository; | ||
private final ModelRecentWorkRepository modelRecentWorkRepository; | ||
private final ModelRecentAdvertisementRepository modelRecentAdvertisementRepository; | ||
|
||
|
||
/** | ||
* 모델 소개 조회 서비스 로직 | ||
* @param modelId | ||
* @return | ||
*/ | ||
@Override | ||
public ModelIntroductionResponse getModelIntroduction(Long modelId) { | ||
return ModelIntroductionResponse.builder() | ||
.modelImageKeywords(modelImageKeywordRepository.findAllById(modelId)) | ||
.modelRecentWorks(modelRecentWorkRepository.findAllById(modelId)) | ||
.modelRecentAdvertisements(modelRecentAdvertisementRepository.findAllById(modelId)) | ||
.build(); | ||
} | ||
|
||
} |
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