Skip to content

Commit

Permalink
#247 [refactor] 엔드포인트 변경, 지원서캡처이미지url 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
pkl0912 committed Feb 22, 2024
1 parent 335d6a6 commit c20eb12
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public SuccessResponse<DesignerMainResponse> getDesignerMainInfo(
@ApiResponse(responseCode = "404", description = "지원서 아이디가 존재하지 않습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
})
@GetMapping("/designer/{applicationId}")
@GetMapping("/application/{applicationId}")
@SecurityRequirement(name = "JWT Auth")
public SuccessResponse<ApplicationDetailInfoResponse> getApplicationDetailInfo(
@Parameter(hidden = true) @UserId Long designerId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
import com.moddy.server.controller.designer.dto.response.ApplicationDetailInfoResponse;
import com.moddy.server.controller.designer.dto.response.DownloadUrlResponseDto;
import com.moddy.server.controller.designer.dto.response.UserCreateResponse;
import com.moddy.server.controller.model.dto.DesignerInfoOpenChatDto;
import com.moddy.server.controller.model.dto.response.OpenChatResponse;
import com.moddy.server.service.application.HairModelApplicationRetrieveService;
import com.moddy.server.service.designer.DesignerRegisterService;
import com.moddy.server.service.designer.DesignerRetrieveService;
import com.moddy.server.service.designer.DesignerService;
import com.moddy.server.service.offer.HairServiceOfferRetrieveService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
Expand All @@ -22,6 +27,8 @@
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestPart;
Expand All @@ -32,12 +39,14 @@

@RestController
@RequiredArgsConstructor
@Tag(name = "DesignerController")
public class DesignerController {

private final DesignerService designerService;
private final DesignerRegisterService designerRegisterService;
private final DesignerRetrieveService designerRetrieveService;
private final HairModelApplicationRetrieveService hairModelApplicationRetrieveService;

@Tag(name = "Auth Controller", description = "로그인 및 회원 가입 관련 API 입니다.")
@Operation(summary = "[JWT] 디자이너 회원가입 API", description = "디자이너 회원가입 조회 API입니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "디자이너 회원가입 성공", content = @Content(schema = @Schema(implementation = UserCreateResponse.class))),
Expand All @@ -52,7 +61,6 @@ SuccessResponse<UserCreateResponse> createDesigner(
return SuccessResponse.success(SuccessCode.DESIGNER_CREATE_SUCCESS, designerRegisterService.createDesigner(designerId, designerInfo, profileImg));
}

@Tag(name = "DesignerController")
@Operation(summary = "[JWT] 제안서 다운로드 링크", description = "디자이너 제안서 다운로드 링크 불러오는 API")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "모델 지원서 상세 조회 성공", content = @Content(schema = @Schema(implementation = ApplicationDetailInfoResponse.class))),
Expand All @@ -68,4 +76,21 @@ public SuccessResponse<DownloadUrlResponseDto> getOfferImageDownloadUrl(
return SuccessResponse.success(GET_PRE_SIGNED_URL_SUCCESS, designerService.getOfferImageDownloadUrl(userId, offerImageUrlRequestDto.offerImageUrl()));
}

@Operation(summary = "[JWT] 카카오톡 오픈채팅", description = "지원서 캡처 이미지 및 디자이너 정보 조회입니다")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "모델 메인뷰 조회 성공", content = @Content(schema = @Schema(implementation = OpenChatResponse.class))),
@ApiResponse(responseCode = "401", description = "인증 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
})
@GetMapping("/designer/{designerId}")
@SecurityRequirement(name = "JWT Auth")
public SuccessResponse<OpenChatResponse> getOpenChat(
@Parameter(hidden = true) @UserId Long modelId,
@Parameter(name = "designerId", description = "디자이너아이디") @PathVariable(value = "designerId") Long designerId) {
DesignerInfoOpenChatDto openChatDto = designerRetrieveService.getDesignerOpenChatInfo(designerId);
String applicationImgUrl = hairModelApplicationRetrieveService.getApplicationImgUrl(modelId);
OpenChatResponse openChatResponse = new OpenChatResponse(applicationImgUrl,openChatDto);
return SuccessResponse.success(SuccessCode.OPEN_CHAT_GET_SUCCESS,openChatResponse);
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.moddy.server.controller.model.dto.response;

import com.moddy.server.controller.model.dto.DesignerInfoOpenChatDto;

public record OpenChatResponse(
String applicationImgUrl,
String kakaoUrl,
DesignerInfoOpenChatResponse designerInfo
DesignerInfoOpenChatDto designerInfo
) {
}

Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,6 @@ public class OfferController {
private final HairServiceOfferRetrieveService hairServiceOfferRetrieveService;
private final HairServiceOfferRegisterService hairServiceOfferRegisterService;

@Tag(name = "Offer Controller")
@Operation(summary = "[JWT] 카카오톡 오픈채팅", description = "지원서 캡처 이미지 및 디자이너 정보 조회입니다")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "모델 메인뷰 조회 성공", content = @Content(schema = @Schema(implementation = OpenChatResponse.class))),
@ApiResponse(responseCode = "401", description = "인증 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
})
@GetMapping("/designer/kakao/{designerId}")
@SecurityRequirement(name = "JWT Auth")
public SuccessResponse<DesignerInfoOpenChatDto> getOpenChat(
@Parameter(hidden = true) @UserId Long modelId,
@Parameter(name = "designerId", description = "디자이너아이디") @PathVariable(value = "designerId") Long designerId) {
return SuccessResponse.success(SuccessCode.OPEN_CHAT_GET_SUCCESS, hairServiceOfferRetrieveService.getOpenChatInfo(modelId, designerId));
}

