From 3070cffd98356e04dea728d80fd6442235aeeada Mon Sep 17 00:00:00 2001 From: pkl0912 Date: Wed, 31 Jan 2024 19:30:46 +0900 Subject: [PATCH 1/6] =?UTF-8?q?#224=20[refactor]=20=EB=94=94=EC=9E=90?= =?UTF-8?q?=EC=9D=B4=EB=84=88=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20des?= =?UTF-8?q?igerRegisterService=20=EB=B3=80=EA=B2=BD,=20builder=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/auth/AuthController.java | 6 +-- .../designer/DesignerRegisterService.java | 45 +++++++++++++++++++ .../service/designer/DesignerService.java | 34 -------------- 3 files changed, 48 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/moddy/server/controller/auth/AuthController.java b/src/main/java/com/moddy/server/controller/auth/AuthController.java index f5a77e26..53ce6f67 100644 --- a/src/main/java/com/moddy/server/controller/auth/AuthController.java +++ b/src/main/java/com/moddy/server/controller/auth/AuthController.java @@ -13,7 +13,7 @@ import com.moddy.server.controller.designer.dto.request.DesignerCreateRequest; import com.moddy.server.controller.designer.dto.response.UserCreateResponse; import com.moddy.server.service.auth.AuthService; -import com.moddy.server.service.designer.DesignerService; +import com.moddy.server.service.designer.DesignerRegisterService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; @@ -48,7 +48,7 @@ public class AuthController { private static final String ORIGIN = "origin"; private final AuthService authService; - private final DesignerService designerService; + private final DesignerRegisterService designerRegisterService; @Operation(summary = "[KAKAO CODE] 로그인 API") @@ -77,7 +77,7 @@ SuccessResponse createDesigner( @Parameter(hidden = true) @UserId Long userId, @RequestPart(value = "profileImg", required = false) MultipartFile profileImg, @Valid @RequestPart("designerInfo") DesignerCreateRequest designerInfo) { - return SuccessResponse.success(SuccessCode.DESIGNER_CREATE_SUCCESS, designerService.createDesigner(userId, designerInfo, profileImg)); + return SuccessResponse.success(SuccessCode.DESIGNER_CREATE_SUCCESS, designerRegisterService.createDesigner(userId, designerInfo, profileImg)); } @Operation(summary = "인증번호 요청 API", description = "인증번호 요청 API입니다.") diff --git a/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java b/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java index 4bd776b1..7549e4f3 100644 --- a/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java +++ b/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java @@ -1,11 +1,29 @@ package com.moddy.server.service.designer; +import com.moddy.server.common.exception.enums.ErrorCode; +import com.moddy.server.common.exception.model.ConflictException; +import com.moddy.server.common.exception.model.NotFoundException; +import com.moddy.server.controller.designer.dto.request.DesignerCreateRequest; +import com.moddy.server.controller.designer.dto.response.UserCreateResponse; +import com.moddy.server.controller.user.dto.UserUpdateDto; +import com.moddy.server.domain.day_off.DayOff; import com.moddy.server.domain.day_off.repository.DayOffJpaRepository; +import com.moddy.server.domain.designer.Designer; +import com.moddy.server.domain.designer.HairShop; +import com.moddy.server.domain.designer.Portfolio; import com.moddy.server.domain.designer.repository.DesignerJpaRepository; +import com.moddy.server.domain.user.Role; import com.moddy.server.domain.user.User; +import com.moddy.server.domain.user.repository.UserRepository; import com.moddy.server.external.s3.S3Service; +import com.moddy.server.service.auth.AuthService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import static com.moddy.server.common.exception.enums.ErrorCode.DESIGNER_NOT_FOUND_EXCEPTION; +import static com.moddy.server.common.exception.enums.ErrorCode.USER_NOT_FOUND_EXCEPTION; @Service @RequiredArgsConstructor @@ -13,7 +31,34 @@ public class DesignerRegisterService { private final DesignerJpaRepository designerJpaRepository; private final DayOffJpaRepository dayOffJpaRepository; private final S3Service s3Service; + private final AuthService authService; + private final UserRepository userRepository; + + @Transactional + public UserCreateResponse createDesigner(Long designerId, DesignerCreateRequest request, MultipartFile profileImg) { + + String profileImgUrl = s3Service.uploadProfileImage(profileImg, Role.HAIR_DESIGNER); + User user = userRepository.findById(designerId).orElseThrow(() -> new NotFoundException(USER_NOT_FOUND_EXCEPTION)); + if (designerJpaRepository.existsById(designerId)) + throw new ConflictException(ErrorCode.ALREADY_EXIST_USER_EXCEPTION); + user.update(request.name(), request.gender(), request.phoneNumber(), request.isMarketingAgree(), profileImgUrl, Role.HAIR_DESIGNER); + HairShop hairShop = new HairShop(request.hairShop().name(), request.hairShop().address(),request.hairShop().detailAddress()); + Portfolio portfolio = new Portfolio(request.portfolio().instagramUrl(),request.portfolio().naverPlaceUrl()); + + designerJpaRepository.designerRegister(user.getId(), hairShop.getAddress(), hairShop.getDetailAddress(), hairShop.getName(), portfolio.getInstagramUrl(), portfolio.getNaverPlaceUrl(), request.introduction(), request.kakaoOpenChatUrl()); + Designer designer = designerJpaRepository.findById(user.getId()).orElseThrow(() -> new NotFoundException(DESIGNER_NOT_FOUND_EXCEPTION)); + request.dayOffs().stream() + .forEach(d -> { + DayOff dayOff = DayOff.builder() + .dayOfWeek(d) + .designer(designer) + .build(); + dayOffJpaRepository.save(dayOff); + + }); + return authService.createUserToken(designer.getId().toString()); + } public void deleteDesignerInfo(final User designer) { dayOffJpaRepository.deleteAllByDesignerId(designer.getId()); s3Service.deleteS3Image(designer.getProfileImgUrl()); diff --git a/src/main/java/com/moddy/server/service/designer/DesignerService.java b/src/main/java/com/moddy/server/service/designer/DesignerService.java index b11ec4a5..f8993095 100644 --- a/src/main/java/com/moddy/server/service/designer/DesignerService.java +++ b/src/main/java/com/moddy/server/service/designer/DesignerService.java @@ -84,40 +84,6 @@ public class DesignerService { private final HairServiceOfferJpaRepository hairServiceOfferJpaRepository; private final SmsUtil smsUtil; - @Transactional - public UserCreateResponse createDesigner(Long userId, DesignerCreateRequest request, MultipartFile profileImg) { - - String profileImgUrl = s3Service.uploadProfileImage(profileImg, Role.HAIR_DESIGNER); - - User user = userRepository.findById(userId).orElseThrow(() -> new NotFoundException(ErrorCode.USER_NOT_FOUND_EXCEPTION)); - if (designerJpaRepository.existsById(userId)) - throw new ConflictException(ErrorCode.ALREADY_EXIST_USER_EXCEPTION); - user.update(request.name(), request.gender(), request.phoneNumber(), request.isMarketingAgree(), profileImgUrl, Role.HAIR_DESIGNER); - - HairShop hairShop = HairShop.builder() - .name(request.hairShop().name()) - .address(request.hairShop().address()) - .detailAddress(request.hairShop().detailAddress()) - .build(); - Portfolio portfolio = Portfolio.builder() - .instagramUrl(request.portfolio().instagramUrl()) - .naverPlaceUrl(request.portfolio().naverPlaceUrl()) - .build(); - designerJpaRepository.designerRegister(user.getId(), hairShop.getAddress(), hairShop.getDetailAddress(), hairShop.getName(), portfolio.getInstagramUrl(), portfolio.getNaverPlaceUrl(), request.introduction(), request.kakaoOpenChatUrl()); - Designer designer = designerJpaRepository.findById(user.getId()).orElseThrow(() -> new NotFoundException(DESIGNER_NOT_FOUND_EXCEPTION)); - request.dayOffs().stream() - .forEach(d -> { - DayOff dayOff = DayOff.builder() - .dayOfWeek(d) - .designer(designer) - .build(); - dayOffJpaRepository.save(dayOff); - - }); - return authService.createUserToken(designer.getId().toString()); - } - - @Transactional public void postOffer(Long userId, Long applicationId, OfferCreateRequest request) throws IOException { Designer designer = designerJpaRepository.findById(userId).orElseThrow(() -> new NotFoundException(DESIGNER_NOT_FOUND_EXCEPTION)); From 7705669e792c1605b3253b041575f018bf9adf62 Mon Sep 17 00:00:00 2001 From: pkl0912 Date: Wed, 31 Jan 2024 19:36:51 +0900 Subject: [PATCH 2/6] =?UTF-8?q?#224=20[refactor]=20=EB=B9=8C=EB=8D=94=20?= =?UTF-8?q?=EC=96=B4=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/moddy/server/domain/designer/HairShop.java | 1 - src/main/java/com/moddy/server/domain/designer/Portfolio.java | 1 - 2 files changed, 2 deletions(-) diff --git a/src/main/java/com/moddy/server/domain/designer/HairShop.java b/src/main/java/com/moddy/server/domain/designer/HairShop.java index 77990485..43f2e868 100644 --- a/src/main/java/com/moddy/server/domain/designer/HairShop.java +++ b/src/main/java/com/moddy/server/domain/designer/HairShop.java @@ -6,7 +6,6 @@ import lombok.*; @Embeddable -@Builder @AllArgsConstructor @NoArgsConstructor @Getter diff --git a/src/main/java/com/moddy/server/domain/designer/Portfolio.java b/src/main/java/com/moddy/server/domain/designer/Portfolio.java index cd6f0585..78d7b37d 100644 --- a/src/main/java/com/moddy/server/domain/designer/Portfolio.java +++ b/src/main/java/com/moddy/server/domain/designer/Portfolio.java @@ -8,7 +8,6 @@ @AllArgsConstructor @NoArgsConstructor @Getter -@Builder @ToString public class Portfolio { @NotNull From ad7d72fec1c3120dbf74d62f8645e8876cb0fc9c Mon Sep 17 00:00:00 2001 From: pkl0912 Date: Wed, 31 Jan 2024 19:44:58 +0900 Subject: [PATCH 3/6] =?UTF-8?q?#224=20[refactor]=20=EC=BB=A8=ED=8A=B8?= =?UTF-8?q?=EB=A1=A4=EB=9F=AC=20userId=20->=20designerId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/moddy/server/controller/auth/AuthController.java | 4 ++-- .../server/service/designer/DesignerRegisterService.java | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/moddy/server/controller/auth/AuthController.java b/src/main/java/com/moddy/server/controller/auth/AuthController.java index 53ce6f67..a85c4b66 100644 --- a/src/main/java/com/moddy/server/controller/auth/AuthController.java +++ b/src/main/java/com/moddy/server/controller/auth/AuthController.java @@ -74,10 +74,10 @@ public SuccessResponse login( @SecurityRequirement(name = "JWT Auth") @PostMapping(value = "/signup/designer", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE}) SuccessResponse createDesigner( - @Parameter(hidden = true) @UserId Long userId, + @Parameter(hidden = true) @UserId Long designerId, @RequestPart(value = "profileImg", required = false) MultipartFile profileImg, @Valid @RequestPart("designerInfo") DesignerCreateRequest designerInfo) { - return SuccessResponse.success(SuccessCode.DESIGNER_CREATE_SUCCESS, designerRegisterService.createDesigner(userId, designerInfo, profileImg)); + return SuccessResponse.success(SuccessCode.DESIGNER_CREATE_SUCCESS, designerRegisterService.createDesigner(designerId, designerInfo, profileImg)); } @Operation(summary = "인증번호 요청 API", description = "인증번호 요청 API입니다.") diff --git a/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java b/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java index 7549e4f3..bddbfaaa 100644 --- a/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java +++ b/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java @@ -5,7 +5,6 @@ import com.moddy.server.common.exception.model.NotFoundException; import com.moddy.server.controller.designer.dto.request.DesignerCreateRequest; import com.moddy.server.controller.designer.dto.response.UserCreateResponse; -import com.moddy.server.controller.user.dto.UserUpdateDto; import com.moddy.server.domain.day_off.DayOff; import com.moddy.server.domain.day_off.repository.DayOffJpaRepository; import com.moddy.server.domain.designer.Designer; From 1b9e84533f9237f58a0995a6355430b43de6fd5c Mon Sep 17 00:00:00 2001 From: pkl0912 Date: Tue, 6 Feb 2024 18:00:39 +0900 Subject: [PATCH 4/6] =?UTF-8?q?#224=20[refactor]=20dayoff=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EB=A9=94=EC=86=8C=EB=93=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/DesignerRegisterService.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java b/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java index bddbfaaa..4f941c43 100644 --- a/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java +++ b/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java @@ -34,7 +34,7 @@ public class DesignerRegisterService { private final UserRepository userRepository; @Transactional - public UserCreateResponse createDesigner(Long designerId, DesignerCreateRequest request, MultipartFile profileImg) { + public UserCreateResponse createDesigner(final Long designerId, final DesignerCreateRequest request, final MultipartFile profileImg) { String profileImgUrl = s3Service.uploadProfileImage(profileImg, Role.HAIR_DESIGNER); @@ -46,7 +46,17 @@ public UserCreateResponse createDesigner(Long designerId, DesignerCreateRequest Portfolio portfolio = new Portfolio(request.portfolio().instagramUrl(),request.portfolio().naverPlaceUrl()); designerJpaRepository.designerRegister(user.getId(), hairShop.getAddress(), hairShop.getDetailAddress(), hairShop.getName(), portfolio.getInstagramUrl(), portfolio.getNaverPlaceUrl(), request.introduction(), request.kakaoOpenChatUrl()); - Designer designer = designerJpaRepository.findById(user.getId()).orElseThrow(() -> new NotFoundException(DESIGNER_NOT_FOUND_EXCEPTION)); + createDesignerDayoffs(designerId,request); + return authService.createUserToken(designerId.toString()); + } + public void deleteDesignerInfo(final User designer) { + dayOffJpaRepository.deleteAllByDesignerId(designer.getId()); + s3Service.deleteS3Image(designer.getProfileImgUrl()); + designerJpaRepository.deleteById(designer.getId()); + } + + private void createDesignerDayoffs(final Long designerId, final DesignerCreateRequest request){ + Designer designer = designerJpaRepository.findById(designerId).orElseThrow(() -> new NotFoundException(DESIGNER_NOT_FOUND_EXCEPTION)); request.dayOffs().stream() .forEach(d -> { DayOff dayOff = DayOff.builder() @@ -56,11 +66,5 @@ public UserCreateResponse createDesigner(Long designerId, DesignerCreateRequest dayOffJpaRepository.save(dayOff); }); - return authService.createUserToken(designer.getId().toString()); - } - public void deleteDesignerInfo(final User designer) { - dayOffJpaRepository.deleteAllByDesignerId(designer.getId()); - s3Service.deleteS3Image(designer.getProfileImgUrl()); - designerJpaRepository.deleteById(designer.getId()); } } From f598b6b615e57bb441c34b3618b08c75a4d63d1e Mon Sep 17 00:00:00 2001 From: pkl0912 Date: Tue, 6 Feb 2024 18:46:46 +0900 Subject: [PATCH 5/6] =?UTF-8?q?#224=20[refactor]=20=EB=94=94=EC=9E=90?= =?UTF-8?q?=EC=9D=B4=EB=84=88=20=EB=A9=94=EC=9D=B8=EB=B7=B0,=20=EB=94=94?= =?UTF-8?q?=EC=9E=90=EC=9D=B4=EB=84=88=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85?= =?UTF-8?q?,=EC=98=A4=ED=94=88=EC=B1=84=ED=8C=85=20=EC=BB=A8=ED=8A=B8?= =?UTF-8?q?=EB=A1=A4=EB=9F=AC=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/ApplicationController.java | 22 ++++++++++++++++++ .../controller/auth/AuthController.java | 14 ----------- .../designer/DesignerController.java | 23 ++++++++++++------- .../controller/model/ModelController.java | 15 ------------ .../controller/offer/OfferController.java | 16 +++++++++++++ 5 files changed, 53 insertions(+), 37 deletions(-) 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 5d1e90b1..28dd7f2d 100644 --- a/src/main/java/com/moddy/server/controller/application/ApplicationController.java +++ b/src/main/java/com/moddy/server/controller/application/ApplicationController.java @@ -2,10 +2,13 @@ import com.moddy.server.common.dto.ErrorResponse; import com.moddy.server.common.dto.SuccessNonDataResponse; +import com.moddy.server.common.dto.SuccessResponse; import com.moddy.server.common.exception.enums.SuccessCode; import com.moddy.server.config.resolver.user.UserId; +import com.moddy.server.controller.designer.dto.response.DesignerMainResponse; import com.moddy.server.controller.model.dto.request.ModelApplicationRequest; import com.moddy.server.service.application.HairModelApplicationRegisterService; +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; @@ -17,7 +20,9 @@ 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.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @@ -27,6 +32,7 @@ public class ApplicationController { private final HairModelApplicationRegisterService hairModelApplicationRegisterService; + private final HairModelApplicationRetrieveService hairModelApplicationRetrieveService; @Tag(name = "ModelController") @Operation(summary = "[JWT] 모델 지원서 작성", description = "모델 지원서 작성 API입니다.") @@ -45,5 +51,21 @@ public SuccessNonDataResponse submitModelApplication( hairModelApplicationRegisterService.postApplication(modelId, modelImgUrl, applicationCaptureImgUrl, applicationInfo); return SuccessNonDataResponse.success(SuccessCode.CREATE_MODEL_APPLICATION_SUCCESS); } + + @Tag(name = "DesignerController") + @Operation(summary = "[JWT] 디자이너 메인 뷰 조회", description = "디자이너 메인 뷰 조회 API입니다.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "디자이너 메인뷰 조회 성공", content = @Content(schema = @Schema(implementation = DesignerMainResponse.class))), + @ApiResponse(responseCode = "401", description = "인증 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse(responseCode = "500", description = "서버 내부 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + }) + @GetMapping(value = "/designer") + @SecurityRequirement(name = "JWT Auth") + public SuccessResponse getDesignerMainInfo( + @Parameter(hidden = true) @UserId Long designerId, + @Parameter(name = "page", description = "페이지 ") @RequestParam(value = "page") int page, + @Parameter(name = "size", description = "페이지 ") @RequestParam(value = "size") int size) { + return SuccessResponse.success(SuccessCode.FIND_DESIGNER_MAIN_INFO_SUCCESS, hairModelApplicationRetrieveService.getDesignerMainInfo(designerId, page, size)); + } } diff --git a/src/main/java/com/moddy/server/controller/auth/AuthController.java b/src/main/java/com/moddy/server/controller/auth/AuthController.java index 4fb926fa..a6c5f2ae 100644 --- a/src/main/java/com/moddy/server/controller/auth/AuthController.java +++ b/src/main/java/com/moddy/server/controller/auth/AuthController.java @@ -69,20 +69,6 @@ public SuccessResponse login( return SuccessResponse.success(SOCIAL_LOGIN_SUCCESS, authService.login(request.getHeader(ORIGIN), kakaoCode)); } - @Operation(summary = "[JWT] 디자이너 회원가입 API", description = "디자이너 회원가입 조회 API입니다.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "디자이너 회원가입 성공", content = @Content(schema = @Schema(implementation = UserCreateResponse.class))), - @ApiResponse(responseCode = "500", description = "서버 내부 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), - }) - @SecurityRequirement(name = "JWT Auth") - @PostMapping(value = "/signup/designer", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE}) - SuccessResponse createDesigner( - @Parameter(hidden = true) @UserId Long designerId, - @RequestPart(value = "profileImg", required = false) MultipartFile profileImg, - @Valid @RequestPart("designerInfo") DesignerCreateRequest designerInfo) { - return SuccessResponse.success(SuccessCode.DESIGNER_CREATE_SUCCESS, designerRegisterService.createDesigner(designerId, designerInfo, profileImg)); - } - @Operation(summary = "인증번호 요청 API", description = "인증번호 요청 API입니다.") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "전화번호 인증 요청 성공입니다."), 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 3a1a4307..bc03c3e1 100644 --- a/src/main/java/com/moddy/server/controller/designer/DesignerController.java +++ b/src/main/java/com/moddy/server/controller/designer/DesignerController.java @@ -5,12 +5,15 @@ import com.moddy.server.common.dto.SuccessResponse; import com.moddy.server.common.exception.enums.SuccessCode; import com.moddy.server.config.resolver.user.UserId; +import com.moddy.server.controller.designer.dto.request.DesignerCreateRequest; import com.moddy.server.controller.designer.dto.request.OfferCreateRequest; import com.moddy.server.controller.designer.dto.request.OfferImageUrlRequestDto; import com.moddy.server.controller.designer.dto.response.ApplicationDetailInfoResponse; import com.moddy.server.controller.designer.dto.response.DesignerMainResponse; import com.moddy.server.controller.designer.dto.response.DownloadUrlResponseDto; +import com.moddy.server.controller.designer.dto.response.UserCreateResponse; import com.moddy.server.service.application.HairModelApplicationRetrieveService; +import com.moddy.server.service.designer.DesignerRegisterService; import com.moddy.server.service.designer.DesignerService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -22,13 +25,16 @@ import io.swagger.v3.oas.annotations.tags.Tag; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; import java.io.IOException; @@ -41,21 +47,22 @@ public class DesignerController { private final DesignerService designerService; + private final DesignerRegisterService designerRegisterService; private final HairModelApplicationRetrieveService hairModelApplicationRetrieveService; - @Operation(summary = "[JWT] 디자이너 메인 뷰 조회", description = "디자이너 메인 뷰 조회 API입니다.") + @Tag(name = "Auth Controller", description = "로그인 및 회원 가입 관련 API 입니다.") + @Operation(summary = "[JWT] 디자이너 회원가입 API", description = "디자이너 회원가입 조회 API입니다.") @ApiResponses({ - @ApiResponse(responseCode = "200", description = "디자이너 메인뷰 조회 성공", content = @Content(schema = @Schema(implementation = DesignerMainResponse.class))), - @ApiResponse(responseCode = "401", description = "인증 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse(responseCode = "200", description = "디자이너 회원가입 성공", content = @Content(schema = @Schema(implementation = UserCreateResponse.class))), @ApiResponse(responseCode = "500", description = "서버 내부 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), }) - @GetMapping @SecurityRequirement(name = "JWT Auth") - public SuccessResponse getDesignerMainInfo( + @PostMapping(value = "/auth/signup/designer", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE}) + SuccessResponse createDesigner( @Parameter(hidden = true) @UserId Long designerId, - @Parameter(name = "page", description = "페이지 ") @RequestParam(value = "page") int page, - @Parameter(name = "size", description = "페이지 ") @RequestParam(value = "size") int size) { - return SuccessResponse.success(SuccessCode.FIND_DESIGNER_MAIN_INFO_SUCCESS, hairModelApplicationRetrieveService.getDesignerMainInfo(designerId, page, size)); + @RequestPart(value = "profileImg", required = false) MultipartFile profileImg, + @Valid @RequestPart("designerInfo") DesignerCreateRequest designerInfo) { + return SuccessResponse.success(SuccessCode.DESIGNER_CREATE_SUCCESS, designerRegisterService.createDesigner(designerId, designerInfo, profileImg)); } @Operation(summary = "[JWT] 제안서 작성하기", description = "제안서 작성하기 API입니다.") diff --git a/src/main/java/com/moddy/server/controller/model/ModelController.java b/src/main/java/com/moddy/server/controller/model/ModelController.java index 90cd5b5a..6aa37499 100644 --- a/src/main/java/com/moddy/server/controller/model/ModelController.java +++ b/src/main/java/com/moddy/server/controller/model/ModelController.java @@ -66,21 +66,6 @@ public SuccessResponse createModel( return SuccessResponse.success(SuccessCode.MODEL_CREATE_SUCCESS, modelRegisterService.createModel(userId, modelCreateRequest)); } - @Tag(name = "ModelController") - @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("/model/{offerId}/agree") - @SecurityRequirement(name = "JWT Auth") - public SuccessResponse getOpenChat( - @Parameter(hidden = true) @UserId Long userId, - @Parameter(name = "offerId", description = "제안서아이디") @PathVariable(value = "offerId") Long offerId) { - return SuccessResponse.success(SuccessCode.OPEN_CHAT_GET_SUCCESS, hairServiceOfferRetrieveService.getOpenChatInfo(userId, offerId)); - } - @Tag(name = "ModelController") @Operation(summary = "[JWT] 모델 지원서 최종 확인 시 유저 정보 조회 API", description = "[모델 뷰] 모델 지원서 최종 확인 시 유저 정보 조회 API 입니다.") @ApiResponses({ 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 5b1711ac..2b7fad49 100644 --- a/src/main/java/com/moddy/server/controller/offer/OfferController.java +++ b/src/main/java/com/moddy/server/controller/offer/OfferController.java @@ -5,6 +5,7 @@ import com.moddy.server.common.dto.SuccessResponse; import com.moddy.server.common.exception.enums.SuccessCode; import com.moddy.server.config.resolver.user.UserId; +import com.moddy.server.controller.model.dto.response.OpenChatResponse; import com.moddy.server.controller.offer.dto.response.ModelMainOfferResponse; import com.moddy.server.controller.offer.response.DetailOfferResponse; import com.moddy.server.service.offer.HairServiceOfferRegisterService; @@ -31,6 +32,21 @@ public class OfferController { private final HairServiceOfferRetrieveService hairServiceOfferRetrieveService; private final HairServiceOfferRegisterService hairServiceOfferRegisterService; + @Tag(name = "ModelController") + @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("/model/{offerId}/agree") + @SecurityRequirement(name = "JWT Auth") + public SuccessResponse getOpenChat( + @Parameter(hidden = true) @UserId Long userId, + @Parameter(name = "offerId", description = "제안서아이디") @PathVariable(value = "offerId") Long offerId) { + return SuccessResponse.success(SuccessCode.OPEN_CHAT_GET_SUCCESS, hairServiceOfferRetrieveService.getOpenChatInfo(userId, offerId)); + } + @Tag(name = "ModelController") @Operation(summary = "[JWT] 디자이너 제안서 승낙하기", description = "디자이너 제안서 승낙하기 API입니다.") @ApiResponses({ From 186ae05470d97e42eaa32eeaf08ffe34a911dcb0 Mon Sep 17 00:00:00 2001 From: pkl0912 Date: Wed, 7 Feb 2024 13:33:56 +0900 Subject: [PATCH 6/6] =?UTF-8?q?#224=20[refactor]=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20import=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moddy/server/controller/designer/DesignerController.java | 2 -- 1 file changed, 2 deletions(-) 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 bc03c3e1..608e2b33 100644 --- a/src/main/java/com/moddy/server/controller/designer/DesignerController.java +++ b/src/main/java/com/moddy/server/controller/designer/DesignerController.java @@ -9,7 +9,6 @@ import com.moddy.server.controller.designer.dto.request.OfferCreateRequest; import com.moddy.server.controller.designer.dto.request.OfferImageUrlRequestDto; import com.moddy.server.controller.designer.dto.response.ApplicationDetailInfoResponse; -import com.moddy.server.controller.designer.dto.response.DesignerMainResponse; import com.moddy.server.controller.designer.dto.response.DownloadUrlResponseDto; import com.moddy.server.controller.designer.dto.response.UserCreateResponse; import com.moddy.server.service.application.HairModelApplicationRetrieveService; @@ -31,7 +30,6 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile;