diff --git a/src/main/java/com/moddy/server/controller/application/ApplicationController.java b/src/main/java/com/moddy/server/controller/application/ApplicationController.java index 032a1843..cf4b05ba 100644 --- a/src/main/java/com/moddy/server/controller/application/ApplicationController.java +++ b/src/main/java/com/moddy/server/controller/application/ApplicationController.java @@ -84,7 +84,7 @@ public SuccessResponse 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 getApplicationDetailInfo( @Parameter(hidden = true) @UserId Long designerId, diff --git a/src/main/java/com/moddy/server/controller/designer/DesignerController.java b/src/main/java/com/moddy/server/controller/designer/DesignerController.java index 02ddaf2a..f1ebea3e 100644 --- a/src/main/java/com/moddy/server/controller/designer/DesignerController.java +++ b/src/main/java/com/moddy/server/controller/designer/DesignerController.java @@ -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; @@ -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; @@ -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))), @@ -52,7 +61,6 @@ SuccessResponse 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))), @@ -68,4 +76,21 @@ public SuccessResponse 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 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); + } + } diff --git a/src/main/java/com/moddy/server/controller/model/dto/response/DesignerInfoOpenChatResponse.java b/src/main/java/com/moddy/server/controller/model/dto/response/DesignerInfoOpenChatResponse.java deleted file mode 100644 index 1235c74d..00000000 --- a/src/main/java/com/moddy/server/controller/model/dto/response/DesignerInfoOpenChatResponse.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.moddy.server.controller.model.dto.response; - -public record DesignerInfoOpenChatResponse( - String imgUrl, - String shopName, - String name, - String introduction -) { -} diff --git a/src/main/java/com/moddy/server/controller/model/dto/response/OpenChatResponse.java b/src/main/java/com/moddy/server/controller/model/dto/response/OpenChatResponse.java index d5d57fe1..072f275f 100644 --- a/src/main/java/com/moddy/server/controller/model/dto/response/OpenChatResponse.java +++ b/src/main/java/com/moddy/server/controller/model/dto/response/OpenChatResponse.java @@ -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 ) { } + diff --git a/src/main/java/com/moddy/server/controller/offer/OfferController.java b/src/main/java/com/moddy/server/controller/offer/OfferController.java index 87b45711..efe76e1d 100644 --- a/src/main/java/com/moddy/server/controller/offer/OfferController.java +++ b/src/main/java/com/moddy/server/controller/offer/OfferController.java @@ -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 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({ diff --git a/src/main/java/com/moddy/server/service/application/HairModelApplicationRetrieveService.java b/src/main/java/com/moddy/server/service/application/HairModelApplicationRetrieveService.java index 791903e5..97e72612 100644 --- a/src/main/java/com/moddy/server/service/application/HairModelApplicationRetrieveService.java +++ b/src/main/java/com/moddy/server/service/application/HairModelApplicationRetrieveService.java @@ -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 findApplicationsByPaging(final int page, final int size) { PageRequest pageRequest = PageRequest.of(page - 1, size, Sort.by(Sort.Direction.DESC, "id")); Page applicationPage = hairModelApplicationJpaRepository.findAll(pageRequest); diff --git a/src/main/java/com/moddy/server/service/designer/DesignerRetrieveService.java b/src/main/java/com/moddy/server/service/designer/DesignerRetrieveService.java index 0d600325..aec3fcab 100644 --- a/src/main/java/com/moddy/server/service/designer/DesignerRetrieveService.java +++ b/src/main/java/com/moddy/server/service/designer/DesignerRetrieveService.java @@ -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()); } diff --git a/src/main/java/com/moddy/server/service/offer/HairServiceOfferRetrieveService.java b/src/main/java/com/moddy/server/service/offer/HairServiceOfferRetrieveService.java index e57a1704..39dff2b7 100644 --- a/src/main/java/com/moddy/server/service/offer/HairServiceOfferRetrieveService.java +++ b/src/main/java/com/moddy/server/service/offer/HairServiceOfferRetrieveService.java @@ -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 offer = hairServiceOfferJpaRepository.findByHairModelApplicationIdAndDesignerId(applicationId, userId);