@Tag(name = "ModelController")
@Operation(summary = "[JWT] 디자이너 제안서 승낙하기", description = "디자이너 제안서 승낙하기 API입니다.")
@ApiResponses({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ public boolean fetchModelApplyStatus(final Long modelId){
return hairModelApplicationJpaRepository.existsByModelId(modelId);
}

public String getApplicationImgUrl(final Long modelId){
return hairModelApplicationJpaRepository.findByModelId(modelId).get().getModelImgUrl();
}

private Page<HairModelApplication> findApplicationsByPaging(final int page, final int size) {
PageRequest pageRequest = PageRequest.of(page - 1, size, Sort.by(Sort.Direction.DESC, "id"));
Page<HairModelApplication> applicationPage = hairModelApplicationJpaRepository.findAll(pageRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public String getDesignerName(final Long designerId) {
return designer.getName();
}

public DesignerInfoOpenChatDto getDesignerOpenDetail(final Long designerId) {
public DesignerInfoOpenChatDto getDesignerOpenChatInfo(final Long designerId) {
Designer designer = designerJpaRepository.findById(designerId).orElseThrow(() -> new NotFoundException(ErrorCode.DESIGNER_NOT_FOUND_EXCEPTION));
return new DesignerInfoOpenChatDto(designer.getKakaoOpenChatUrl(), designer.getProfileImgUrl(), designer.getHairShop().getName(), designer.getName(), designer.getIntroduction());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ public class HairServiceOfferRetrieveService {
private final HairModelApplicationRetrieveService hairModelApplicationRetrieveService;
private final ModelRetrieveService modelRetrieveService;

public DesignerInfoOpenChatDto getOpenChatInfo(final Long modelId, final Long designerId) {

DesignerInfoOpenChatDto openChatDto = designerRetrieveService.getDesignerOpenDetail(designerId);

return openChatDto;
}

public boolean getIsSendStatus(final Long applicationId, final Long userId) {
Optional<HairServiceOffer> offer = hairServiceOfferJpaRepository.findByHairModelApplicationIdAndDesignerId(applicationId, userId);
Expand Down

0 comments on commit c20eb12

Please sign in to comment.