Skip to content

Commit

Permalink
Merge pull request #241 from TEAM-MODDY/refactor/#240
Browse files Browse the repository at this point in the history
#240 [refactor] 지원서 상세보기 api 모델 가져오기 오류 수정
  • Loading branch information
pkl0912 authored Feb 11, 2024
2 parents b051183 + e70abca commit c60054e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ public SuccessResponse<ApplicationDetailInfoResponse> getApplicationDetailInfo(
@Parameter(hidden = true) @UserId Long designerId,
@PathVariable(value = "applicationId") Long applicationId) {
ApplicationDto applicationDto = hairModelApplicationRetrieveService.getApplicationDetailInfo(applicationId);
ApplicationModelInfoDto modelInfoDto = modelRetrieveService.getApplicationModelInfo(applicationId);
Long modelId = modelRetrieveService.getModelId(applicationId);
ApplicationModelInfoDto modelInfoDto = modelRetrieveService.getApplicationModelInfo(modelId);
ApplicationInfoResponse applicationInfoResponse = new ApplicationInfoResponse(
applicationId,
applicationDto.modelImgUrl(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.moddy.server.common.exception.model.NotFoundException;
import com.moddy.server.controller.auth.dto.response.RegionResponse;
import com.moddy.server.controller.model.dto.ApplicationModelInfoDto;
import com.moddy.server.domain.hair_model_application.HairModelApplication;
import com.moddy.server.domain.hair_model_application.repository.HairModelApplicationJpaRepository;
import com.moddy.server.domain.model.Model;
import com.moddy.server.domain.model.repository.ModelJpaRepository;
import com.moddy.server.domain.prefer_region.PreferRegion;
Expand All @@ -22,6 +24,7 @@
public class ModelRetrieveService {
private final ModelJpaRepository modelJpaRepository;
private final RegionJpaRepository regionJpaRepository;
private final HairModelApplicationJpaRepository hairModelApplicationJpaRepository;
private final PreferRegionJpaRepository preferRegionJpaRepository;

public ApplicationModelInfoDto getApplicationModelInfo(final Long modelId) {
Expand All @@ -48,4 +51,9 @@ public String getModelName(final Long modelId) {
Model model = modelJpaRepository.findById(modelId).orElseThrow(() -> new NotFoundException(ErrorCode.NOT_FOUND_MODEL_INFO));
return model.getName();
}

public Long getModelId(final Long applicationId) {
HairModelApplication application = hairModelApplicationJpaRepository.findById(applicationId).orElseThrow(() -> new NotFoundException(ErrorCode.NOT_FOUND_APPLICATION_EXCEPTION));
return application.getModel().getId();
}
}

0 comments on commit c60054e

Please sign in to comment.