-
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
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
src/main/java/com/backend/soullive_a/dto/request/ModelRequest.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,4 @@ | ||
package com.backend.soullive_a.dto.request; | ||
|
||
public record ModelRequest(Long modelId) { | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/backend/soullive_a/dto/response/ModelResponse.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,18 @@ | ||
package com.backend.soullive_a.dto.response; | ||
|
||
import com.backend.soullive_a.entity.ModelIntroduction; | ||
import lombok.Builder; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Builder | ||
public record ModelResponse( | ||
Long modelId, | ||
String modelName, | ||
LocalDateTime birth, | ||
String job, | ||
String info, | ||
String agency, | ||
Float aiRate | ||
|
||
) {} |
8 changes: 8 additions & 0 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.backend.soullive_a.service; | ||
|
||
import com.backend.soullive_a.dto.request.ModelRequest; | ||
import com.backend.soullive_a.dto.response.ModelResponse; | ||
|
||
public interface ModelService { | ||
public ModelResponse getModel(ModelRequest request); | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/com/backend/soullive_a/service/impl/ModelServiceImpl.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,33 @@ | ||
package com.backend.soullive_a.service.impl; | ||
|
||
import com.backend.soullive_a.dto.request.ModelRequest; | ||
import com.backend.soullive_a.dto.response.ModelResponse; | ||
import com.backend.soullive_a.entity.Model; | ||
import com.backend.soullive_a.repository.ModelRepository; | ||
import com.backend.soullive_a.service.ModelService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ModelServiceImpl implements ModelService { | ||
|
||
private final ModelRepository modelRepository; | ||
|
||
@Override | ||
public ModelResponse getModel(ModelRequest request) { | ||
Model model = modelRepository.findById(request.modelId()) | ||
.orElseThrow(() -> new RuntimeException("존재하지 않는 아이디")); | ||
|
||
return ModelResponse.builder() | ||
.modelId(model.getId()) | ||
.modelName(model.getModelName()) | ||
.birth(model.getBirth()) | ||
.job(model.getJob()) | ||
.info(model.getInfo()) | ||
.agency(model.getAgency()) | ||
.aiRate(model.getAiRate()) | ||
.build(); | ||
} | ||
|
||
} |