diff --git a/sql/setup-dev.sql b/sql/setup-dev.sql index a8757c9a..2883203c 100644 --- a/sql/setup-dev.sql +++ b/sql/setup-dev.sql @@ -58,23 +58,23 @@ values (1, LOCALTIME, LOCALTIME, 'user_face_picture_url1', 2), insert ignore into picture_generate_request (id, creator_id, picture_pose_id, requester_id, prompt, prompt_advanced, camera_angle, request_status, shot_coverage, created_at, modified_at) -VALUES (1, null, 4, 2, '생성된요청', 'prompt_advanced_test_1', '위에서 촬영', 'CREATED', '얼굴만 클로즈업', +VALUES (1, null, 4, 2, '생성된요청', 'prompt_advanced_test_1', 'ABOVE', 'CREATED', 'FACE', '2024-05-08 07:00:00', '2024-05-08 07:00:00'), - (2, null, 3, 2, '취소된요청', 'prompt_advanced_test_2', '같은 높이에서 촬영', 'CANCELED', '허리 위로 촬영', + (2, null, 3, 2, '취소된요청', 'prompt_advanced_test_2', 'EYE_LEVEL', 'CANCELED', 'UPPER_BODY', '2024-05-08 13:00:00', '2024-05-08 13:00:00'), - (3, 1, 2, 2, '특정 공급자와 매칭중인요청', 'prompt_advanced_test_3', '아래에서 촬영', 'ASSIGNING', '무릎 위로 촬영', + (3, 1, 2, 2, '특정 공급자와 매칭중인요청', 'prompt_advanced_test_3', 'BELOW', 'ASSIGNING', 'KNEE_UP', '2024-05-29 07:00:00', '2024-05-29 07:00:00'), - (4, 1, 2, 2, '매칭 후 진행중인 요청', 'prompt_advanced_test_4', '아래에서 촬영', 'IN_PROGRESS', '무릎 위로 촬영', + (4, 1, 2, 2, '매칭 후 진행중인 요청', 'prompt_advanced_test_4', 'BELOW', 'IN_PROGRESS', 'KNEE_UP', '2024-05-29 08:00:00', '2024-05-29 08:00:00'), - (5, 1, 2, 2, '매칭 후 진행중인 요청', 'prompt_advanced_test_5', '아래에서 촬영', 'IN_PROGRESS', '무릎 위로 촬영', + (5, 1, 2, 2, '매칭 후 진행중인 요청', 'prompt_advanced_test_5', 'BELOW', 'IN_PROGRESS', 'KNEE_UP', '2024-05-29 09:00:00', '2024-05-29 09:00:00'), - (6, 1, 2, 2, '신고된 요청', 'prompt_advanced_test_6', '아래에서 촬영', 'REPORTED', '무릎 위로 촬영', '2024-05-29 10:00:00', + (6, 1, 2, 2, '신고된 요청', 'prompt_advanced_test_6', 'BELOW', 'REPORTED', 'KNEE_UP', '2024-05-29 10:00:00', '2024-05-29 10:00:00'), - (7, 1, 1, 2, '완료된 요청', 'prompt_advanced_test_7', '위에서 촬영', 'COMPLETED', '전신 촬영', '2024-05-29 10:00:00', + (7, 1, 1, 2, '완료된 요청', 'prompt_advanced_test_7', 'ABOVE', 'COMPLETED', 'FUUL_BODY', '2024-05-29 10:00:00', '2024-05-29 11:00:00'), - (8, 1, 1, 2, '신고된 요청', 'prompt_advanced_test_8', '위에서 촬영', 'REPORTED', '전신 촬영', '2024-05-29 12:00:00', + (8, 1, 1, 2, '신고된 요청', 'prompt_advanced_test_8', 'ABOVE', 'REPORTED', 'ANY', '2024-05-29 12:00:00', '2024-05-29 12:00:00'), - (9, 3, 3, 2, 'prompt_test_9', 'prompt_advanced_test_9', '위에서 촬영', 'MATCH_TO_ADMIN', '전신 촬영', + (9, 3, 3, 2, 'prompt_test_9', 'prompt_advanced_test_9', 'ANY', 'MATCH_TO_ADMIN', 'FACE', '2024-05-29 13:00:00', '2024-05-29 13:00:00'); insert ignore into picture_generate_request_picture_user_face (picture_generate_request_id, user_face_picture_list_id) @@ -141,8 +141,7 @@ values (1, localtime, localtime, '얼굴 완성 사진 url 1', 1, 3, 2), insert ignore into response_example (id, created_at, modified_at, `key`, example_prompt, prompt_only, uploaded_by) values (1, localtime, localtime, '/EXAMPLE/벚꽃벤치여자.png', '벚꽃 벤치 여자', false, 1), - (2, localtime, localtime, '/EXAMPLE/한강잠수부.png', '한강잠수부', false, 1), - (3, localtime, localtime, null, '프롬프트만있음 사진은 없고', true, 1); + (2, localtime, localtime, '/EXAMPLE/한강잠수부.png', '한강잠수부', false, 1); insert ignore into settlement (id, created_at, modified_at, elapsed_minutes, reward, picture_generate_response_id, settlement_status) diff --git a/src/main/java/com/gt/genti/application/service/PictureGenerateRequestService.java b/src/main/java/com/gt/genti/application/service/PictureGenerateRequestService.java index 508830b6..2eec064a 100644 --- a/src/main/java/com/gt/genti/application/service/PictureGenerateRequestService.java +++ b/src/main/java/com/gt/genti/application/service/PictureGenerateRequestService.java @@ -153,6 +153,7 @@ public PictureGenerateRequest createPictureGenerateRequest(Long requesterId, .pgreqSaveRequestDto(pgreqSaveRequestDto) .picturePose(foundPicturePose) .userFacePictureList(uploadedFacePictureList) + .pictureRatio(pgreqSaveRequestDto.getPictureRatio()) .build(); requestMatchService.matchNewRequest(pgr); diff --git a/src/main/java/com/gt/genti/domain/PictureGenerateRequest.java b/src/main/java/com/gt/genti/domain/PictureGenerateRequest.java index 23fa05f1..1503069f 100644 --- a/src/main/java/com/gt/genti/domain/PictureGenerateRequest.java +++ b/src/main/java/com/gt/genti/domain/PictureGenerateRequest.java @@ -8,9 +8,11 @@ import com.gt.genti.domain.common.BaseTimeEntity; import com.gt.genti.domain.enums.CameraAngle; import com.gt.genti.domain.enums.PictureGenerateRequestStatus; +import com.gt.genti.domain.enums.PictureRatio; import com.gt.genti.domain.enums.ShotCoverage; import com.gt.genti.domain.enums.converter.CameraAngleConverter; import com.gt.genti.domain.enums.converter.EnumUtil; +import com.gt.genti.domain.enums.converter.PictureRatioConverter; import com.gt.genti.domain.enums.converter.RequestStatusConverter; import com.gt.genti.domain.enums.converter.ShotCoverageConverter; import com.gt.genti.dto.user.request.PGREQUpdateRequestDto; @@ -84,9 +86,13 @@ public class PictureGenerateRequest extends BaseTimeEntity { @Convert(converter = RequestStatusConverter.class) PictureGenerateRequestStatus pictureGenerateRequestStatus; + @Column(name = "picture_ratio") + @Convert(converter = PictureRatioConverter.class) + PictureRatio pictureRatio; + @Builder public PictureGenerateRequest(User requester, PGREQSaveRequestDto pgreqSaveRequestDto, - PicturePose picturePose, List userFacePictureList, String promptAdvanced) { + PicturePose picturePose, List userFacePictureList, String promptAdvanced, PictureRatio pictureRatio) { this.requester = requester; this.prompt = pgreqSaveRequestDto.getPrompt(); this.promptAdvanced = promptAdvanced; @@ -95,6 +101,7 @@ public PictureGenerateRequest(User requester, PGREQSaveRequestDto pgreqSaveReque this.cameraAngle = pgreqSaveRequestDto.getCameraAngle(); this.shotCoverage = pgreqSaveRequestDto.getShotCoverage(); this.userFacePictureList = userFacePictureList; + this.pictureRatio = pictureRatio; } public void modify(PGREQUpdateRequestDto PGREQUpdateRequestDto, PicturePose picturePose, diff --git a/src/main/java/com/gt/genti/domain/enums/converter/EnumUtil.java b/src/main/java/com/gt/genti/domain/enums/converter/EnumUtil.java index 00b17cec..9b1f744c 100644 --- a/src/main/java/com/gt/genti/domain/enums/converter/EnumUtil.java +++ b/src/main/java/com/gt/genti/domain/enums/converter/EnumUtil.java @@ -6,7 +6,6 @@ import com.gt.genti.domain.enums.ConvertableEnum; import com.gt.genti.error.DefaultErrorCode; -import com.gt.genti.error.DomainErrorCode; import com.gt.genti.error.ExpectedException; import lombok.extern.slf4j.Slf4j; @@ -34,7 +33,7 @@ public static & ConvertableEnum> E stringToEnum(Class enum try { return convertNullToEnum(enumType); } catch (Exception e) { - throw new ExpectedException(DefaultErrorCode.DBToEnumFailed, List.of(enumType.getName(), value, e.getMessage())); + throw new ExpectedException(DefaultErrorCode.DBToEnumFailed, enumType.getName(), value, e.getMessage()); } } @@ -48,7 +47,8 @@ public static & ConvertableEnum> E stringToEnumIgnoreCase(Cla try { return convertNullToEnum(enumType); } catch (Exception e) { - throw new ExpectedException(DefaultErrorCode.DBToEnumFailed, List.of(enumType.getName(), value, e.getMessage())); + throw new ExpectedException(DefaultErrorCode.DBToEnumFailed, + List.of(enumType.getName(), value, e.getMessage())); } } } diff --git a/src/main/java/com/gt/genti/domain/enums/converter/PictureRatioConverter.java b/src/main/java/com/gt/genti/domain/enums/converter/PictureRatioConverter.java new file mode 100644 index 00000000..91e2cb9a --- /dev/null +++ b/src/main/java/com/gt/genti/domain/enums/converter/PictureRatioConverter.java @@ -0,0 +1,14 @@ +package com.gt.genti.domain.enums.converter; + +import com.gt.genti.domain.enums.PictureRatio; + +import jakarta.persistence.Converter; + +@Converter +public class PictureRatioConverter extends DefaultStringAttributeConverter { + + public PictureRatioConverter() { + super(PictureRatio.class); + } + +} diff --git a/src/main/java/com/gt/genti/error/GlobalExceptionHandler.java b/src/main/java/com/gt/genti/error/GlobalExceptionHandler.java index 44121a47..958a1bbc 100644 --- a/src/main/java/com/gt/genti/error/GlobalExceptionHandler.java +++ b/src/main/java/com/gt/genti/error/GlobalExceptionHandler.java @@ -101,18 +101,18 @@ public ResponseEntity> handleValidationExceptions( return error(new ExpectedException(DefaultErrorCode.ValidationError, error)); } - @ExceptionHandler(RuntimeException.class) - protected ResponseEntity> handleUnExpectedException(final RuntimeException exception) { - String error = """ - Class : %s - Cause : %s - Message : %s - StackTrace : %s - """.formatted(exception.getClass(), exception.getCause(), exception.getMessage(), - exception.getStackTrace()); - log.error(error); - return error(new ExpectedException(DefaultErrorCode.UnHandledException, error)); - } + // @ExceptionHandler(RuntimeException.class) + // protected ResponseEntity> handleUnExpectedException(final RuntimeException exception) { + // String error = """ + // Class : %s + // Cause : %s + // Message : %s + // StackTrace : %s + // """.formatted(exception.getClass(), exception.getCause(), exception.getMessage(), + // exception.getStackTrace()); + // log.error(error); + // return error(new ExpectedException(DefaultErrorCode.UnHandledException, error)); + // } @NotNull private static String makeFieldErrorMessage(FieldError fieldError) {