Skip to content

Commit

Permalink
#233 [feat] 지원서 조회 controller 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
KWY0218 committed Feb 14, 2024
1 parent 3930717 commit 457dcd6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.moddy.server.controller.application;

import com.moddy.server.common.dto.ErrorResponse;
import com.moddy.server.common.dto.SuccessResponse;
import com.moddy.server.config.resolver.user.UserId;
import com.moddy.server.controller.designer.dto.response.DownloadUrlResponseDto;
import com.moddy.server.service.application.HairModelApplicationRetrieveService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
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;

import static com.moddy.server.common.exception.enums.SuccessCode.GET_PRE_SIGNED_URL_SUCCESS;

@Tag(name = "Application Controller", description = "지원서 관련 API 입니다.")
@RestController
@RequiredArgsConstructor
@RequestMapping("/application")
public class ApplicationRetrieveController {
private final HairModelApplicationRetrieveService hairModelApplicationRetrieveService;

@Operation(summary = "[JWT] 제안서 다운로드 링크", description = "디자이너 제안서 다운로드 링크 불러오는 API")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "지원서 다운로드 URL 조회 성공"),
@ApiResponse(responseCode = "401", description = "토큰이 만료되었습니다. 다시 로그인 해주세요."),
@ApiResponse(responseCode = "404", description = "해당 지원서는 존재하지 않습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
})
@GetMapping("/{applicationId}/download-url")
@SecurityRequirement(name = "JWT Auth")
public SuccessResponse<DownloadUrlResponseDto> getOfferImageDownloadUrl(
@Parameter(hidden = true) @UserId final Long modelId,
@PathVariable final Long applicationId
) {
return SuccessResponse.success(GET_PRE_SIGNED_URL_SUCCESS, hairModelApplicationRetrieveService.getApplicationCaptureDownloadUrl(applicationId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,4 @@ SuccessResponse<UserCreateResponse> createDesigner(
@Valid @RequestPart("designerInfo") DesignerCreateRequest designerInfo) {
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))),
@ApiResponse(responseCode = "404", description = "해당 디자이너는 존재하지 않습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
})
@PostMapping("/designer/offer/download-url")
@SecurityRequirement(name = "JWT Auth")
public SuccessResponse<DownloadUrlResponseDto> getOfferImageDownloadUrl(
@Parameter(hidden = true) @UserId Long userId,
@RequestBody OfferImageUrlRequestDto offerImageUrlRequestDto
) {
return SuccessResponse.success(GET_PRE_SIGNED_URL_SUCCESS, designerService.getOfferImageDownloadUrl(userId, offerImageUrlRequestDto.offerImageUrl()));
}

}

0 comments on commit 457dcd6

Please sign in to comment.