Skip to content

Commit

Permalink
#143 [fix] git pull conflict 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
hellozo0 committed Jan 16, 2024
2 parents 26262aa + 4cc10f3 commit 41d6b38
Show file tree
Hide file tree
Showing 34 changed files with 259 additions and 251 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ repositories {
}

dependencies {
// coolsms
implementation group: 'io.awspring.cloud', name: 'spring-cloud-aws-messaging', version: '2.3.1'
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'com.google.code.gson:gson:2.9.0'

//JWT
implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public enum ErrorCode {
INVALID_HAIR_SERVICE_RECORD_TERM_EXCEPTION(HttpStatus.BAD_REQUEST, "유효하지 않은 헤어시술 이력기간을 입력했습니다."),
INVALID_HAIR_STYLE_EXCEPTION(HttpStatus.BAD_REQUEST, "유효하지 않은 헤어스타일을 입력했습니다."),
INVALID_VALUE_TYPE_EXCEPTION(HttpStatus.BAD_REQUEST, "유효하지 않은 타입 값을 입력했습니다."),
INVALID_PHONE_NUMBER_EXCEPTION(HttpStatus.BAD_REQUEST, "유효하지 않은 전화번호를 입력했습니다."),
VALIDATION_REQUEST_MISSING_EXCEPTION(HttpStatus.BAD_REQUEST, "요청값이 유효하지 않습니다."),

// 401
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public enum SuccessCode {
VERIFICATION_CODE_MATCH_SUCCESS(HttpStatus.OK, "전화번호 인증 성공입니다."),
LOGOUT_SUCCESS(HttpStatus.OK, "로그아웃 성공입니다."),
CREATE_MODEL_APPLICATION_SUCCESS(HttpStatus.OK, "모델 지원서 생성 성공입니다."),
USER_WITHDRAW_SUCCESS(HttpStatus.OK, "회원 탈퇴 성공입니다.");
USER_WITHDRAW_SUCCESS(HttpStatus.OK, "회원 탈퇴 성공입니다."),
GET_PRE_SIGNED_URL_SUCCESS(HttpStatus.OK, "제안서 다운로드 url 생성 성공");

private final HttpStatus httpStatus;
private final String message;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/moddy/server/common/util/SmsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
@RequiredArgsConstructor
public class SmsUtil {
private final SmsService smsService;

public boolean sendVerificationCode(String to, String verificationCode) {
public boolean sendVerificationCode(String to, String verificationCode) throws IOException {
return smsService.sendSms(to, verificationCode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,16 @@ private String getCommunicationData(

sb.append(START_LOG);
sb.append(String.format("====> Request: %s %s ({%d}ms)\n====> *Header = {%s}\n", request.getMethod(), request.getRequestURL(), endAt - startAt, getHeaders(request)));
sb.append("=================> content type is ").append(request.getContentType()).append("\n");
if ("POST".equalsIgnoreCase(request.getMethod()) && request.getContentType() != null && request.getContentType().contains(MULTI_PART_FORM_DATA)) {
sb.append("====> Body: ");
sb.append("====> form-data Body: ");
cachingRequest.getParts().stream().map(Part::getName).forEach(n -> {
String keyValue = String.format("%s = %s", n, request.getParameter(n));
sb.append(keyValue).append(", ");
});
sb.append("\n");
} else if ("POST".equalsIgnoreCase(request.getMethod())) {
sb.append(String.format("====> Body: {%s}\n", objectMapper.readTree(cachingRequest.getContentAsByteArray())));
sb.append(String.format("====> application/json Body: {%s}\n", objectMapper.readTree(cachingRequest.getContentAsByteArray())));
}
if (returnValue != null) {
sb.append(String.format("====> Response: {%s}\n", returnValue));
Expand Down
27 changes: 0 additions & 27 deletions src/main/java/com/moddy/server/config/sms/AwsSnsConfig.java

This file was deleted.

19 changes: 11 additions & 8 deletions src/main/java/com/moddy/server/controller/auth/AuthController.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.moddy.server.controller.auth;



import com.moddy.server.common.dto.ErrorResponse;
import com.moddy.server.common.dto.SuccessNonDataResponse;
import com.moddy.server.common.dto.SuccessResponse;
Expand Down Expand Up @@ -31,10 +30,15 @@
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
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.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.Date;
import java.io.IOException;
import java.util.List;

import static com.moddy.server.common.exception.enums.SuccessCode.LOGOUT_SUCCESS;
Expand Down Expand Up @@ -88,7 +92,7 @@ public SuccessResponse<List<RegionResponse>> getRegionList() {
@PostMapping(value = "/signup/designer", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE})
SuccessResponse<UserCreateResponse> createDesigner(
@Parameter(hidden = true) @UserId Long userId,
@RequestPart("profileImg") MultipartFile profileImg,
@RequestPart(value = "profileImg", required = false) MultipartFile profileImg,
@RequestPart("designerInfo") DesignerCreateRequest designerInfo) {
return SuccessResponse.success(SuccessCode.DESIGNER_CREATE_SUCCESS, designerService.createDesigner(userId, designerInfo, profileImg));
}
Expand All @@ -108,15 +112,14 @@ public SuccessResponse<UserCreateResponse> createModel(
return SuccessResponse.success(SuccessCode.MODEL_CREATE_SUCCESS, modelService.createModel(userId, modelCreateRequest));
}

@Operation(summary = "[SMS 기능 미완성] 인증번호 요청 API", description = "인증번호 요청 API입니다.")
@Operation(summary = "인증번호 요청 API", description = "인증번호 요청 API입니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "전화번호 인증 요청 성공입니다."),
@ApiResponse(responseCode = "400", description = "유효하지 않은 카카오 코드를 입력했습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "404", description = "유효하지 않은 값을 입력했습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "400", description = "유효하지 않은 전화번호를 입력했습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@PostMapping("/phoneNumber")
public SuccessNonDataResponse sendVerificationCodeMessageToUser(@RequestBody PhoneNumberRequestDto phoneNumberRequestDto) {
public SuccessNonDataResponse sendVerificationCodeMessageToUser(@RequestBody PhoneNumberRequestDto phoneNumberRequestDto) throws IOException {
authService.sendVerificationCodeMessageToUser(phoneNumberRequestDto.phoneNumber());
return SuccessNonDataResponse.success(SEND_VERIFICATION_CODE_SUCCESS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import com.moddy.server.common.exception.enums.SuccessCode;
import com.moddy.server.config.resolver.user.UserId;
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.service.designer.DesignerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
Expand All @@ -18,7 +20,15 @@
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.*;
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.RestController;

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

@RestController
@RequestMapping("/designer")
Expand Down Expand Up @@ -75,4 +85,19 @@ public SuccessResponse<ApplicationDetailInfoResponse> getApplicationDetailInfo(
return SuccessResponse.success(SuccessCode.MODEL_APPLICATION_DETAil_INFO_SUCCESS, designerService.getApplicationDetail(userId, applicationId));
}

@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("/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()));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.moddy.server.controller.designer.dto.request;

public record OfferImageUrlRequestDto(String offerImageUrl) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.moddy.server.controller.designer.dto.response;

public record DownloadUrlResponseDto(String offerImageUrl) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +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.requestEditor.ListPropertyEditor;
import com.moddy.server.controller.model.dto.request.ModelApplicationRequest;
import com.moddy.server.controller.model.dto.request.ModelHairServiceRequest;
import com.moddy.server.controller.model.dto.response.DetailOfferResponse;
import com.moddy.server.controller.model.dto.response.ModelMainResponse;
import com.moddy.server.controller.model.dto.response.OpenChatResponse;
Expand All @@ -22,9 +20,8 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import org.springframework.web.multipart.MultipartFile;

@RestController
@Tag(name = "ModelController")
Expand Down Expand Up @@ -104,14 +101,11 @@ public SuccessNonDataResponse acceptOffer(
@PostMapping(value = "/application", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE})
public SuccessNonDataResponse submitModelApplication(
@Parameter(hidden = true) @UserId Long userId,
@ModelAttribute ModelApplicationRequest request) {
modelService.postApplication(userId, request);
@RequestPart(value = "modelImgUrl", required = false) MultipartFile modelImgUrl,
@RequestPart(value = "applicationCaptureImgUrl", required = false) MultipartFile applicationCaptureImgUrl,
@RequestPart(value = "applicationInfo") ModelApplicationRequest applicationInfo) {
modelService.postApplication(userId, modelImgUrl, applicationCaptureImgUrl, applicationInfo);
return SuccessNonDataResponse.success(SuccessCode.CREATE_MODEL_APPLICATION_SUCCESS);
}

@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(List.class, "hairServiceRecords", new ListPropertyEditor(ModelHairServiceRequest.class));
}

}
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package com.moddy.server.controller.model.dto.request;

import org.springframework.web.multipart.MultipartFile;
import com.moddy.server.domain.hair_model_application.HairLength;
import java.util.List;

import com.moddy.server.domain.prefer_hair_style.HairStyle;
import io.swagger.v3.oas.annotations.media.Schema;

public record ModelApplicationRequest(
@Schema(description = "모델의 현재 머리 기장 예시입니다.", example ="SHORT")
String hairLength,
HairLength hairLength,
@Schema(description = "PreferHaireStyle의 예시 JSON 배열 포맷입니다.", example ="[\"NORMAL_CUT\", \"ALL_COLOR\"]")
List<String> preferHairStyles,
List<HairStyle> preferHairStyles,
@Schema(description = "모델이 원하는 헤어스타일 예시입니다.", example = "안녕하세요 저는 숱을 많이 친 허쉬컷이 하고 싶어요 근데 머리가 곱슬이라 매직도 같이 해야지 이쁘게 될것 같아요. 그리고 머리가 얇아서 그거 감안하고 해야할것 같습니다.")
String hairDetail,
@Schema(description = "HairServiceRecords 의 예시 JSON 배열 포맷입니다.", example = "[{\"hairService\": \"PERM\", \"hairServiceTerm\": \"UNDER_ONE\"}, {\"hairService\": \"BLACK\", \"hairServiceTerm\": \"ABOVE_TWELVE\"}]")
List<ModelHairServiceRequest> hairServiceRecords,
MultipartFile modelImgUrl,
@Schema(description = "모델의 인스타그램 예시입니다.", example ="hizo0")
String instagramId,
MultipartFile applicationCaptureImgUrl
String instagramId
) {
public List<ModelHairServiceRequest> getHairServiceRecords() {
return hairServiceRecords;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.moddy.server.controller.model.dto.request;

import com.moddy.server.domain.hair_service_record.ServiceRecord;
import com.moddy.server.domain.hair_service_record.ServiceRecordTerm;

public record ModelHairServiceRequest(
String hairService,
String hairServiceTerm
ServiceRecord hairService,
ServiceRecordTerm hairServiceTerm
) {
}

This file was deleted.

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

import com.moddy.server.domain.day_off.DayOfWeek;
import com.moddy.server.domain.user.Gender;

import java.util.List;

public record DesignerInfoResponse(
Expand Down
15 changes: 1 addition & 14 deletions src/main/java/com/moddy/server/domain/day_off/DayOfWeek.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
package com.moddy.server.domain.day_off;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.moddy.server.common.exception.enums.ErrorCode;
import com.moddy.server.common.exception.model.BadRequestException;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

@Getter
@AllArgsConstructor
public enum DayOfWeek {
NOTHING("없음"), MON("월"), TUE("화"), WED("수"), THU("목"), FRI("금"), SAT("토"), SUN("일");
MON("월"), TUE("화"), WED("수"), THU("목"), FRI("금"), SAT("토"), SUN("일");

private final String value;

@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public static DayOfWeek findByDayOfWeek(String dayOfWeek) {
return Stream.of(DayOfWeek.values())
.filter(c -> c.name().equals(dayOfWeek))
.findFirst()
.orElseThrow(() -> new BadRequestException(ErrorCode.INVALID_DAY_OF_WEEK_EXCEPTION));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public interface DesignerJpaRepository extends JpaRepository<Designer, Long> {

@Modifying(clearAutomatically = true)
@Query(value = "insert into Designer (id, hair_shop_address, hair_shop_detail_address, hair_shop_name, instagram_url, naver_place_url, introduction, kakao_open_chat_url) VALUES (:id, :hairShopAddress, :hairShopDetailAddress, :hairShopName, :instagramUrl, :naverPlaceUrl, :introduction, :kakaoOpenChatUrl)", nativeQuery = true)
@Query(value = "insert into designer (id, hair_shop_address, hair_shop_detail_address, hair_shop_name, instagram_url, naver_place_url, introduction, kakao_open_chat_url) VALUES (:id, :hairShopAddress, :hairShopDetailAddress, :hairShopName, :instagramUrl, :naverPlaceUrl, :introduction, :kakaoOpenChatUrl)", nativeQuery = true)
void designerRegister(@Param("id") Long id, @Param("hairShopAddress") String hairShopAddress, @Param("hairShopDetailAddress") String hairShopDetailAddress, @Param("hairShopName") String hairShopName, @Param("instagramUrl") String instagramUrl, @Param("naverPlaceUrl") String naverPlaceUrl, @Param("introduction") String introduction, @Param("kakaoOpenChatUrl") String kakaoOpenChatUrl);

Optional<Designer> findById(Long userId);
Expand Down
Loading

0 comments on commit 41d6b38

Please sign in to comment.