From 0dd26273c75f3cecd7d19a5c2e7b03c72c9e9fb8 Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Mon, 15 Jul 2024 02:02:06 +0900 Subject: [PATCH 01/16] =?UTF-8?q?Fix:=20#26=20=ED=86=A0=ED=81=B0=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=EC=97=90=20email=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- genti-auth/build.gradle | 3 +++ genti-auth/src/main/java/com/gt/genti/jwt/TokenResponse.java | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/genti-auth/build.gradle b/genti-auth/build.gradle index df15a05f..0d37c859 100644 --- a/genti-auth/build.gradle +++ b/genti-auth/build.gradle @@ -26,6 +26,9 @@ dependencies { // testRuntimeOnly 'com.h2database:h2' runtimeOnly 'com.h2database:h2' + // swagger + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' + implementation project(":genti-common") implementation project(":genti-domain") } diff --git a/genti-auth/src/main/java/com/gt/genti/jwt/TokenResponse.java b/genti-auth/src/main/java/com/gt/genti/jwt/TokenResponse.java index f6ea1900..08fdc2b0 100644 --- a/genti-auth/src/main/java/com/gt/genti/jwt/TokenResponse.java +++ b/genti-auth/src/main/java/com/gt/genti/jwt/TokenResponse.java @@ -2,8 +2,13 @@ import com.gt.genti.constants.JWTConstants; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(name = "Genti 토큰 응답 Dto") public record TokenResponse( + @Schema(description ="액세스 토큰", example = "defaef.32faeE@.szfes!") String accessToken, + @Schema(description ="리프레시 토큰", example = "defaef.32faeE@.szfes!") String refreshToken ) { public static TokenResponse of(String accessToken, String refreshToken) { From 781202591533b5c918551688da8d1704ccb4d926 Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Mon, 15 Jul 2024 22:57:53 +0900 Subject: [PATCH 02/16] =?UTF-8?q?Fix:=20#42=20swagger=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20api=EB=AA=A8=EB=93=88=EC=97=90=EB=A7=8C=20=EC=9E=88?= =?UTF-8?q?=EB=8D=98=EA=B1=B8=20=EC=9E=84=EC=8B=9C=EB=A1=9C=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=EC=A0=9D=ED=8A=B8=20=EC=A0=84=EC=B2=B4=EB=A1=9C=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 5 +++++ genti-api/build.gradle | 3 --- genti-auth/build.gradle | 3 --- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 1a053101..2b63f213 100644 --- a/build.gradle +++ b/build.gradle @@ -36,6 +36,11 @@ subprojects { // redis 사용간 localdatetime json 직렬화 위해 implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.1' + + // swagger( auth, external dto가 문서화되지 않아서 임시로 프로젝트 전체에 추가 + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' + + // lombok compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' diff --git a/genti-api/build.gradle b/genti-api/build.gradle index 1047b2e9..b179c947 100644 --- a/genti-api/build.gradle +++ b/genti-api/build.gradle @@ -25,9 +25,6 @@ dependencies { // testRuntimeOnly 'com.h2database:h2' runtimeOnly 'com.h2database:h2' - // swagger - implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' - implementation project(":genti-domain") implementation project(":genti-external") implementation project(":genti-common") diff --git a/genti-auth/build.gradle b/genti-auth/build.gradle index 0d37c859..df15a05f 100644 --- a/genti-auth/build.gradle +++ b/genti-auth/build.gradle @@ -26,9 +26,6 @@ dependencies { // testRuntimeOnly 'com.h2database:h2' runtimeOnly 'com.h2database:h2' - // swagger - implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' - implementation project(":genti-common") implementation project(":genti-domain") } From 3c69bac1af035ffd17f6053faa4913c1479892fa Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Mon, 15 Jul 2024 23:05:24 +0900 Subject: [PATCH 03/16] =?UTF-8?q?Fix:=20#43=20dto=EC=97=90=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EB=AA=85=EC=84=B8=20?= =?UTF-8?q?=EC=84=A4=EB=AA=85=20=EB=B3=B4=EC=B6=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/gt/genti/auth/dto/request/AppleLoginRequestDto.java | 4 +++- .../gt/genti/auth/dto/request/TokenRefreshRequestDto.java | 2 +- .../genti/creator/dto/request/AccountUpdateRequestDto.java | 3 +-- .../creator/dto/request/CreatorStatusUpdateRequestDto.java | 2 +- .../creator/dto/response/CreatorFindByAdminResponseDto.java | 2 +- .../genti/creator/dto/response/CreatorFindResponseDto.java | 2 +- .../dto/response/CreatorStatusUpdateResponseDto.java | 3 ++- .../deposit/dto/response/DepositFindByAdminResponseDto.java | 2 +- .../dto/response/DepositFindByCreatorResponseDto.java | 2 +- .../dto/request/CommonPictureKeyUpdateRequestDto.java | 2 +- .../picture/dto/response/CommonPictureResponseDto.java | 3 ++- .../dto/request/PGREQSaveRequestDto.java | 2 +- .../dto/response/PGREQBriefFindByCreatorResponseDto.java | 2 +- .../dto/response/PGREQBriefFindByUserResponseDto.java | 6 +----- .../dto/response/PGREQDetailFindByAdminResponseDto.java | 2 +- .../dto/response/PGREQDetailFindByUserResponseDto.java | 3 ++- .../dto/response/PGREQStatusResponseDto.java | 2 +- .../dto/request/MemoUpdateRequestDto.java | 2 +- .../dto/request/PGRESUpdateAdminInChargeRequestDto.java | 3 +-- .../dto/response/PGRESDetailFindByAdminResponseDto.java | 2 +- .../dto/response/PGRESFindByUserResponseDto.java | 2 +- .../dto/response/PGRESSubmitByAdminResponseDto.java | 2 +- .../dto/response/PGRESSubmitByCreatorResponseDto.java | 2 +- .../dto/response/PGRESUpdateAdminInChargeResponseDto.java | 2 +- .../genti/post/dto/response/PostBriefFindResponseDto.java | 2 +- .../gt/genti/post/dto/response/PostDetailResponseDto.java | 2 +- .../gt/genti/report/dto/request/ReportCreateRequestDto.java | 2 +- .../gt/genti/report/dto/request/ReportUpdateRequestDto.java | 3 +-- .../report/dto/response/ReportFindByAdminResponseDto.java | 2 +- .../responseexample/dto/request/ExampleSaveRequestDto.java | 3 +-- .../dto/response/ExampleWithPictureFindResponseDto.java | 2 +- .../dto/response/SettlementAndWithdrawPageResponseDto.java | 2 +- .../com/gt/genti/usecase/PictureGenerateRequestUseCase.java | 1 + .../gt/genti/user/dto/request/UserInfoUpdateRequestDto.java | 2 +- .../gt/genti/user/dto/request/UserRoleUpdateRequestDto.java | 2 +- .../genti/user/dto/request/UserStatusUpdateRequestDto.java | 2 +- .../genti/user/dto/response/UserFindByAdminResponseDto.java | 2 +- .../com/gt/genti/user/dto/response/UserFindResponseDto.java | 2 +- .../dto/response/WithdrawCompletionResponseDto.java | 2 +- .../dto/response/WithdrawFindByAdminResponseDto.java | 2 +- .../dto/response/WithdrawFindByCreatorResponseDto.java | 2 +- .../settlementanwithdraw/model/SettlementAndWithdraw.java | 2 +- .../java/com/gt/genti/aws/dto/PreSignedUrlRequestDto.java | 2 ++ .../java/com/gt/genti/aws/dto/PreSignedUrlResponseDto.java | 2 ++ 44 files changed, 51 insertions(+), 49 deletions(-) diff --git a/genti-api/src/main/java/com/gt/genti/auth/dto/request/AppleLoginRequestDto.java b/genti-api/src/main/java/com/gt/genti/auth/dto/request/AppleLoginRequestDto.java index 52a18637..d0765730 100644 --- a/genti-api/src/main/java/com/gt/genti/auth/dto/request/AppleLoginRequestDto.java +++ b/genti-api/src/main/java/com/gt/genti/auth/dto/request/AppleLoginRequestDto.java @@ -1,5 +1,6 @@ package com.gt.genti.auth.dto.request; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.AccessLevel; import lombok.AllArgsConstructor; @@ -9,8 +10,9 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor @Getter +@Schema(name = "[Auth][Anonymous] 애플 로그인 요청 dto", description = "토큰 전달") public class AppleLoginRequestDto { - @NotBlank + @Schema(description = "애플로그인 성공후 받은 토큰", example = "cvoeEIrnf23.4122") private String token; } \ No newline at end of file diff --git a/genti-api/src/main/java/com/gt/genti/auth/dto/request/TokenRefreshRequestDto.java b/genti-api/src/main/java/com/gt/genti/auth/dto/request/TokenRefreshRequestDto.java index 542de3f4..2334af7d 100644 --- a/genti-api/src/main/java/com/gt/genti/auth/dto/request/TokenRefreshRequestDto.java +++ b/genti-api/src/main/java/com/gt/genti/auth/dto/request/TokenRefreshRequestDto.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor -@Schema(description = "인증 토큰 Refresh 요청 Dto") +@Schema(name = "[Auth][Anonymous] Genti 인증토큰 Refresh 요청 Dto", description = "토큰 전달") public class TokenRefreshRequestDto { @NotBlank @Schema(description = "refreshToken") diff --git a/genti-api/src/main/java/com/gt/genti/creator/dto/request/AccountUpdateRequestDto.java b/genti-api/src/main/java/com/gt/genti/creator/dto/request/AccountUpdateRequestDto.java index d1b898b5..9394871d 100644 --- a/genti-api/src/main/java/com/gt/genti/creator/dto/request/AccountUpdateRequestDto.java +++ b/genti-api/src/main/java/com/gt/genti/creator/dto/request/AccountUpdateRequestDto.java @@ -9,10 +9,9 @@ import lombok.Getter; import lombok.NoArgsConstructor; -// @Tag(name = "RequestDtos", description = "RequestDtos") -@Schema(description = "계좌정보 수정 요청 Dto") @Getter @NoArgsConstructor +@Schema(name = "[Creator][Creator] 공급자 계좌정보 수정 요청 Dto", description = "계좌 정보 수정") public class AccountUpdateRequestDto { @NotNull diff --git a/genti-api/src/main/java/com/gt/genti/creator/dto/request/CreatorStatusUpdateRequestDto.java b/genti-api/src/main/java/com/gt/genti/creator/dto/request/CreatorStatusUpdateRequestDto.java index 9e1a0a51..74ded948 100644 --- a/genti-api/src/main/java/com/gt/genti/creator/dto/request/CreatorStatusUpdateRequestDto.java +++ b/genti-api/src/main/java/com/gt/genti/creator/dto/request/CreatorStatusUpdateRequestDto.java @@ -7,7 +7,7 @@ @Getter @NoArgsConstructor -@Schema(description = "공급자 작업가능상태 수정 요청 dto") +@Schema(name = "[Creator][Creator] 공급자 작업가능상태 수정 요청 dto", description = "작업가능상태 수정") public class CreatorStatusUpdateRequestDto { @NotNull @Schema(description = "변경하고자 하는 작업가능여부") diff --git a/genti-api/src/main/java/com/gt/genti/creator/dto/response/CreatorFindByAdminResponseDto.java b/genti-api/src/main/java/com/gt/genti/creator/dto/response/CreatorFindByAdminResponseDto.java index 908577e7..5f7ae19e 100644 --- a/genti-api/src/main/java/com/gt/genti/creator/dto/response/CreatorFindByAdminResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/creator/dto/response/CreatorFindByAdminResponseDto.java @@ -7,9 +7,9 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "어드민의 공급자 조회 응답 dto") @Getter @NoArgsConstructor +@Schema(name = "[Creator][Admin] 어드민의 공급자 조회 응답 dto") public class CreatorFindByAdminResponseDto { @Schema(description = "공급자 DB Id", example = "1") Long creatorId; diff --git a/genti-api/src/main/java/com/gt/genti/creator/dto/response/CreatorFindResponseDto.java b/genti-api/src/main/java/com/gt/genti/creator/dto/response/CreatorFindResponseDto.java index d20765da..6ead58d6 100644 --- a/genti-api/src/main/java/com/gt/genti/creator/dto/response/CreatorFindResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/creator/dto/response/CreatorFindResponseDto.java @@ -7,9 +7,9 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "공급자 조회 응답 dto") @Getter @NoArgsConstructor +@Schema(name = "[Creator][Creator] 공급자 조회 응답 dto") public class CreatorFindResponseDto { @Schema(description = "공급자 DB Id", example = "1") Long creatorId; diff --git a/genti-api/src/main/java/com/gt/genti/creator/dto/response/CreatorStatusUpdateResponseDto.java b/genti-api/src/main/java/com/gt/genti/creator/dto/response/CreatorStatusUpdateResponseDto.java index 80cd4bff..b65c0901 100644 --- a/genti-api/src/main/java/com/gt/genti/creator/dto/response/CreatorStatusUpdateResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/creator/dto/response/CreatorStatusUpdateResponseDto.java @@ -5,9 +5,10 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "공급자 작업가능상태 변경 후 응답 dto") + @Getter @NoArgsConstructor +@Schema(name = "[Creator][Creator] 공급자 작업가능상태 변경 성공 응답 dto") public class CreatorStatusUpdateResponseDto { @Schema(description = "작업가능 여부") Boolean workable; diff --git a/genti-api/src/main/java/com/gt/genti/deposit/dto/response/DepositFindByAdminResponseDto.java b/genti-api/src/main/java/com/gt/genti/deposit/dto/response/DepositFindByAdminResponseDto.java index 7770b1a6..90259f95 100644 --- a/genti-api/src/main/java/com/gt/genti/deposit/dto/response/DepositFindByAdminResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/deposit/dto/response/DepositFindByAdminResponseDto.java @@ -6,9 +6,9 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "잔액 조회 dto") @Getter @NoArgsConstructor +@Schema(name = "[Deposit][Admin] 공급자 잔액 조회 by 어드민 dto") public class DepositFindByAdminResponseDto { @Schema(description = "잔액 테이블 Id", example = "1") Long id; diff --git a/genti-api/src/main/java/com/gt/genti/deposit/dto/response/DepositFindByCreatorResponseDto.java b/genti-api/src/main/java/com/gt/genti/deposit/dto/response/DepositFindByCreatorResponseDto.java index 8c3f823e..fb309cab 100644 --- a/genti-api/src/main/java/com/gt/genti/deposit/dto/response/DepositFindByCreatorResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/deposit/dto/response/DepositFindByCreatorResponseDto.java @@ -6,9 +6,9 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "잔액 조회 dto") @Getter @NoArgsConstructor +@Schema(name = "[Deposit][Creator] 공급자 잔액 조회 by 공급자 dto") public class DepositFindByCreatorResponseDto { @Schema(description = "잔액 테이블 Id", example = "1") Long id; diff --git a/genti-api/src/main/java/com/gt/genti/picture/dto/request/CommonPictureKeyUpdateRequestDto.java b/genti-api/src/main/java/com/gt/genti/picture/dto/request/CommonPictureKeyUpdateRequestDto.java index 00a67384..69ecdfdf 100644 --- a/genti-api/src/main/java/com/gt/genti/picture/dto/request/CommonPictureKeyUpdateRequestDto.java +++ b/genti-api/src/main/java/com/gt/genti/picture/dto/request/CommonPictureKeyUpdateRequestDto.java @@ -13,7 +13,7 @@ @Setter @NoArgsConstructor @AllArgsConstructor -@Schema(description = "사진 Key 업데이트 요청 dto") +@Schema(name = "[Picture][Anonymous] 사진 업로드 결과 Key 업데이트 요청 dto", description = "사진을 업로드 한 이후 저장한 경로(s3)가 어디인지 서버에 알림") public class CommonPictureKeyUpdateRequestDto { @NotNull diff --git a/genti-api/src/main/java/com/gt/genti/picture/dto/response/CommonPictureResponseDto.java b/genti-api/src/main/java/com/gt/genti/picture/dto/response/CommonPictureResponseDto.java index c04aa45a..bc8d5edf 100644 --- a/genti-api/src/main/java/com/gt/genti/picture/dto/response/CommonPictureResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/picture/dto/response/CommonPictureResponseDto.java @@ -9,9 +9,10 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "공통 사진 응답 dto") + @Getter @NoArgsConstructor +@Schema(name = "[Picture][Anonymous] 공통 사진 응답 dto") public class CommonPictureResponseDto { @Schema(description = "해당 사진의 Entity id", example = "1") Long id; diff --git a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/request/PGREQSaveRequestDto.java b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/request/PGREQSaveRequestDto.java index 04669e5a..3937e4a6 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/request/PGREQSaveRequestDto.java +++ b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/request/PGREQSaveRequestDto.java @@ -19,7 +19,7 @@ @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -@Schema(description = "사진생성요청 생성 요청 dto") +@Schema(name = "[PGREQ][User] 사진생성요청 생성 dto") public class PGREQSaveRequestDto { @NotBlank @Schema(description = "프롬프트", example = "벚꽃길에서 벤치에 앉아있는 사진이요") diff --git a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQBriefFindByCreatorResponseDto.java b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQBriefFindByCreatorResponseDto.java index c96d4bc4..ca68cdbf 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQBriefFindByCreatorResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQBriefFindByCreatorResponseDto.java @@ -13,9 +13,9 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "공급자의 사진생성요청 간단히 조회 응답 dto") @Getter @NoArgsConstructor +@Schema(name = "[PGREQ][Creator] 사진생성요청 간단히 조회 by 공급자 응답 dto") public class PGREQBriefFindByCreatorResponseDto { @Schema(description = "사진생성요청 DB Id", example = "1") Long pictureGenerateRequestId; diff --git a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQBriefFindByUserResponseDto.java b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQBriefFindByUserResponseDto.java index 54067e47..ba2a442a 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQBriefFindByUserResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQBriefFindByUserResponseDto.java @@ -14,9 +14,9 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "유저의 사진생성요청 간단히 조회 응답 dto") @Getter @NoArgsConstructor +@Schema(name = "[PGREQ][User] 사진생성요청 간단히 조회 by 사용자 응답 dto") public class PGREQBriefFindByUserResponseDto { @Schema(description = "사진생성요청 DB Id", example = "1") Long pictureGenerateRequestId; @@ -34,7 +34,6 @@ public class PGREQBriefFindByUserResponseDto { LocalDateTime createdAt; public PGREQBriefFindByUserResponseDto(PictureGenerateRequest pgreq) { - this.pictureGenerateRequestId = pgreq.getId(); this.prompt = pgreq.getPrompt(); this.cameraAngle = pgreq.getCameraAngle(); @@ -52,8 +51,5 @@ public PGREQBriefFindByUserResponseDto(PictureGenerateRequest pgreq) { .toList()); } - // Duration duration = Duration.between(LocalDateTime.now(), - // createdAt.plusMinutes(DateTimeUtil.ACCEPTABLE_TIME_MINUTE)); - // this.remainTime = DateTimeUtil.getTimeString(duration); } } diff --git a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQDetailFindByAdminResponseDto.java b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQDetailFindByAdminResponseDto.java index e70aed0a..de299605 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQDetailFindByAdminResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQDetailFindByAdminResponseDto.java @@ -18,7 +18,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "어드민 사진생성요청 응답 dto") +@Schema(name = "[PGREQ][Admin] 사진생성요청 조회 by 어드민 응답 dto") @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) public class PGREQDetailFindByAdminResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQDetailFindByUserResponseDto.java b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQDetailFindByUserResponseDto.java index 5f35149f..34875355 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQDetailFindByUserResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQDetailFindByUserResponseDto.java @@ -15,7 +15,8 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "유저가 사진생성요청에 대해 자세히 조회했을 때 응답 dto") +@Deprecated +@Schema(name = "[PGREQ][User] 사진생성요청 조회 by 사용자 응답 dto", deprecated = true) @Getter @NoArgsConstructor public class PGREQDetailFindByUserResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQStatusResponseDto.java b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQStatusResponseDto.java index 3d071790..4f1c2bd7 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQStatusResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQStatusResponseDto.java @@ -7,7 +7,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "유저의 사진생성요청 현재 상태 조회 응답 dto") +@Schema(name = "[PGREQ][User] 사진생성요청 상태 조회 by 사용자 응답 dto") @Getter @NoArgsConstructor public class PGREQStatusResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/request/MemoUpdateRequestDto.java b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/request/MemoUpdateRequestDto.java index 0c1d1b08..931f61f3 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/request/MemoUpdateRequestDto.java +++ b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/request/MemoUpdateRequestDto.java @@ -8,7 +8,7 @@ @Deprecated @Getter @NoArgsConstructor -@Schema(description = "메모 수정 요청 Dto") +@Schema(name = "[PGRES][Creator] 메모 수정 요청 Dto", deprecated = true) public class MemoUpdateRequestDto { @NotBlank @Schema(description = "메모", example = "신고당한적 있음, 까다로운 유저") diff --git a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/request/PGRESUpdateAdminInChargeRequestDto.java b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/request/PGRESUpdateAdminInChargeRequestDto.java index ac12e749..5745f056 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/request/PGRESUpdateAdminInChargeRequestDto.java +++ b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/request/PGRESUpdateAdminInChargeRequestDto.java @@ -6,8 +6,7 @@ @Getter @NoArgsConstructor -@Schema(description = "사진생성응답 담당자 변경 Dto") - +@Schema(name = "[PGRES][Admin] 사진생성응답 담당 어드민 변경 Dto") public class PGRESUpdateAdminInChargeRequestDto { @Schema(description = "담당자 이름", example = "안재욱") String adminInCharge; diff --git a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESDetailFindByAdminResponseDto.java b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESDetailFindByAdminResponseDto.java index cc45457d..04498caf 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESDetailFindByAdminResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESDetailFindByAdminResponseDto.java @@ -11,7 +11,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "어드민의 사진생성응답 자세히 조회 응답 dto") +@Schema(name = "[PGRES][Admin] 사진생성응답 조회 by 어드민 응답 dto") @Getter @NoArgsConstructor public class PGRESDetailFindByAdminResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESFindByUserResponseDto.java b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESFindByUserResponseDto.java index 1011f405..d605b730 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESFindByUserResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESFindByUserResponseDto.java @@ -9,7 +9,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "사용자의 내 요청에 의해 완성된 사진 조회 응답 dto") +@Schema(name = "[PGRES][User] 사진생성응답 조회 by 사용자 응답 dto") @Getter @NoArgsConstructor public class PGRESFindByUserResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESSubmitByAdminResponseDto.java b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESSubmitByAdminResponseDto.java index b94d7f02..2b818224 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESSubmitByAdminResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESSubmitByAdminResponseDto.java @@ -5,7 +5,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "어드민의 사진생성응답 제출시 응답 dto") +@Schema(name = "[PGRES][Admin] 사진생성응답 제출 by 어드민 응답 dto") @Getter @NoArgsConstructor public class PGRESSubmitByAdminResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESSubmitByCreatorResponseDto.java b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESSubmitByCreatorResponseDto.java index aeeb1937..5353048d 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESSubmitByCreatorResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESSubmitByCreatorResponseDto.java @@ -5,7 +5,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "공급자가 응답 제출 후 소요시간 및 리워드 응답 dto") +@Schema(name = "[PGRES][Creator] 사진생성응답 제출 by 공급자 응답 dto", description = "공급자가 응답 제출 후 소요시간 및 리워드 응답 dto") @Getter @NoArgsConstructor public class PGRESSubmitByCreatorResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESUpdateAdminInChargeResponseDto.java b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESUpdateAdminInChargeResponseDto.java index 794925d9..32d3c967 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESUpdateAdminInChargeResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/dto/response/PGRESUpdateAdminInChargeResponseDto.java @@ -7,7 +7,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "어드민의 사진생성응답 담당자 변경요청에 의한 응답 dto") +@Schema(name = "[PGRES][Admin] 사진생성응답 담당 어드민 변경시 응답 Dto", description = "어드민의 사진생성응답 담당자 변경요청에 의한 응답 dto") @Getter @NoArgsConstructor public class PGRESUpdateAdminInChargeResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/post/dto/response/PostBriefFindResponseDto.java b/genti-api/src/main/java/com/gt/genti/post/dto/response/PostBriefFindResponseDto.java index f07dbbd4..518270a4 100644 --- a/genti-api/src/main/java/com/gt/genti/post/dto/response/PostBriefFindResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/post/dto/response/PostBriefFindResponseDto.java @@ -6,7 +6,7 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -@Schema +@Schema(deprecated = true) @Deprecated @Getter @NoArgsConstructor diff --git a/genti-api/src/main/java/com/gt/genti/post/dto/response/PostDetailResponseDto.java b/genti-api/src/main/java/com/gt/genti/post/dto/response/PostDetailResponseDto.java index 9a25d5c4..0cc89700 100644 --- a/genti-api/src/main/java/com/gt/genti/post/dto/response/PostDetailResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/post/dto/response/PostDetailResponseDto.java @@ -12,7 +12,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema +@Schema(deprecated = true) @Deprecated @Getter @NoArgsConstructor diff --git a/genti-api/src/main/java/com/gt/genti/report/dto/request/ReportCreateRequestDto.java b/genti-api/src/main/java/com/gt/genti/report/dto/request/ReportCreateRequestDto.java index 82900883..fbb101cc 100644 --- a/genti-api/src/main/java/com/gt/genti/report/dto/request/ReportCreateRequestDto.java +++ b/genti-api/src/main/java/com/gt/genti/report/dto/request/ReportCreateRequestDto.java @@ -9,7 +9,7 @@ @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -@Schema(description = "신고 생성 요청 dto") +@Schema(name = "[Report][User] 신고 생성 요청 by 사용자 dto") public class ReportCreateRequestDto { @NotNull @Schema(description = "신고할 사진생성응답 id", example = "1") diff --git a/genti-api/src/main/java/com/gt/genti/report/dto/request/ReportUpdateRequestDto.java b/genti-api/src/main/java/com/gt/genti/report/dto/request/ReportUpdateRequestDto.java index 7448052d..905653cd 100644 --- a/genti-api/src/main/java/com/gt/genti/report/dto/request/ReportUpdateRequestDto.java +++ b/genti-api/src/main/java/com/gt/genti/report/dto/request/ReportUpdateRequestDto.java @@ -10,8 +10,7 @@ @Getter @NoArgsConstructor -@Schema(description = "신고 상태(해결전/후) 수정 Dto") - +@Schema(name = "[Report][Admin] 신고 상태 변경 요청 by 어드민 dto", description = "신고 상태(해결전/후) 수정 Dto") public class ReportUpdateRequestDto { @NotNull @Min(1) diff --git a/genti-api/src/main/java/com/gt/genti/report/dto/response/ReportFindByAdminResponseDto.java b/genti-api/src/main/java/com/gt/genti/report/dto/response/ReportFindByAdminResponseDto.java index 393fca5f..c2a1f90b 100644 --- a/genti-api/src/main/java/com/gt/genti/report/dto/response/ReportFindByAdminResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/report/dto/response/ReportFindByAdminResponseDto.java @@ -13,7 +13,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "어드민의 신고내역 조회 응답 dto") +@Schema(name = "[Report][Admin] 신고내역 조회 by 어드민 응답 dto") @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) public class ReportFindByAdminResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/responseexample/dto/request/ExampleSaveRequestDto.java b/genti-api/src/main/java/com/gt/genti/responseexample/dto/request/ExampleSaveRequestDto.java index 44c0e9fd..637a82a0 100644 --- a/genti-api/src/main/java/com/gt/genti/responseexample/dto/request/ExampleSaveRequestDto.java +++ b/genti-api/src/main/java/com/gt/genti/responseexample/dto/request/ExampleSaveRequestDto.java @@ -12,8 +12,7 @@ @Getter @NoArgsConstructor -@Schema(description = "완성된 예시 업로드") - +@Schema(name = "[ResponseExample][Admin] 완성된 예시 업로드 요청 by 어드민 dto") public class ExampleSaveRequestDto { @NotNull CommonPictureKeyUpdateRequestDto uploadPicture; diff --git a/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/ExampleWithPictureFindResponseDto.java b/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/ExampleWithPictureFindResponseDto.java index f7fd846d..535c1ee8 100644 --- a/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/ExampleWithPictureFindResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/ExampleWithPictureFindResponseDto.java @@ -7,7 +7,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "작업 예시 조회 응답 dto") +@Schema(name = "[ResponseExample][Admin&User] 작업 예시 조회 응답 dto") @Getter @NoArgsConstructor public class ExampleWithPictureFindResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/settlementandwithdraw/dto/response/SettlementAndWithdrawPageResponseDto.java b/genti-api/src/main/java/com/gt/genti/settlementandwithdraw/dto/response/SettlementAndWithdrawPageResponseDto.java index b6fec6c0..6cc04d57 100644 --- a/genti-api/src/main/java/com/gt/genti/settlementandwithdraw/dto/response/SettlementAndWithdrawPageResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/settlementandwithdraw/dto/response/SettlementAndWithdrawPageResponseDto.java @@ -10,7 +10,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "정산&출금내역 리스트와 함께 잔액을 조회한다.") +@Schema(name = "[Settlement][Creator] 정산&출금내역 조회 페이지네이션 응답 dto", description = "정산&출금내역 리스트와 함께 잔액을 조회한다.") @Getter @NoArgsConstructor public class SettlementAndWithdrawPageResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/usecase/PictureGenerateRequestUseCase.java b/genti-api/src/main/java/com/gt/genti/usecase/PictureGenerateRequestUseCase.java index 2c6022f7..673ca48b 100644 --- a/genti-api/src/main/java/com/gt/genti/usecase/PictureGenerateRequestUseCase.java +++ b/genti-api/src/main/java/com/gt/genti/usecase/PictureGenerateRequestUseCase.java @@ -20,6 +20,7 @@ public interface PictureGenerateRequestUseCase { public PGREQStatusResponseDto getPGREQStatusIfPendingExists(Long userId); + @Deprecated public PGREQDetailFindByUserResponseDto findPGREQByRequestAndId(Long userId, Long id); public PictureGenerateRequest createPGREQ(Long userId, diff --git a/genti-api/src/main/java/com/gt/genti/user/dto/request/UserInfoUpdateRequestDto.java b/genti-api/src/main/java/com/gt/genti/user/dto/request/UserInfoUpdateRequestDto.java index a2166f32..7b546575 100644 --- a/genti-api/src/main/java/com/gt/genti/user/dto/request/UserInfoUpdateRequestDto.java +++ b/genti-api/src/main/java/com/gt/genti/user/dto/request/UserInfoUpdateRequestDto.java @@ -10,7 +10,7 @@ @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -@Schema(description = "사용자 정보 수정 요청 dto") +@Schema(name = "[User][User] 사용자 정보 수정 요청 dto", description = "사용자 정보를 수정함") public class UserInfoUpdateRequestDto { @Schema(description = "실제 이름", example = "김흥국") String userName; diff --git a/genti-api/src/main/java/com/gt/genti/user/dto/request/UserRoleUpdateRequestDto.java b/genti-api/src/main/java/com/gt/genti/user/dto/request/UserRoleUpdateRequestDto.java index 58a3bc05..9a1cde87 100644 --- a/genti-api/src/main/java/com/gt/genti/user/dto/request/UserRoleUpdateRequestDto.java +++ b/genti-api/src/main/java/com/gt/genti/user/dto/request/UserRoleUpdateRequestDto.java @@ -10,7 +10,7 @@ @Getter @NoArgsConstructor -@Schema(description = "유저 권한 수정 요청 Dto") +@Schema(name = "[User][Admin] 유저 권한 수정 요청 Dto", description = "사용자 권한을 수정함, 주로 사용자->공급자 변경시 사용될 예정") public class UserRoleUpdateRequestDto { @NotNull @Schema(description = "유저의 권한") diff --git a/genti-api/src/main/java/com/gt/genti/user/dto/request/UserStatusUpdateRequestDto.java b/genti-api/src/main/java/com/gt/genti/user/dto/request/UserStatusUpdateRequestDto.java index 3aa00e98..5d0e6620 100644 --- a/genti-api/src/main/java/com/gt/genti/user/dto/request/UserStatusUpdateRequestDto.java +++ b/genti-api/src/main/java/com/gt/genti/user/dto/request/UserStatusUpdateRequestDto.java @@ -9,7 +9,7 @@ @Getter @NoArgsConstructor -@Schema(description = "유저 상태(활성화/비활성화) 수정 요청 dto") +@Schema(name = "[User][Admin] 유저 상태(활성화/비활성화) 수정 요청 dto", description = "유저 비활성화시 사용") public class UserStatusUpdateRequestDto { @NotNull @Schema(description = "유저의 상태") diff --git a/genti-api/src/main/java/com/gt/genti/user/dto/response/UserFindByAdminResponseDto.java b/genti-api/src/main/java/com/gt/genti/user/dto/response/UserFindByAdminResponseDto.java index cdd16c20..9685b96a 100644 --- a/genti-api/src/main/java/com/gt/genti/user/dto/response/UserFindByAdminResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/user/dto/response/UserFindByAdminResponseDto.java @@ -16,7 +16,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "어드민의 유저 조회 응답 dto") +@Schema(name = "[User][Admin] 유저조회 by 어드민 응답 dto") @Getter @NoArgsConstructor public class UserFindByAdminResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/user/dto/response/UserFindResponseDto.java b/genti-api/src/main/java/com/gt/genti/user/dto/response/UserFindResponseDto.java index 0e76c89f..51105465 100644 --- a/genti-api/src/main/java/com/gt/genti/user/dto/response/UserFindResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/user/dto/response/UserFindResponseDto.java @@ -11,7 +11,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "유저의 유저 정보 조회 응답 dto") +@Schema(name = "[User][User] 사용자조회 by 사용자 응답 dto") @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) public class UserFindResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawCompletionResponseDto.java b/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawCompletionResponseDto.java index ebaae361..78d63f69 100644 --- a/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawCompletionResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawCompletionResponseDto.java @@ -7,7 +7,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "어드민의 출금 요청 처리 결과 응답 dto") +@Schema(name = "[Withdraw][Admin] 출금 요청 해결(송금) 완료시 응답 dto") @Getter @NoArgsConstructor public class WithdrawCompletionResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawFindByAdminResponseDto.java b/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawFindByAdminResponseDto.java index 5336445d..a8e355ae 100644 --- a/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawFindByAdminResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawFindByAdminResponseDto.java @@ -8,7 +8,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "어드민의 출금요청 조회 응답 dto") +@Schema(name = "[Withdraw][Admin] 출금요청 조회 by 어드민 응답 dto") @Getter @NoArgsConstructor public class WithdrawFindByAdminResponseDto { diff --git a/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawFindByCreatorResponseDto.java b/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawFindByCreatorResponseDto.java index c1042f58..8ed3ad33 100644 --- a/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawFindByCreatorResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/withdraw/dto/response/WithdrawFindByCreatorResponseDto.java @@ -7,7 +7,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "공급자의 출금요청 조회 응답 dto") +@Schema(name = "[Withdraw][Creator] 출금요청 조회 by 공급자 응답 dto") @Getter @NoArgsConstructor public class WithdrawFindByCreatorResponseDto { diff --git a/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/model/SettlementAndWithdraw.java b/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/model/SettlementAndWithdraw.java index 58361245..21dbff86 100644 --- a/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/model/SettlementAndWithdraw.java +++ b/genti-domain/src/main/java/com/gt/genti/settlementanwithdraw/model/SettlementAndWithdraw.java @@ -10,7 +10,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(description = "정산 및 출금내역") +@Schema(name = "[Settlement&Withdraw][Creator] 정산&출금내역 응답 dto") @Getter @NoArgsConstructor public class SettlementAndWithdraw { diff --git a/genti-external/src/main/java/com/gt/genti/aws/dto/PreSignedUrlRequestDto.java b/genti-external/src/main/java/com/gt/genti/aws/dto/PreSignedUrlRequestDto.java index de02179f..21e25752 100644 --- a/genti-external/src/main/java/com/gt/genti/aws/dto/PreSignedUrlRequestDto.java +++ b/genti-external/src/main/java/com/gt/genti/aws/dto/PreSignedUrlRequestDto.java @@ -2,12 +2,14 @@ import com.gt.genti.aws.FileType; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; @Getter @NoArgsConstructor +@Schema(name = "[Presigned-url][Anonymous] 사진업로드할 url 요청 dto ") public class PreSignedUrlRequestDto { FileType fileType; diff --git a/genti-external/src/main/java/com/gt/genti/aws/dto/PreSignedUrlResponseDto.java b/genti-external/src/main/java/com/gt/genti/aws/dto/PreSignedUrlResponseDto.java index 54d9fc85..f30de255 100644 --- a/genti-external/src/main/java/com/gt/genti/aws/dto/PreSignedUrlResponseDto.java +++ b/genti-external/src/main/java/com/gt/genti/aws/dto/PreSignedUrlResponseDto.java @@ -2,11 +2,13 @@ import java.net.URL; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.NoArgsConstructor; @Getter @NoArgsConstructor +@Schema(name = "[Presigned-url][Anonymous] 사진업로드할 url 응답 dto") public class PreSignedUrlResponseDto { String fileName; URL url; From 53f87bf8a7f2fdc163291c4df819e8596b36279e Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Mon, 15 Jul 2024 23:05:43 +0900 Subject: [PATCH 04/16] =?UTF-8?q?Fix:=20#43=20AuthController=EC=97=90=20sw?= =?UTF-8?q?agger=20api=20=EB=AA=85=EC=84=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../genti/auth/controller/AuthController.java | 53 ++++++++++++++++--- 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/genti-api/src/main/java/com/gt/genti/auth/controller/AuthController.java b/genti-api/src/main/java/com/gt/genti/auth/controller/AuthController.java index 70d44610..0f0defd4 100644 --- a/genti-api/src/main/java/com/gt/genti/auth/controller/AuthController.java +++ b/genti-api/src/main/java/com/gt/genti/auth/controller/AuthController.java @@ -15,6 +15,7 @@ import com.gt.genti.auth.dto.request.AppleLoginRequestDto; import com.gt.genti.auth.service.AuthService; +import com.gt.genti.error.ResponseCode; import com.gt.genti.jwt.JwtTokenProvider; import com.gt.genti.jwt.TokenGenerateCommand; import com.gt.genti.jwt.TokenResponse; @@ -22,13 +23,22 @@ import com.gt.genti.model.LogItem; import com.gt.genti.model.LogRequester; import com.gt.genti.model.Logging; -import com.gt.genti.user.dto.request.AppleLoginRequest; -import com.gt.genti.user.dto.request.SocialLoginRequestImpl; -import com.gt.genti.user.dto.response.SocialLoginResponse; +import com.gt.genti.swagger.EnumResponse; +import com.gt.genti.swagger.EnumResponses; +import com.gt.genti.auth.dto.request.AppleLoginRequest; +import com.gt.genti.auth.dto.request.SocialLoginRequestImpl; +import com.gt.genti.auth.dto.response.SocialLoginResponse; import com.gt.genti.user.model.AuthUser; import com.gt.genti.user.model.OauthPlatform; import com.gt.genti.user.model.UserRole; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.headers.Header; +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 jakarta.validation.Valid; import jakarta.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; @@ -42,20 +52,43 @@ public class AuthController { private final JwtTokenProvider jwtTokenProvider; private final AuthService authService; - @GetMapping("/login/v1/oauth") + @Operation(summary = "oauth 로그인 페이지 호출", description = "구글, 카카오 oauth로그인페이지 로 Redirect 됩니다. url은 HttpHeader에 포함되어있습니다.") + @ApiResponses(value = { + @ApiResponse(responseCode = "303", description = "리디렉션을 위한 응답 헤더를 포함합니다.", headers = { + @Header(name = "Location", description = "리디렉션 URL", schema = @Schema(type = "string")) + }, content = @Content(schema = @Schema(hidden = true))) + }) + @GetMapping("/login/v1/oauth2") @Logging(item = LogItem.OAUTH, action = LogAction.LOGIN, requester = LogRequester.ANONYMOUS) public ResponseEntity login( + @Parameter(description = "호출할 Oauth platform 종류", example = "KAKAO", schema = @Schema(allowableValues = { + "KAKAO"})) @RequestParam(name = "oauthPlatform") OauthPlatform oauthPlatform) { HttpHeaders httpHeaders = authService.getOauthRedirect(oauthPlatform); return new ResponseEntity<>(httpHeaders, HttpStatus.SEE_OTHER); } + @Operation(summary = "apple 로그인 후 토큰으로 로그인", description = "앱에서 apple 로그인을 수행한 후 받은 token을 전달받아 apple auth 서버와 통신 후 로그인 처리") + @EnumResponses(value = { + @EnumResponse(ResponseCode.OK), + @EnumResponse(ResponseCode.AppleOauthClaimInvalid), + @EnumResponse(ResponseCode.AppleOauthIdTokenExpired), + @EnumResponse(ResponseCode.AppleOauthIdTokenIncorrect), + @EnumResponse(ResponseCode.AppleOauthIdTokenInvalid), + @EnumResponse(ResponseCode.AppleOauthJwtValueInvalid), + @EnumResponse(ResponseCode.AppleOauthPublicKeyInvalid), + }) @PostMapping("/login/v1/oauth2/code/apple") @Logging(item = LogItem.OAUTH_APPLE, action = LogAction.LOGIN, requester = LogRequester.ANONYMOUS) - public ResponseEntity> loginApple(@RequestBody @Valid AppleLoginRequestDto request) { + public ResponseEntity> loginApple( + @RequestBody @Valid AppleLoginRequestDto request) { return success(authService.login(AppleLoginRequest.of(OauthPlatform.APPLE, request.getToken()))); } + @Operation(summary = "kakao 로그인 후 redirect url", description = "FE에서 직접 호출할 일은 없습니다.") + @EnumResponses(value = { + @EnumResponse(ResponseCode.OK), + }) @GetMapping("/login/v1/oauth2/code/kakao") @Logging(item = LogItem.OAUTH_KAKAO, action = LogAction.LOGIN, requester = LogRequester.ANONYMOUS) public ResponseEntity> kakaoLogin( @@ -63,6 +96,11 @@ public ResponseEntity> kakaoLogin( return success(authService.login(SocialLoginRequestImpl.of(OauthPlatform.KAKAO, code))); } + @Deprecated + @Operation(summary = "google 로그인 후 redirect url", description = "FE에서 직접 호출할 일은 없습니다.") + @EnumResponses(value = { + @EnumResponse(ResponseCode.OK), + }) @GetMapping("/login/v1/oauth2/code/google") @Logging(item = LogItem.OAUTH_GOOGLE, action = LogAction.LOGIN, requester = LogRequester.ANONYMOUS) public ResponseEntity> googleLogin( @@ -70,10 +108,13 @@ public ResponseEntity> googleLogin( return success(authService.login(SocialLoginRequestImpl.of(OauthPlatform.GOOGLE, code))); } + @Operation(summary = "테스트용 jwt 토큰 발급", description = "") + @EnumResponses(value = { + @EnumResponse(ResponseCode.OK) + }) @GetMapping("/login/testjwt") public ResponseEntity> getTestJwt( @NotNull @RequestParam(name = "role", value = "role") UserRole role) { - log.info("요청 "); Map userIdMapper = Map.of(UserRole.USER, "2", UserRole.ADMIN, "1", UserRole.CREATOR, "4"); String userId = userIdMapper.get(role); TokenGenerateCommand command = TokenGenerateCommand.builder() From 6535650ec581255b74728d407f7fa19e0aa6c4e7 Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Mon, 15 Jul 2024 23:06:57 +0900 Subject: [PATCH 05/16] =?UTF-8?q?Rename:=20oauth=20=EA=B4=80=EB=A0=A8=20dt?= =?UTF-8?q?o=EB=93=A4=EC=9D=98=20=EC=9C=84=EC=B9=98(=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80)=20user=20->=20auth=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/request/AppleLoginRequest.java | 2 +- .../dto/request/SocialLoginRequest.java | 2 +- .../dto/request/SocialLoginRequestImpl.java | 2 +- .../dto/response/SocialLoginResponse.java | 23 +++++++++++++++++++ .../gt/genti/auth/service/AuthService.java | 4 ++-- .../dto/response/SocialLoginResponse.java | 14 ----------- .../service/social/AppleOauthStrategy.java | 8 +++---- .../service/social/GoogleOauthStrategy.java | 6 ++--- .../service/social/KakaoOauthStrategy.java | 7 +++--- .../service/social/SocialLoginStrategy.java | 4 ++-- .../service/social/SocialOauthContext.java | 4 ++-- 11 files changed, 42 insertions(+), 34 deletions(-) rename genti-api/src/main/java/com/gt/genti/{user => auth}/dto/request/AppleLoginRequest.java (92%) rename genti-api/src/main/java/com/gt/genti/{user => auth}/dto/request/SocialLoginRequest.java (78%) rename genti-api/src/main/java/com/gt/genti/{user => auth}/dto/request/SocialLoginRequestImpl.java (91%) create mode 100644 genti-api/src/main/java/com/gt/genti/auth/dto/response/SocialLoginResponse.java delete mode 100644 genti-api/src/main/java/com/gt/genti/user/dto/response/SocialLoginResponse.java diff --git a/genti-api/src/main/java/com/gt/genti/user/dto/request/AppleLoginRequest.java b/genti-api/src/main/java/com/gt/genti/auth/dto/request/AppleLoginRequest.java similarity index 92% rename from genti-api/src/main/java/com/gt/genti/user/dto/request/AppleLoginRequest.java rename to genti-api/src/main/java/com/gt/genti/auth/dto/request/AppleLoginRequest.java index e42a8559..cc2037a6 100644 --- a/genti-api/src/main/java/com/gt/genti/user/dto/request/AppleLoginRequest.java +++ b/genti-api/src/main/java/com/gt/genti/auth/dto/request/AppleLoginRequest.java @@ -1,4 +1,4 @@ -package com.gt.genti.user.dto.request; +package com.gt.genti.auth.dto.request; import com.gt.genti.user.model.OauthPlatform; diff --git a/genti-api/src/main/java/com/gt/genti/user/dto/request/SocialLoginRequest.java b/genti-api/src/main/java/com/gt/genti/auth/dto/request/SocialLoginRequest.java similarity index 78% rename from genti-api/src/main/java/com/gt/genti/user/dto/request/SocialLoginRequest.java rename to genti-api/src/main/java/com/gt/genti/auth/dto/request/SocialLoginRequest.java index 11bddc61..3cd60b35 100644 --- a/genti-api/src/main/java/com/gt/genti/user/dto/request/SocialLoginRequest.java +++ b/genti-api/src/main/java/com/gt/genti/auth/dto/request/SocialLoginRequest.java @@ -1,4 +1,4 @@ -package com.gt.genti.user.dto.request; +package com.gt.genti.auth.dto.request; import com.gt.genti.user.model.OauthPlatform; diff --git a/genti-api/src/main/java/com/gt/genti/user/dto/request/SocialLoginRequestImpl.java b/genti-api/src/main/java/com/gt/genti/auth/dto/request/SocialLoginRequestImpl.java similarity index 91% rename from genti-api/src/main/java/com/gt/genti/user/dto/request/SocialLoginRequestImpl.java rename to genti-api/src/main/java/com/gt/genti/auth/dto/request/SocialLoginRequestImpl.java index 46c9f3af..167c6b04 100644 --- a/genti-api/src/main/java/com/gt/genti/user/dto/request/SocialLoginRequestImpl.java +++ b/genti-api/src/main/java/com/gt/genti/auth/dto/request/SocialLoginRequestImpl.java @@ -1,4 +1,4 @@ -package com.gt.genti.user.dto.request; +package com.gt.genti.auth.dto.request; import com.gt.genti.user.model.OauthPlatform; diff --git a/genti-api/src/main/java/com/gt/genti/auth/dto/response/SocialLoginResponse.java b/genti-api/src/main/java/com/gt/genti/auth/dto/response/SocialLoginResponse.java new file mode 100644 index 00000000..45e50e81 --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/auth/dto/response/SocialLoginResponse.java @@ -0,0 +1,23 @@ +package com.gt.genti.auth.dto.response; + +import com.gt.genti.jwt.TokenResponse; + +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(name = "[Auth][Anonymous] 소셜 로그인 응답 Dto") +public record SocialLoginResponse( + @Schema(description = "유저 Db Id", example = "1") + Long userId, + @Schema(description = "유저 이름 (애플의 경우에는 공백(\"\"))", example = "서병렬", allowableValues = {"", "서병렬"}) + String userName, + @Schema(description = "oauth platform 이메일", example = "sbl1998@naver.com") + String email, + @Schema(description = "신규가입시 true", example = "true") + boolean isNewUser, + + TokenResponse token +) { + public static SocialLoginResponse of(Long userId, String userName, String email, boolean isNewUser, TokenResponse token) { + return new SocialLoginResponse(userId, userName, email, isNewUser, TokenResponse.of(token.accessToken(), token.refreshToken())); + } +} diff --git a/genti-api/src/main/java/com/gt/genti/auth/service/AuthService.java b/genti-api/src/main/java/com/gt/genti/auth/service/AuthService.java index 5a2a8a0a..bcd61ecc 100644 --- a/genti-api/src/main/java/com/gt/genti/auth/service/AuthService.java +++ b/genti-api/src/main/java/com/gt/genti/auth/service/AuthService.java @@ -9,8 +9,8 @@ import com.gt.genti.error.ExpectedException; import com.gt.genti.error.ResponseCode; import com.gt.genti.jwt.JwtTokenProvider; -import com.gt.genti.user.dto.request.SocialLoginRequest; -import com.gt.genti.user.dto.response.SocialLoginResponse; +import com.gt.genti.auth.dto.request.SocialLoginRequest; +import com.gt.genti.auth.dto.response.SocialLoginResponse; import com.gt.genti.user.model.OauthPlatform; import com.gt.genti.user.model.User; import com.gt.genti.user.repository.UserRepository; diff --git a/genti-api/src/main/java/com/gt/genti/user/dto/response/SocialLoginResponse.java b/genti-api/src/main/java/com/gt/genti/user/dto/response/SocialLoginResponse.java deleted file mode 100644 index b154b2d7..00000000 --- a/genti-api/src/main/java/com/gt/genti/user/dto/response/SocialLoginResponse.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.gt.genti.user.dto.response; - -import com.gt.genti.jwt.TokenResponse; - -public record SocialLoginResponse( - Long userId, - String userName, - boolean isNewUser, - TokenResponse token -) { - public static SocialLoginResponse of(Long userId, String userName, boolean isNewUser, TokenResponse token) { - return new SocialLoginResponse(userId, userName, isNewUser, TokenResponse.of(token.accessToken(), token.refreshToken())); - } -} diff --git a/genti-api/src/main/java/com/gt/genti/user/service/social/AppleOauthStrategy.java b/genti-api/src/main/java/com/gt/genti/user/service/social/AppleOauthStrategy.java index be6bffbc..0d234759 100644 --- a/genti-api/src/main/java/com/gt/genti/user/service/social/AppleOauthStrategy.java +++ b/genti-api/src/main/java/com/gt/genti/user/service/social/AppleOauthStrategy.java @@ -20,8 +20,8 @@ import com.gt.genti.openfeign.apple.service.AppleJwtParser; import com.gt.genti.openfeign.apple.service.AppleUserResponse; import com.gt.genti.openfeign.apple.service.PublicKeyGenerator; -import com.gt.genti.user.dto.request.SocialLoginRequest; -import com.gt.genti.user.dto.response.SocialLoginResponse; +import com.gt.genti.auth.dto.request.SocialLoginRequest; +import com.gt.genti.auth.dto.response.SocialLoginResponse; import com.gt.genti.user.model.OauthPlatform; import com.gt.genti.user.model.User; import com.gt.genti.user.repository.UserRepository; @@ -54,7 +54,7 @@ public SocialLoginResponse login(SocialLoginRequest request) { User newUser = userRepository.save(User.builderWithSignIn() .socialId(userResponse.getPlatformId()) .oauthPlatform(request.getOauthPlatform()) - .username(userResponse.getEmail()) + .username(null) .nickname(RandomUtil.generateRandomNickname()) .email(userResponse.getEmail()) .build()); @@ -72,7 +72,7 @@ public SocialLoginResponse login(SocialLoginRequest request) { .build(); TokenResponse token = new TokenResponse(jwtTokenProvider.generateAccessToken(tokenGenerateCommand), jwtTokenProvider.generateRefreshToken(tokenGenerateCommand)); - return SocialLoginResponse.of(user.getId(), user.getUsername(), isNewUser, token); + return SocialLoginResponse.of(user.getId(), user.getUsername(), user.getEmail(), isNewUser, token); } @Override diff --git a/genti-api/src/main/java/com/gt/genti/user/service/social/GoogleOauthStrategy.java b/genti-api/src/main/java/com/gt/genti/user/service/social/GoogleOauthStrategy.java index 1baf0e0d..32d5b9a1 100644 --- a/genti-api/src/main/java/com/gt/genti/user/service/social/GoogleOauthStrategy.java +++ b/genti-api/src/main/java/com/gt/genti/user/service/social/GoogleOauthStrategy.java @@ -19,8 +19,8 @@ import com.gt.genti.openfeign.google.client.GoogleAuthApiClient; import com.gt.genti.openfeign.google.dto.response.GoogleInfoResponse; import com.gt.genti.openfeign.google.dto.response.GoogleTokenResponse; -import com.gt.genti.user.dto.request.SocialLoginRequest; -import com.gt.genti.user.dto.response.SocialLoginResponse; +import com.gt.genti.auth.dto.request.SocialLoginRequest; +import com.gt.genti.auth.dto.response.SocialLoginResponse; import com.gt.genti.user.model.User; import com.gt.genti.user.repository.UserRepository; import com.gt.genti.user.service.UserSignUpEventPublisher; @@ -102,7 +102,7 @@ public SocialLoginResponse login(SocialLoginRequest request) { .build(); TokenResponse token = new TokenResponse(jwtTokenProvider.generateAccessToken(tokenGenerateCommand), jwtTokenProvider.generateRefreshToken(tokenGenerateCommand)); - return SocialLoginResponse.of(user.getId(), user.getUsername(), isNewUser, token); + return SocialLoginResponse.of(user.getId(), user.getUsername(), user.getEmail(), isNewUser, token); } @Override diff --git a/genti-api/src/main/java/com/gt/genti/user/service/social/KakaoOauthStrategy.java b/genti-api/src/main/java/com/gt/genti/user/service/social/KakaoOauthStrategy.java index 3dec3be2..894fb501 100644 --- a/genti-api/src/main/java/com/gt/genti/user/service/social/KakaoOauthStrategy.java +++ b/genti-api/src/main/java/com/gt/genti/user/service/social/KakaoOauthStrategy.java @@ -18,8 +18,8 @@ import com.gt.genti.openfeign.kakao.client.KakaoAuthApiClient; import com.gt.genti.openfeign.kakao.dto.response.KakaoTokenResponse; import com.gt.genti.openfeign.kakao.dto.response.KakaoUserResponse; -import com.gt.genti.user.dto.request.SocialLoginRequest; -import com.gt.genti.user.dto.response.SocialLoginResponse; +import com.gt.genti.auth.dto.request.SocialLoginRequest; +import com.gt.genti.auth.dto.response.SocialLoginResponse; import com.gt.genti.user.model.OauthPlatform; import com.gt.genti.user.model.User; import com.gt.genti.user.repository.UserRepository; @@ -85,7 +85,6 @@ public SocialLoginResponse login(SocialLoginRequest request) { .oauthPlatform(request.getOauthPlatform()) .username(userResponse.kakaoAccount().name()) .nickname(RandomUtil.generateRandomNickname()) - // .oauthImageUrl(userResponse.kakaoAccount().profile().profileImageUrl()) .email(userResponse.kakaoAccount().email()) .build()); user = newUser; @@ -102,7 +101,7 @@ public SocialLoginResponse login(SocialLoginRequest request) { .build(); TokenResponse token = new TokenResponse(jwtTokenProvider.generateAccessToken(tokenGenerateCommand), jwtTokenProvider.generateRefreshToken(tokenGenerateCommand)); - return SocialLoginResponse.of(user.getId(), user.getUsername(), isNewUser, token); + return SocialLoginResponse.of(user.getId(), user.getUsername(), user.getEmail(), isNewUser, token); } private static String getBirthDateStringFrom(KakaoUserResponse userResponse) { diff --git a/genti-api/src/main/java/com/gt/genti/user/service/social/SocialLoginStrategy.java b/genti-api/src/main/java/com/gt/genti/user/service/social/SocialLoginStrategy.java index 3378e6da..7e920b7e 100644 --- a/genti-api/src/main/java/com/gt/genti/user/service/social/SocialLoginStrategy.java +++ b/genti-api/src/main/java/com/gt/genti/user/service/social/SocialLoginStrategy.java @@ -1,7 +1,7 @@ package com.gt.genti.user.service.social; -import com.gt.genti.user.dto.request.SocialLoginRequest; -import com.gt.genti.user.dto.response.SocialLoginResponse; +import com.gt.genti.auth.dto.request.SocialLoginRequest; +import com.gt.genti.auth.dto.response.SocialLoginResponse; public interface SocialLoginStrategy { diff --git a/genti-api/src/main/java/com/gt/genti/user/service/social/SocialOauthContext.java b/genti-api/src/main/java/com/gt/genti/user/service/social/SocialOauthContext.java index 02285abc..9fc6952a 100644 --- a/genti-api/src/main/java/com/gt/genti/user/service/social/SocialOauthContext.java +++ b/genti-api/src/main/java/com/gt/genti/user/service/social/SocialOauthContext.java @@ -7,8 +7,8 @@ import com.gt.genti.error.ExpectedException; import com.gt.genti.error.ResponseCode; -import com.gt.genti.user.dto.request.SocialLoginRequest; -import com.gt.genti.user.dto.response.SocialLoginResponse; +import com.gt.genti.auth.dto.request.SocialLoginRequest; +import com.gt.genti.auth.dto.response.SocialLoginResponse; import com.gt.genti.user.model.OauthPlatform; import jakarta.annotation.PostConstruct; From 2218700f3b519f39fab92aa401b9c1bae31d0ee1 Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Mon, 15 Jul 2024 23:08:13 +0900 Subject: [PATCH 06/16] =?UTF-8?q?Fix:=20#42=20swagger=20Custom=20annotatio?= =?UTF-8?q?n=20=EB=AA=85=EC=84=B8=ED=99=94=20=EC=A4=91=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=A0=81=EC=9A=A9=EB=90=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EC=95=84=EC=84=9C=20=EC=A4=91=EB=B3=B5=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20=EB=B0=8F=20=ED=8C=A8=ED=82=A4=EC=A7=80=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/gt/genti/config/SwaggerConfig.java | 2 -- .../SwaggerEnumOperationCustomizer.java | 22 +++++++++---------- .../main/resources/application-common.yaml | 6 ++--- 3 files changed, 13 insertions(+), 17 deletions(-) rename genti-api/src/main/java/com/gt/genti/{swagger => config}/SwaggerEnumOperationCustomizer.java (89%) diff --git a/genti-api/src/main/java/com/gt/genti/config/SwaggerConfig.java b/genti-api/src/main/java/com/gt/genti/config/SwaggerConfig.java index 65459690..0aa78352 100644 --- a/genti-api/src/main/java/com/gt/genti/config/SwaggerConfig.java +++ b/genti-api/src/main/java/com/gt/genti/config/SwaggerConfig.java @@ -6,8 +6,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import com.gt.genti.swagger.SwaggerEnumOperationCustomizer; - import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Info; diff --git a/genti-api/src/main/java/com/gt/genti/swagger/SwaggerEnumOperationCustomizer.java b/genti-api/src/main/java/com/gt/genti/config/SwaggerEnumOperationCustomizer.java similarity index 89% rename from genti-api/src/main/java/com/gt/genti/swagger/SwaggerEnumOperationCustomizer.java rename to genti-api/src/main/java/com/gt/genti/config/SwaggerEnumOperationCustomizer.java index 30ad53c5..608a6851 100644 --- a/genti-api/src/main/java/com/gt/genti/swagger/SwaggerEnumOperationCustomizer.java +++ b/genti-api/src/main/java/com/gt/genti/config/SwaggerEnumOperationCustomizer.java @@ -1,5 +1,6 @@ -package com.gt.genti.swagger; +package com.gt.genti.config; +import static com.gt.genti.response.GentiResponse.*; import static org.springframework.util.MimeTypeUtils.*; import java.lang.reflect.ParameterizedType; @@ -14,8 +15,9 @@ import com.gt.genti.error.ExpectedException; import com.gt.genti.error.ResponseCode; -import com.gt.genti.response.GentiResponse; -import com.gt.genti.response.GentiResponse.ApiResult; +import com.gt.genti.swagger.EnumResponseGroup; +import com.gt.genti.swagger.EnumResponses; +import com.gt.genti.swagger.RequireImageUpload; import io.swagger.v3.core.converter.ModelConverters; import io.swagger.v3.oas.models.Operation; @@ -33,7 +35,7 @@ public class SwaggerEnumOperationCustomizer implements OperationCustomizer { @SuppressWarnings("rawtypes") private final Schema errorEntitySchema = ModelConverters.getInstance() - .readAllAsResolvedSchema(GentiResponse.ApiResult.class).schema; + .readAllAsResolvedSchema(ApiResult.class).schema; @Override public Operation customize(Operation operation, HandlerMethod handlerMethod) { @@ -88,7 +90,7 @@ private ApiResponse convertErrorResponse(ResponseCode code) { return convertResponseInner( errorEntitySchema.description(code.getErrorMessage()), code, - GentiResponse.error(code) + error(code) ); } @@ -104,14 +106,12 @@ private Schema customizeSchema(ResponseCode responseCode, Type dtoType) { Schema schema = ModelConverters.getInstance().readAllAsResolvedSchema(dtoType).schema; Map properties = schema.getProperties(); Boolean success = responseCode.isSuccess(); - Integer status = responseCode.getHttpStatusCode().value(); - String code = responseCode.getErrorCode(); - String message = responseCode.getErrorMessage(); + String errorCode = responseCode.getErrorCode(); + String errorMessage = responseCode.getErrorMessage(); properties.get("success").setDefault(success); - properties.get("status").setDefault(status); - properties.get("code").setDefault(code); - properties.get("message").setDefault(message); + properties.get("errorCode").setDefault(errorCode); + properties.get("errorMessage").setDefault(errorMessage); return schema; } diff --git a/genti-api/src/main/resources/application-common.yaml b/genti-api/src/main/resources/application-common.yaml index df389cea..0cac7c32 100644 --- a/genti-api/src/main/resources/application-common.yaml +++ b/genti-api/src/main/resources/application-common.yaml @@ -24,11 +24,10 @@ springdoc: display-request-duration: true defaultModelsExpandDepth: 2 defaultModelExpandDepth: 2 - path: /swagger-ui.html + path: /index.html url: /api-docs api-docs: path: /api-docs - show-actuator: true default-consumes-media-type: application/json default-produces-media-type: application/json writer-with-default-pretty-printer: true @@ -38,5 +37,4 @@ springdoc: show-login-endpoint: true paths-to-match: - /api/** - - / - packages-to-scan: com.gt.genti + - /login/** From 46d2fd80b90bbe77b928c636dfab98b3664f3c65 Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Mon, 15 Jul 2024 23:09:25 +0900 Subject: [PATCH 07/16] =?UTF-8?q?Rename:=20#31=20=EB=A7=A4=EA=B0=9C?= =?UTF-8?q?=EB=B3=80=EC=88=98=EB=8A=94=20User=EB=A1=9C=20=EC=A3=BC?= =?UTF-8?q?=EB=8A=94=EB=8D=B0=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EB=84=A4?= =?UTF-8?q?=EC=9D=B4=EB=B0=8D=EC=9D=B4=20byUserId=EC=98=80=EC=9D=8C,=20byU?= =?UTF-8?q?ser=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/PictureGenerateRequestRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/genti-domain/src/main/java/com/gt/genti/picturegeneraterequest/repository/PictureGenerateRequestRepository.java b/genti-domain/src/main/java/com/gt/genti/picturegeneraterequest/repository/PictureGenerateRequestRepository.java index fd588f53..e42c609e 100644 --- a/genti-domain/src/main/java/com/gt/genti/picturegeneraterequest/repository/PictureGenerateRequestRepository.java +++ b/genti-domain/src/main/java/com/gt/genti/picturegeneraterequest/repository/PictureGenerateRequestRepository.java @@ -27,7 +27,7 @@ public interface PictureGenerateRequestRepository + "where pqr.requester = :requester and " + "pqr.pictureGenerateRequestStatus = :requestStatus " + "order by pqr.createdAt desc") - List findByRequestStatusAndUserId(PictureGenerateRequestStatus requestStatus, + List findByRequestStatusAndUser(PictureGenerateRequestStatus requestStatus, User requester); List findAllByRequester(User requester); From c61a1ed1a33f1d3a59616825a6a74e1fdaa84979 Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Tue, 16 Jul 2024 01:07:55 +0900 Subject: [PATCH 08/16] =?UTF-8?q?Fix:=20#44=20#45=20Controller=20=EB=A7=A4?= =?UTF-8?q?=EA=B0=9C=EB=B3=80=EC=88=98=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CreatorPGREQController.java | 12 ++--- .../controller/UserPGREQController.java | 45 ++++-------------- .../controller/AdminPGRESController.java | 10 ++-- .../controller/CreatorPGRESController.java | 6 +-- .../controller/UserPGRESController.java | 47 +++++++++++++++++++ .../user/controller/AdminUserController.java | 6 ++- .../AdminWithdrawRequestController.java | 8 ++-- 7 files changed, 78 insertions(+), 56 deletions(-) create mode 100644 genti-api/src/main/java/com/gt/genti/picturegenerateresponse/controller/UserPGRESController.java diff --git a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/controller/CreatorPGREQController.java b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/controller/CreatorPGREQController.java index b95f2565..f0e276c7 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/controller/CreatorPGREQController.java +++ b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/controller/CreatorPGREQController.java @@ -9,20 +9,20 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import com.gt.genti.error.ResponseCode; import com.gt.genti.model.LogAction; import com.gt.genti.model.LogItem; import com.gt.genti.model.LogRequester; import com.gt.genti.model.Logging; -import com.gt.genti.picturegeneraterequest.model.PictureGenerateRequestStatus; -import com.gt.genti.user.model.AuthUser; -import com.gt.genti.error.ResponseCode; import com.gt.genti.picturegeneraterequest.dto.response.PGREQBriefFindByCreatorResponseDto; import com.gt.genti.picturegeneraterequest.dto.response.PGREQDetailFindByAdminResponseDto; +import com.gt.genti.picturegeneraterequest.model.PictureGenerateRequestStatus; import com.gt.genti.picturegenerateresponse.service.PictureGenerateWorkService; import com.gt.genti.response.GentiResponse; import com.gt.genti.response.GentiResponse.ApiResult; import com.gt.genti.swagger.EnumResponse; import com.gt.genti.swagger.EnumResponses; +import com.gt.genti.user.model.AuthUser; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -63,7 +63,7 @@ public ResponseEntity> getAssigned public ResponseEntity> acceptPictureGenerateRequest( @AuthUser Long userId, @Parameter(description = "수락할 사진생성요청의 id", example = "1") - @PathVariable Long pictureGenerateRequestId) { + @PathVariable(value = "pictureGenerateRequestId") Long pictureGenerateRequestId) { return GentiResponse.success( pictureGenerateWorkService.acceptPictureGenerateRequest(userId, pictureGenerateRequestId)); } @@ -80,7 +80,7 @@ public ResponseEntity> acceptPictureGenerateRequest( public ResponseEntity> rejectPictureGenerateRequest( @AuthUser Long userId, @Parameter(description = "거절할 사진생성요청의 id", example = "1") - @PathVariable Long pictureGenerateRequestId) { + @PathVariable(value = "pictureGenerateRequestId") Long pictureGenerateRequestId) { return GentiResponse.success( pictureGenerateWorkService.rejectPictureGenerateRequest(userId, pictureGenerateRequestId)); } @@ -121,7 +121,7 @@ public ResponseEntity>> getAss public ResponseEntity> getPictureGenerateRequestDetail( @AuthUser Long userId, @Parameter(description = "조회할 사진생성요청의 id", example = "1") - @PathVariable Long pictureGenerateRequestId) { + @PathVariable(value = "pictureGenerateRequestId") Long pictureGenerateRequestId) { return GentiResponse.success(pictureGenerateWorkService.getPictureGenerateRequestDetail( userId, pictureGenerateRequestId)); } diff --git a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/controller/UserPGREQController.java b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/controller/UserPGREQController.java index 717cf0e0..9fbd5bd2 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/controller/UserPGREQController.java +++ b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/controller/UserPGREQController.java @@ -11,13 +11,11 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import com.gt.genti.error.ResponseCode; import com.gt.genti.model.LogAction; import com.gt.genti.model.LogItem; import com.gt.genti.model.LogRequester; import com.gt.genti.model.Logging; -import com.gt.genti.picturegeneraterequest.model.PictureGenerateRequestStatus; -import com.gt.genti.user.model.AuthUser; -import com.gt.genti.error.ResponseCode; import com.gt.genti.picturegeneraterequest.dto.request.PGREQSaveRequestDto; import com.gt.genti.picturegeneraterequest.dto.response.PGREQBriefFindByUserResponseDto; import com.gt.genti.picturegeneraterequest.dto.response.PGREQDetailFindByUserResponseDto; @@ -27,8 +25,10 @@ import com.gt.genti.swagger.EnumResponse; import com.gt.genti.swagger.EnumResponses; import com.gt.genti.usecase.PictureGenerateRequestUseCase; +import com.gt.genti.user.model.AuthUser; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; @@ -41,6 +41,7 @@ public class UserPGREQController { private final PictureGenerateRequestUseCase pictureGenerateRequestUseCase; + @Deprecated @Operation(summary = "내 요청 전체조회", description = "내가 요청한 사진생성요청 전체 조회", deprecated = true) @EnumResponses(value = { @EnumResponse(ResponseCode.OK) @@ -61,26 +62,11 @@ public ResponseEntity>> getAllUs }) @Logging(item = LogItem.PGREQ_INPROGESS, action = LogAction.SEARCH, requester = LogRequester.USER) @GetMapping("/pending") - public ResponseEntity> hasPendingRequests( + public ResponseEntity> getPendingPGRESStatus( @AuthUser Long userId ) { return GentiResponse.success( - pictureGenerateRequestUseCase.getPGREQStatusIfPendingExists(userId)); - } - - @Operation(summary = "완료되었지만 아직 확인하지 않은 요청 조회", description = "작업이 완료되어 유저가 최종확인해야하는 사진생성요청 결과(완성된사진)을 조회한다.") - @EnumResponses(value = { - @EnumResponse(ResponseCode.OK), - @EnumResponse(ResponseCode.PictureGenerateRequestNotFound) - }) - @Logging(item = LogItem.PGREQ_COMPLETED, action = LogAction.SEARCH, requester = LogRequester.USER) - @GetMapping("/not-verified-yet") - public ResponseEntity> findNotVerifiedCompletedPGREQ( - @AuthUser Long userId - ) { - return GentiResponse.success( - pictureGenerateRequestUseCase.getByRequesterAndStatusIs(userId, - PictureGenerateRequestStatus.AWAIT_USER_VERIFICATION)); + pictureGenerateRequestUseCase.getPendingPGREQStatusIfExists(userId)); } @Deprecated @@ -93,27 +79,14 @@ public ResponseEntity> findNotVerifie @Logging(item = LogItem.PGREQ, action = LogAction.SEARCH, requester = LogRequester.USER) @GetMapping("/{pictureGenerateRequestId}") public ResponseEntity> getPictureGenerateRequestDetail( - @PathVariable - @Schema(description = "사진생성요청id", example = "1") + @Parameter(description = "사진생성요청id", example = "1") + @PathVariable(value = "pictureGenerateRequestId") Long pictureGenerateRequestId, @AuthUser Long userId) { return GentiResponse.success( pictureGenerateRequestUseCase.findPGREQByRequestAndId(userId, pictureGenerateRequestId)); } - @Operation(summary = "완성된 사진 확인", description = "완성된 사진을 최종 확인") - @EnumResponses(value = { - @EnumResponse(ResponseCode.OK) - }) - @Logging(item = LogItem.PGREQ_COMPLETED, action = LogAction.COMPLETE, requester = LogRequester.USER) - @PostMapping("/{pictureGenerateRequestId}/verify") - public ResponseEntity> verifyCompletedPGREQ( - @AuthUser Long userId, - @PathVariable(name = "pictureGenerateRequestId") Long pictureGenerateRequestId) { - return GentiResponse.success(pictureGenerateRequestUseCase.verifyCompletedPGREQ(userId, - pictureGenerateRequestId)); - } - @Operation(summary = "사진생성요청하기", description = "사진생성요청을 생성한다.") @EnumResponses(value = { @EnumResponse(ResponseCode.OK) @@ -139,7 +112,7 @@ public ResponseEntity> createPictureGenerateRequest( @PutMapping("/{pictureGenerateRequestId}") public ResponseEntity> modifyPictureGenerateRequest( @AuthUser Long userId, - @PathVariable + @PathVariable(value = "pictureGenerateRequestId") @Schema(description = "사진생성요청id", example = "1") Long pictureGenerateRequestId, @RequestBody @Valid PGREQSaveRequestDto pgreqSaveRequestDto) { diff --git a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/controller/AdminPGRESController.java b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/controller/AdminPGRESController.java index 544e2179..1cac6c12 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/controller/AdminPGRESController.java +++ b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/controller/AdminPGRESController.java @@ -11,12 +11,11 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import com.gt.genti.error.ResponseCode; import com.gt.genti.model.LogAction; import com.gt.genti.model.LogItem; import com.gt.genti.model.LogRequester; import com.gt.genti.model.Logging; -import com.gt.genti.user.model.AuthUser; -import com.gt.genti.error.ResponseCode; import com.gt.genti.picture.dto.request.CommonPictureKeyUpdateRequestDto; import com.gt.genti.picture.dto.response.CommonPictureResponseDto; import com.gt.genti.picturegenerateresponse.dto.request.PGRESUpdateAdminInChargeRequestDto; @@ -26,6 +25,7 @@ import com.gt.genti.swagger.EnumResponse; import com.gt.genti.swagger.EnumResponses; import com.gt.genti.swagger.RequireImageUpload; +import com.gt.genti.user.model.AuthUser; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -48,7 +48,7 @@ public class AdminPGRESController { @PostMapping("/{pictureGenerateResponseId}/submit") public ResponseEntity> submit( @Parameter(description = "사진생성응답 Id", example = "1", required = true) - @PathVariable Long pictureGenerateResponseId) { + @PathVariable(value = "pictureGenerateResponseId") Long pictureGenerateResponseId) { return success(pictureGenerateWorkService.submitFinal(pictureGenerateResponseId)); } @@ -63,7 +63,7 @@ public ResponseEntity>> updatePictureLi @AuthUser Long userId, @Parameter(description = "업로드한 사진 url 리스트", required = true) @RequestBody @Valid List<@Valid CommonPictureKeyUpdateRequestDto> reuqestDtoList, - @PathVariable Long pictureGenerateResponseId) { + @PathVariable(value = "pictureGenerateResponseId") Long pictureGenerateResponseId) { return success( pictureGenerateWorkService.updatePictureListCreatedByAdmin(userId, reuqestDtoList, pictureGenerateResponseId)); @@ -76,7 +76,7 @@ public ResponseEntity>> updatePictureLi @Logging(item = LogItem.PGRES_ASSIGNEE, action = LogAction.UPDATE, requester = LogRequester.ADMIN) @PostMapping("/{pictureGenerateResponseId}/admin-in-charge") public ResponseEntity> updateAdminInCharge( - @PathVariable Long pictureGenerateResponseId, + @PathVariable(value = "pictureGenerateResponseId") Long pictureGenerateResponseId, @RequestBody PGRESUpdateAdminInChargeRequestDto requestDto) { return success(pictureGenerateWorkService.updateAdminInCharge(pictureGenerateResponseId, requestDto)); } diff --git a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/controller/CreatorPGRESController.java b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/controller/CreatorPGRESController.java index 669c42ba..b8f01d5c 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/controller/CreatorPGRESController.java +++ b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/controller/CreatorPGRESController.java @@ -50,7 +50,7 @@ public class CreatorPGRESController { public ResponseEntity> updatePictureUrl( @AuthUser Long userId, @Parameter(description = "사진 url을 업데이트할 사진생성응답 Id", example = "1") - @PathVariable Long pictureGenerateResponseId, + @PathVariable(value = "pictureGenerateResponseId") Long pictureGenerateResponseId, @RequestBody @Valid List<@Valid CommonPictureKeyUpdateRequestDto> commonPictureKeyUpdateRequestDtoList ) { return success( @@ -71,7 +71,7 @@ public ResponseEntity> updatePictureUrl( public ResponseEntity> submitPictureGenerateResponse( @AuthUser Long userId, @Parameter(description = "제출할 사진생성응답 Id", example = "1") - @PathVariable Long pictureGenerateResponseId) { + @PathVariable(value = "pictureGenerateResponseId") Long pictureGenerateResponseId) { return success( pictureGenerateWorkService.submitToAdmin(userId, pictureGenerateResponseId)); } @@ -85,7 +85,7 @@ public ResponseEntity> submitPictureG @PostMapping("/{pictureGenerateResponseId}/memo") public ResponseEntity> updateMemo( @Parameter(description = "메모를 수정할 사진생성응답 Id", example = "1") - @PathVariable Long pictureGenerateResponseId, + @PathVariable(value = "pictureGenerateResponseId") Long pictureGenerateResponseId, @RequestBody @Valid MemoUpdateRequestDto memoUpdateRequestDto) { return success(pictureGenerateWorkService.updateMemo(pictureGenerateResponseId, memoUpdateRequestDto)); } diff --git a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/controller/UserPGRESController.java b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/controller/UserPGRESController.java new file mode 100644 index 00000000..ddf0fdd1 --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/controller/UserPGRESController.java @@ -0,0 +1,47 @@ +package com.gt.genti.picturegenerateresponse.controller; + +import static com.gt.genti.response.GentiResponse.*; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.gt.genti.error.ResponseCode; +import com.gt.genti.model.LogAction; +import com.gt.genti.model.LogItem; +import com.gt.genti.model.LogRequester; +import com.gt.genti.model.Logging; +import com.gt.genti.picturegenerateresponse.service.PictureGenerateWorkService; +import com.gt.genti.response.GentiResponse; +import com.gt.genti.swagger.EnumResponse; +import com.gt.genti.swagger.EnumResponses; +import com.gt.genti.user.model.AuthUser; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; + +@Tag(name = "[UserPGRESController] 유저의 요청에 의한 사진생성응답", description = "사진 생성 응답을 조회합니다.") +@RestController +@RequestMapping("/api/v1/users/picture-generate-responses") +@RequiredArgsConstructor +public class UserPGRESController { + private final PictureGenerateWorkService pictureGenerateWorkService; + + @Operation(summary = "완성된 사진 확인", description = "완성된 사진을 최종 확인") + @EnumResponses(value = { + @EnumResponse(ResponseCode.OK) + }) + @Logging(item = LogItem.PGRES_VERIFY, action = LogAction.COMPLETE, requester = LogRequester.USER) + @PostMapping("/{pictureGenerateResponseId}/verify") + public ResponseEntity> verifyCompletedPGREQ( + @AuthUser Long userId, + @Parameter(example = "1", description = "사용자가 확인완료처리하고싶은 최종 사진이 포함된 '사진생성응답'의 id 값") + @PathVariable(value = "pictureGenerateResponseId") Long pictureGenerateResponseId) { + return GentiResponse.success(pictureGenerateWorkService.verifyPGRES(userId, + pictureGenerateResponseId)); + } +} diff --git a/genti-api/src/main/java/com/gt/genti/user/controller/AdminUserController.java b/genti-api/src/main/java/com/gt/genti/user/controller/AdminUserController.java index d66b35d0..197730f1 100644 --- a/genti-api/src/main/java/com/gt/genti/user/controller/AdminUserController.java +++ b/genti-api/src/main/java/com/gt/genti/user/controller/AdminUserController.java @@ -46,7 +46,8 @@ public class AdminUserController { @EnumResponse(ResponseCode.OK) }) @PostMapping("/users/{userId}/status") - public ResponseEntity> changeUserStatus(@PathVariable Long userId, + public ResponseEntity> changeUserStatus( + @PathVariable(value = "userId") Long userId, @RequestBody @Valid UserStatusUpdateRequestDto userStatusUpdateRequestDto) { return success(userService.updateUserStatus(userId, userStatusUpdateRequestDto)); } @@ -56,7 +57,8 @@ public ResponseEntity> changeUserStatus(@PathVariable Long us @EnumResponse(ResponseCode.OK) }) @PostMapping("/users/{userId}/role") - public ResponseEntity> changeUserRole(@PathVariable Long userId, + public ResponseEntity> changeUserRole( + @PathVariable(value = "userId") Long userId, @RequestBody @Valid UserRoleUpdateRequestDto userRoleUpdateRequestDto) { return success(userService.updateUserRole(userId, userRoleUpdateRequestDto)); } diff --git a/genti-api/src/main/java/com/gt/genti/withdraw/controller/AdminWithdrawRequestController.java b/genti-api/src/main/java/com/gt/genti/withdraw/controller/AdminWithdrawRequestController.java index 843834ec..d44f5851 100644 --- a/genti-api/src/main/java/com/gt/genti/withdraw/controller/AdminWithdrawRequestController.java +++ b/genti-api/src/main/java/com/gt/genti/withdraw/controller/AdminWithdrawRequestController.java @@ -14,9 +14,6 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import com.gt.genti.withdraw.dto.response.WithdrawCompletionResponseDto; -import com.gt.genti.withdraw.dto.response.WithdrawFindByAdminResponseDto; -import com.gt.genti.withdraw.service.WithdrawService; import com.gt.genti.error.ResponseCode; import com.gt.genti.model.LogAction; import com.gt.genti.model.LogItem; @@ -26,6 +23,9 @@ import com.gt.genti.swagger.EnumResponses; import com.gt.genti.user.model.AuthUser; import com.gt.genti.validator.ValidEnum; +import com.gt.genti.withdraw.dto.response.WithdrawCompletionResponseDto; +import com.gt.genti.withdraw.dto.response.WithdrawFindByAdminResponseDto; +import com.gt.genti.withdraw.service.WithdrawService; import com.gt.genti.withdrawrequest.model.WithdrawRequestStatus; import io.swagger.v3.oas.annotations.Operation; @@ -80,7 +80,7 @@ public ResponseEntity>> getAllWit @PostMapping("/{withdrawRequestId}") public ResponseEntity> complete( @Parameter(description = "출금요청 Id", example = "1") - @PathVariable(name = "withdrawRequestId") Long withdrawRequestId, + @PathVariable(value = "withdrawRequestId") Long withdrawRequestId, @AuthUser Long userId ) { return success(withDrawService.complete(withdrawRequestId, userId)); From 9374bb49ef7494c057c2f3f4c3cd45f092bcc12a Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Tue, 16 Jul 2024 01:08:04 +0900 Subject: [PATCH 09/16] =?UTF-8?q?Fix:=20#44=20#45=20Controller=20=EB=A7=A4?= =?UTF-8?q?=EA=B0=9C=EB=B3=80=EC=88=98=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/gt/genti/post/controller/PostController.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/genti-api/src/main/java/com/gt/genti/post/controller/PostController.java b/genti-api/src/main/java/com/gt/genti/post/controller/PostController.java index bb30131b..154c5bcf 100644 --- a/genti-api/src/main/java/com/gt/genti/post/controller/PostController.java +++ b/genti-api/src/main/java/com/gt/genti/post/controller/PostController.java @@ -37,7 +37,6 @@ public class PostController { @GetMapping("/detail") public ResponseEntity>> getAllPostsDetailPagination( @RequestParam(value = "cursor", required = false) Long cursor) { - return GentiResponse.success(postService.getPostDetailAllPagination(cursor)); } @@ -58,7 +57,7 @@ public ResponseEntity>> getMyAllPostsDetai }) @GetMapping("/detail/users/{userId}") public ResponseEntity>> getUsersAllPostsDetailPagination( - @PathVariable(name = "userId") Long userId, + @PathVariable(value = "userId") Long userId, @RequestParam(value = "cursor", required = false) Long cursor) { return GentiResponse.success(postService.getPostDetailAllByUserIdPagination(userId, cursor)); } @@ -69,7 +68,7 @@ public ResponseEntity>> getUsersAllPostsDe @Deprecated @GetMapping("/brief/users/{userId}") public ResponseEntity>> getUsersAllPostBrief( - @PathVariable(name = "userId") Long userId) { + @PathVariable(value = "userId") Long userId) { return GentiResponse.success(postService.getPostBriefAllByUserId(userId)); } From 34f2cc404284279a7f10ca75f0f7cfa3d1db1f29 Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Tue, 16 Jul 2024 01:09:27 +0900 Subject: [PATCH 10/16] =?UTF-8?q?Fix:=20=EB=A7=A4=EA=B0=9C=EB=B3=80?= =?UTF-8?q?=EC=88=98=EB=A1=9C=EB=8A=94=20User=EB=A5=BC=20=EB=84=98?= =?UTF-8?q?=EA=B2=A8=EC=A3=BC=EB=A9=B4=EC=84=9C=20findByUserId=20=EB=9D=BC?= =?UTF-8?q?=EA=B3=A0=20=EB=90=98=EC=96=B4=EC=9E=88=EC=97=88=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter/PictureGenerateRequestPersistenceAdapter.java | 2 +- .../repository/PictureGenerateRequestRepository.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/adapter/PictureGenerateRequestPersistenceAdapter.java b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/adapter/PictureGenerateRequestPersistenceAdapter.java index 27d1ad8a..b06bacb5 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/adapter/PictureGenerateRequestPersistenceAdapter.java +++ b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/adapter/PictureGenerateRequestPersistenceAdapter.java @@ -45,7 +45,7 @@ public PictureGenerateRequest save(PictureGenerateRequest pictureGenerateRequest @Override public Optional findByUserAndStatusInOrderByCreatedByDesc(User user, List statusList) { - return pictureGenerateRequestRepository.findByUserIdAndRequestStatusIn(user, statusList); + return pictureGenerateRequestRepository.findByUserAndRequestStatusIn(user, statusList); } @Override diff --git a/genti-domain/src/main/java/com/gt/genti/picturegeneraterequest/repository/PictureGenerateRequestRepository.java b/genti-domain/src/main/java/com/gt/genti/picturegeneraterequest/repository/PictureGenerateRequestRepository.java index e42c609e..2341bd0b 100644 --- a/genti-domain/src/main/java/com/gt/genti/picturegeneraterequest/repository/PictureGenerateRequestRepository.java +++ b/genti-domain/src/main/java/com/gt/genti/picturegeneraterequest/repository/PictureGenerateRequestRepository.java @@ -8,6 +8,7 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import com.gt.genti.creator.model.Creator; @@ -17,7 +18,6 @@ import com.gt.genti.picturegenerateresponse.model.PictureGenerateResponseStatus; import com.gt.genti.user.model.User; - @Repository public interface PictureGenerateRequestRepository extends JpaRepository { @@ -68,8 +68,9 @@ Optional findByStatusOrderByCreatedAtDesc(Creator creato + "and pgr.pictureGenerateRequestStatus in :statusList " + "order by pgr.createdAt desc " + "limit 1 ") - Optional findByUserIdAndRequestStatusIn(User requester, - List statusList); + Optional findByUserAndRequestStatusIn( + @Param(value = "requester") User requester, + @Param(value = "statusList") List statusList); //TODO 성능 이슈 때문에 dto를 select하도록 변경해야함 // edited at 2024-05-23 From 1773286db5399435ca24ea416d2c6a8ba933d2c1 Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Tue, 16 Jul 2024 01:15:57 +0900 Subject: [PATCH 11/16] =?UTF-8?q?Feat:=20#31=20Del:=20=EB=AF=B8=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=20api=20=EB=B0=8F=20dto=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UserPGREQController.java | 20 ---- .../PGREQDetailFindByUserResponseDto.java | 69 -------------- .../dto/response/PGREQStatusResponseDto.java | 22 +++-- .../PictureGenerateRequestStatusForUser.java | 26 ++++++ .../PictureGenerateRequestService.java | 92 +++++++------------ .../service/PictureGenerateWorkService.java | 20 +++- .../PictureGenerateRequestUseCase.java | 20 ++-- .../model/PictureGenerateResponse.java | 4 + 8 files changed, 101 insertions(+), 172 deletions(-) delete mode 100644 genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQDetailFindByUserResponseDto.java create mode 100644 genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PictureGenerateRequestStatusForUser.java diff --git a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/controller/UserPGREQController.java b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/controller/UserPGREQController.java index 9fbd5bd2..b3bcd48c 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/controller/UserPGREQController.java +++ b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/controller/UserPGREQController.java @@ -18,7 +18,6 @@ import com.gt.genti.model.Logging; import com.gt.genti.picturegeneraterequest.dto.request.PGREQSaveRequestDto; import com.gt.genti.picturegeneraterequest.dto.response.PGREQBriefFindByUserResponseDto; -import com.gt.genti.picturegeneraterequest.dto.response.PGREQDetailFindByUserResponseDto; import com.gt.genti.picturegeneraterequest.dto.response.PGREQStatusResponseDto; import com.gt.genti.response.GentiResponse; import com.gt.genti.response.GentiResponse.ApiResult; @@ -28,7 +27,6 @@ import com.gt.genti.user.model.AuthUser; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; @@ -69,24 +67,6 @@ public ResponseEntity> getPendingPGRESStatus( pictureGenerateRequestUseCase.getPendingPGREQStatusIfExists(userId)); } - @Deprecated - @Operation(summary = "내 요청 조회", description = "내가 요청한 사진생성요청을 자세히 조회한다.") - @EnumResponses(value = { - @EnumResponse(ResponseCode.OK), - @EnumResponse(ResponseCode.PictureGenerateRequestNotFound), - @EnumResponse(ResponseCode.OnlyRequesterCanViewPictureGenerateRequest) - }) - @Logging(item = LogItem.PGREQ, action = LogAction.SEARCH, requester = LogRequester.USER) - @GetMapping("/{pictureGenerateRequestId}") - public ResponseEntity> getPictureGenerateRequestDetail( - @Parameter(description = "사진생성요청id", example = "1") - @PathVariable(value = "pictureGenerateRequestId") - Long pictureGenerateRequestId, - @AuthUser Long userId) { - return GentiResponse.success( - pictureGenerateRequestUseCase.findPGREQByRequestAndId(userId, pictureGenerateRequestId)); - } - @Operation(summary = "사진생성요청하기", description = "사진생성요청을 생성한다.") @EnumResponses(value = { @EnumResponse(ResponseCode.OK) diff --git a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQDetailFindByUserResponseDto.java b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQDetailFindByUserResponseDto.java deleted file mode 100644 index 34875355..00000000 --- a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQDetailFindByUserResponseDto.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.gt.genti.picturegeneraterequest.dto.response; - -import java.time.LocalDateTime; -import java.util.List; - -import com.gt.genti.picture.dto.response.CommonPictureResponseDto; -import com.gt.genti.picturegeneraterequest.model.CameraAngle; -import com.gt.genti.picturegeneraterequest.model.PictureGenerateRequest; -import com.gt.genti.picturegeneraterequest.model.PictureGenerateRequestStatus; -import com.gt.genti.picturegeneraterequest.model.ShotCoverage; -import com.gt.genti.picturegenerateresponse.dto.response.PGRESFindByUserResponseDto; -import com.gt.genti.picturegenerateresponse.model.PictureGenerateResponseStatus; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Getter; -import lombok.NoArgsConstructor; - -@Deprecated -@Schema(name = "[PGREQ][User] 사진생성요청 조회 by 사용자 응답 dto", deprecated = true) -@Getter -@NoArgsConstructor -public class PGREQDetailFindByUserResponseDto { - - @Schema(description = "사진생성요청 Id", example = "1") - Long id; - @Schema(description = "프롬프트", example = "벚꽃길에서 벤치에 앉아있어요") - String prompt; - @Schema(description = "유저의 얼굴사진 3개") - List facePictureList; - - @Schema(description = "포즈사진 응답") - CommonPictureResponseDto posePicture; - @Schema(description = "내가 요청했던 앵글") - CameraAngle cameraAngle; - @Schema(description = "내가 요청했던 프레임") - ShotCoverage shotCoverage; - @Schema(description = "현재 내 요청의 진행 상태") - PictureGenerateRequestStatus requestStatus; - @Schema(description = "생성일시") - LocalDateTime createdAt; - @Schema(description = "사진생성응답 dto") - PGRESFindByUserResponseDto pictureGenerateResponse; - - public PGREQDetailFindByUserResponseDto(PictureGenerateRequest pictureGenerateRequest) { - this.id = pictureGenerateRequest.getId(); - this.prompt = pictureGenerateRequest.getPrompt(); - if (!pictureGenerateRequest.getUserFacePictureList().isEmpty()) { - this.facePictureList = pictureGenerateRequest.getUserFacePictureList() - .stream() - .map(CommonPictureResponseDto::of) - .toList(); - } - - this.posePicture = CommonPictureResponseDto.of(pictureGenerateRequest.getPicturePose()); - this.cameraAngle = pictureGenerateRequest.getCameraAngle(); - this.shotCoverage = pictureGenerateRequest.getShotCoverage(); - this.requestStatus = pictureGenerateRequest.getPictureGenerateRequestStatus(); - this.createdAt = pictureGenerateRequest.getCreatedAt(); - - pictureGenerateRequest.getResponseList() - .stream() - .filter(response -> - response.getStatus() == PictureGenerateResponseStatus.SUBMITTED_FINAL - || response.getStatus() == PictureGenerateResponseStatus.COMPLETED) - .min((res1, res2) -> res2.getModifiedAt().compareTo(res1.getModifiedAt())) - .ifPresent(generateResponse -> - this.pictureGenerateResponse = new PGRESFindByUserResponseDto(generateResponse)); - } -} diff --git a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQStatusResponseDto.java b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQStatusResponseDto.java index 4f1c2bd7..73e2b460 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQStatusResponseDto.java +++ b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PGREQStatusResponseDto.java @@ -1,28 +1,34 @@ package com.gt.genti.picturegeneraterequest.dto.response; -import com.gt.genti.picturegeneraterequest.model.PictureGenerateRequestStatus; +import com.gt.genti.picturegenerateresponse.dto.response.PGRESFindByUserResponseDto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -@Schema(name = "[PGREQ][User] 사진생성요청 상태 조회 by 사용자 응답 dto") +@Schema(name = "[PGREQ][User] 사진생성요청 상태 및 사진생성응답 조회 by 사용자 응답 dto") @Getter @NoArgsConstructor public class PGREQStatusResponseDto { @Schema(description = "사진생성요청Id", example = "1") Long pictureGenerateRequestId; + @Schema(description = "" + - "사진생성요청진행상태 " + "
" + - "진행중 : IN_PROGRESS, ASSIGNING, CREATED" + "
" + - "완성되었지만 유저가 확인하지 않음(완성된 사진 조회를 요청해야하는경우) : AWAIT_USER_VERIFICATION" + "
" + - "유저가 확인한 완성된 상태 : COMPLETED") - PictureGenerateRequestStatus status; + "User에게 공개되는 status는 아래 3가지입니다. " + "
" + + "IN_PROGRESS : 작업이 진행 중" + "
" + + "AWAIT_USER_VERIFICATION : 완료되었고, 사용자가 확인한 적이 없어 확인을 필요로 함" + "
" + + "COMPLETED : 완료되었고, 사용자가 이미 확인함") + PictureGenerateRequestStatusForUser status; + + @Schema(description = "사진생성응답 객체, status 값이 AWAIT_USER_VERIFICATION 가 아니면 null", example = "1", nullable = true) + PGRESFindByUserResponseDto pictureGenerateResponse; @Builder - public PGREQStatusResponseDto(Long pictureGenerateRequestId, PictureGenerateRequestStatus status) { + public PGREQStatusResponseDto(Long pictureGenerateRequestId, PictureGenerateRequestStatusForUser status, + PGRESFindByUserResponseDto pgresFindByUserResponseDto) { this.pictureGenerateRequestId = pictureGenerateRequestId; this.status = status; + this.pictureGenerateResponse = pgresFindByUserResponseDto; } } diff --git a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PictureGenerateRequestStatusForUser.java b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PictureGenerateRequestStatusForUser.java new file mode 100644 index 00000000..6b75266c --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/dto/response/PictureGenerateRequestStatusForUser.java @@ -0,0 +1,26 @@ +package com.gt.genti.picturegeneraterequest.dto.response; + +import com.gt.genti.common.ConvertableEnum; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum PictureGenerateRequestStatusForUser implements ConvertableEnum { + IN_PROGRESS("IN_PROGRESS"), + AWAIT_USER_VERIFICATION("AWAIT_USER_VERIFICATION"), + COMPLETED("COMPLETED"); + + private final String stringValue; + + @Override + public String getResponse() { + return stringValue; + } + + @Override + public & ConvertableEnum> E getNullValue() { + return null; + } +} diff --git a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/service/PictureGenerateRequestService.java b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/service/PictureGenerateRequestService.java index 6f465b3d..537fee96 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/service/PictureGenerateRequestService.java +++ b/genti-api/src/main/java/com/gt/genti/picturegeneraterequest/service/PictureGenerateRequestService.java @@ -1,6 +1,7 @@ package com.gt.genti.picturegeneraterequest.service; import static com.gt.genti.common.EnumUtil.*; +import static com.gt.genti.picturegeneraterequest.dto.response.PictureGenerateRequestStatusForUser.*; import java.util.List; import java.util.Objects; @@ -13,14 +14,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import com.gt.genti.picturegeneraterequest.model.PictureGenerateRequestStatus; -import com.gt.genti.picturegenerateresponse.model.PictureGenerateResponseStatus; -import com.gt.genti.picture.pose.model.PicturePose; -import com.gt.genti.picture.userface.model.PictureUserFace; -import com.gt.genti.picturegeneraterequest.model.PictureGenerateRequest; -import com.gt.genti.picturegenerateresponse.model.PictureGenerateResponse; -import com.gt.genti.user.model.User; -import com.gt.genti.user.repository.UserRepository; import com.gt.genti.error.ExpectedException; import com.gt.genti.error.ResponseCode; import com.gt.genti.openai.dto.PromptAdvancementRequestCommand; @@ -28,16 +21,25 @@ import com.gt.genti.picture.command.CreatePicturePoseCommand; import com.gt.genti.picture.dto.request.CommonPictureKeyUpdateRequestDto; import com.gt.genti.picture.dto.response.CommonPictureResponseDto; +import com.gt.genti.picture.pose.model.PicturePose; import com.gt.genti.picture.service.PictureService; +import com.gt.genti.picture.userface.model.PictureUserFace; import com.gt.genti.picturegeneraterequest.command.PGREQSaveCommand; import com.gt.genti.picturegeneraterequest.dto.request.PGREQSaveRequestDto; import com.gt.genti.picturegeneraterequest.dto.response.PGREQBriefFindByUserResponseDto; import com.gt.genti.picturegeneraterequest.dto.response.PGREQDetailFindByAdminResponseDto; -import com.gt.genti.picturegeneraterequest.dto.response.PGREQDetailFindByUserResponseDto; import com.gt.genti.picturegeneraterequest.dto.response.PGREQStatusResponseDto; +import com.gt.genti.picturegeneraterequest.dto.response.PictureGenerateRequestStatusForUser; +import com.gt.genti.picturegeneraterequest.model.PictureGenerateRequest; +import com.gt.genti.picturegeneraterequest.model.PictureGenerateRequestStatus; import com.gt.genti.picturegeneraterequest.port.PictureGenerateRequestPort; import com.gt.genti.picturegenerateresponse.dto.response.PGRESDetailFindByAdminResponseDto; +import com.gt.genti.picturegenerateresponse.dto.response.PGRESFindByUserResponseDto; +import com.gt.genti.picturegenerateresponse.model.PictureGenerateResponse; +import com.gt.genti.picturegenerateresponse.model.PictureGenerateResponseStatus; import com.gt.genti.usecase.PictureGenerateRequestUseCase; +import com.gt.genti.user.model.User; +import com.gt.genti.user.repository.UserRepository; import jakarta.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; @@ -66,16 +68,6 @@ public Page getAllByPGRESStatusInAndMatchToAd .map(convertPGRESToResponseDto()); } - @Override - public PGREQBriefFindByUserResponseDto getByRequesterAndStatusIs(Long userId, - PictureGenerateRequestStatus status) { - User foundUser = findUserById(userId); - return pictureGenerateRequestPort.findByUserAndStatusInOrderByCreatedByDesc(foundUser, List.of(status)) - .map(PGREQBriefFindByUserResponseDto::new) - .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.PictureGenerateRequestNotFound, - "사진생성요청 상태 = " + status.getStringValue())); - } - private User findUserById(Long userId) { return userRepository.findById(userId) .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.UserNotFound, userId)); @@ -97,15 +89,35 @@ public List findAllPGREQByRequester(Long userId } @Override - public PGREQStatusResponseDto getPGREQStatusIfPendingExists(Long userId) { + public PGREQStatusResponseDto getPendingPGREQStatusIfExists(Long userId) { User foundUser = findUserById(userId); Optional optionalPGREQ = pictureGenerateRequestPort.findByUserAndStatusInOrderByCreatedByDesc( foundUser, PGREQ_PENDING_LIST); if (optionalPGREQ.isPresent()) { PictureGenerateRequest foundPGREQ = optionalPGREQ.get(); + PictureGenerateRequestStatusForUser statusForUser; + switch (foundPGREQ.getPictureGenerateRequestStatus()) { + case AWAIT_USER_VERIFICATION -> statusForUser = AWAIT_USER_VERIFICATION; + case COMPLETED -> statusForUser = COMPLETED; + default -> statusForUser = IN_PROGRESS; + } + if (statusForUser == AWAIT_USER_VERIFICATION) { + PictureGenerateResponse needVerifyPGRES = foundPGREQ.getResponseList() + .stream() + .filter(pgres -> pgres.getStatus().equals(PictureGenerateResponseStatus.SUBMITTED_FINAL)) + .findFirst() + .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.UnHandledException, + String.format("유저가 최종 확인할 적절한 사진생성응답을 찾지 못했습니다. \n 사진생성요청 id [%d] 사진생성요청 상태 [%s]" + , foundPGREQ.getId(), foundPGREQ.getPictureGenerateRequestStatus()))); + return PGREQStatusResponseDto.builder() + .pictureGenerateRequestId(foundPGREQ.getId()) + .status(statusForUser) + .pgresFindByUserResponseDto(new PGRESFindByUserResponseDto(needVerifyPGRES)) + .build(); + } return PGREQStatusResponseDto.builder() .pictureGenerateRequestId(foundPGREQ.getId()) - .status(foundPGREQ.getPictureGenerateRequestStatus()) + .status(statusForUser) .build(); } throw ExpectedException.withoutLogging(ResponseCode.PictureGenerateRequestNotFound, @@ -113,24 +125,6 @@ public PGREQStatusResponseDto getPGREQStatusIfPendingExists(Long userId) { PictureGenerateRequestStatus::getStringValue).collect(Collectors.joining(", "))); } - @Override - public PGREQDetailFindByUserResponseDto findPGREQByRequestAndId(Long userId, Long pictureGenerateRequestId) { - - PictureGenerateRequest foundPictureGenerateRequest = pictureGenerateRequestPort.findById( - pictureGenerateRequestId) - .orElseThrow(() -> - ExpectedException.withLogging(ResponseCode.PictureGenerateRequestNotFound, - "사진생성요청 Id : " + pictureGenerateRequestId)); - - User foundUser = findUserById(userId); - - if (!Objects.equals(foundPictureGenerateRequest.getRequester().getId(), foundUser.getId())) { - throw ExpectedException.withLogging(ResponseCode.OnlyRequesterCanViewPictureGenerateRequest); - } - return new PGREQDetailFindByUserResponseDto(foundPictureGenerateRequest); - } - - @Transactional @Override public PictureGenerateRequest createPGREQ(Long userId, PGREQSaveCommand pgreqSaveCommand) { @@ -174,7 +168,6 @@ public PictureGenerateRequest createPGREQ(Long userId, return pictureGenerateRequestPort.save(createdPGREQ); } - @Transactional @Override public void modifyPGREQ(Long userId, Long pictureGenerateRequestId, PGREQSaveRequestDto pgreqSaveRequestDto) { @@ -205,24 +198,6 @@ public void modifyPGREQ(Long userId, pictureUserFaceList); } - @Transactional - @Override - public Boolean verifyCompletedPGREQ(Long userId, Long pictureGenerateRequestId) { - User foundUser = findUserById(userId); - PictureGenerateRequest foundPictureGenerateRequest = pictureGenerateRequestPort.findByIdAndRequester( - pictureGenerateRequestId, foundUser) - .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.PictureGenerateRequestNotFound, - String.format("생성요청한 유저 id : %d 사진생성요청 Id : %d", foundUser.getId(), pictureGenerateRequestId))); - - if (foundPictureGenerateRequest.getPictureGenerateRequestStatus() - != PictureGenerateRequestStatus.AWAIT_USER_VERIFICATION) { - throw ExpectedException.withLogging(ResponseCode.PictureGenerateRequestNotFound, - foundPictureGenerateRequest.getPictureGenerateRequestStatus().getStringValue()); - } - foundPictureGenerateRequest.userVerified(); - return true; - } - @NotNull private Function convertPGRESToResponseDto() { return pgres -> { @@ -262,5 +237,4 @@ private PGREQDetailFindByAdminResponseDto buildPGREQDetail(PictureGenerateReques .build(); } - } diff --git a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/service/PictureGenerateWorkService.java b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/service/PictureGenerateWorkService.java index ee6aef5f..84414fdd 100644 --- a/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/service/PictureGenerateWorkService.java +++ b/genti-api/src/main/java/com/gt/genti/picturegenerateresponse/service/PictureGenerateWorkService.java @@ -158,7 +158,6 @@ private PictureGenerateRequest findPGREQ(Long pictureGenerateRequestId) { String.format("사진생성요청 Id : %d", pictureGenerateRequestId))); } - public Boolean rejectPictureGenerateRequest(Long userId, Long pictureGenerateRequestId) { PictureGenerateRequest foundPictureGenerateRequest = findPGREQ(pictureGenerateRequestId); if (!Objects.equals(foundPictureGenerateRequest.getCreator().getUser().getId(), userId)) { @@ -283,7 +282,6 @@ private Creator findCreatorByUserId(Long userId) { .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.CreatorNotFound, userId)); } - public PGRESUpdateAdminInChargeResponseDto updateAdminInCharge(Long pgresId, PGRESUpdateAdminInChargeRequestDto requestDto) { PictureGenerateResponse foundPGRES = findPGRES(pgresId); @@ -299,5 +297,23 @@ public PGRESUpdateAdminInChargeResponseDto updateAdminInCharge(Long pgresId, .status(foundPGRES.getStatus()) .build(); } + + public Boolean verifyPGRES(Long userId, Long pgresId) { + User foundUser = findUserById(userId); + PictureGenerateResponse foundPGRES = pictureGenerateResponseRepository.findById(pgresId) + .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.PictureGenerateResponseNotFound)); + PictureGenerateRequest pgreq = foundPGRES.getRequest(); + if (!Objects.equals(pgreq.getRequester().getId(), foundUser.getId())) { + throw ExpectedException.withLogging(ResponseCode.OnlyRequesterCanViewPictureGenerateRequest); + } + if (!pgreq.getPictureGenerateRequestStatus().equals(PictureGenerateRequestStatus.AWAIT_USER_VERIFICATION)) { + throw ExpectedException.withLogging(ResponseCode.UnexpectedPictureGenerateRequestStatus, + pgreq.getPictureGenerateRequestStatus().getResponse()); + } + pgreq.userVerified(); + foundPGRES.userVerified(); + + return true; + } } diff --git a/genti-api/src/main/java/com/gt/genti/usecase/PictureGenerateRequestUseCase.java b/genti-api/src/main/java/com/gt/genti/usecase/PictureGenerateRequestUseCase.java index 673ca48b..3674ffc6 100644 --- a/genti-api/src/main/java/com/gt/genti/usecase/PictureGenerateRequestUseCase.java +++ b/genti-api/src/main/java/com/gt/genti/usecase/PictureGenerateRequestUseCase.java @@ -5,34 +5,26 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import com.gt.genti.picturegeneraterequest.model.PictureGenerateRequestStatus; -import com.gt.genti.picturegenerateresponse.model.PictureGenerateResponseStatus; -import com.gt.genti.picturegeneraterequest.model.PictureGenerateRequest; import com.gt.genti.picturegeneraterequest.command.PGREQSaveCommand; import com.gt.genti.picturegeneraterequest.dto.request.PGREQSaveRequestDto; import com.gt.genti.picturegeneraterequest.dto.response.PGREQBriefFindByUserResponseDto; import com.gt.genti.picturegeneraterequest.dto.response.PGREQDetailFindByAdminResponseDto; -import com.gt.genti.picturegeneraterequest.dto.response.PGREQDetailFindByUserResponseDto; import com.gt.genti.picturegeneraterequest.dto.response.PGREQStatusResponseDto; +import com.gt.genti.picturegeneraterequest.model.PictureGenerateRequest; +import com.gt.genti.picturegenerateresponse.model.PictureGenerateResponseStatus; public interface PictureGenerateRequestUseCase { - public List findAllPGREQByRequester(Long userId); + List findAllPGREQByRequester(Long userId); - public PGREQStatusResponseDto getPGREQStatusIfPendingExists(Long userId); + PGREQStatusResponseDto getPendingPGREQStatusIfExists(Long userId); - @Deprecated - public PGREQDetailFindByUserResponseDto findPGREQByRequestAndId(Long userId, Long id); - public PictureGenerateRequest createPGREQ(Long userId, + PictureGenerateRequest createPGREQ(Long userId, PGREQSaveCommand pgreqSaveCommand); - public void modifyPGREQ(Long userId, + void modifyPGREQ(Long userId, Long pictureGenerateRequestId, PGREQSaveRequestDto pgreqSaveRequestDto); - PGREQBriefFindByUserResponseDto getByRequesterAndStatusIs(Long userId, PictureGenerateRequestStatus status); - - Boolean verifyCompletedPGREQ(Long userId, Long pictureGenerateRequestId); - Page getAllByMatchToAdminIs(boolean matchToAdmin, Pageable pageable); Page getAllByPGRESStatusInAndMatchToAdminIs( diff --git a/genti-domain/src/main/java/com/gt/genti/picturegenerateresponse/model/PictureGenerateResponse.java b/genti-domain/src/main/java/com/gt/genti/picturegenerateresponse/model/PictureGenerateResponse.java index b855c542..494f89e5 100644 --- a/genti-domain/src/main/java/com/gt/genti/picturegenerateresponse/model/PictureGenerateResponse.java +++ b/genti-domain/src/main/java/com/gt/genti/picturegenerateresponse/model/PictureGenerateResponse.java @@ -101,6 +101,10 @@ public void adminSubmit() { this.request.submittedByAdmin(); } + public void userVerified(){ + this.status = PictureGenerateResponseStatus.COMPLETED; + } + public PictureGenerateResponse(Creator creator, PictureGenerateRequest request) { this.creator = creator; this.request = request; From b70a24ede17c53499db7211795cb39f93027fd34 Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Tue, 16 Jul 2024 01:16:19 +0900 Subject: [PATCH 12/16] =?UTF-8?q?Feat:=20#31=20AWAIT=5FUSER=5FVERIFICATION?= =?UTF-8?q?=20=EC=83=81=ED=83=9C=EB=8F=84=20Pending=20=EC=9A=94=EC=B2=AD?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=EC=97=90=20=EC=A1=B0=ED=9A=8C=EB=90=98?= =?UTF-8?q?=EC=96=B4=EC=95=BC=ED=95=9C=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- genti-domain/src/main/java/com/gt/genti/common/EnumUtil.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/genti-domain/src/main/java/com/gt/genti/common/EnumUtil.java b/genti-domain/src/main/java/com/gt/genti/common/EnumUtil.java index 5cb8c83b..31f86d0d 100644 --- a/genti-domain/src/main/java/com/gt/genti/common/EnumUtil.java +++ b/genti-domain/src/main/java/com/gt/genti/common/EnumUtil.java @@ -22,7 +22,8 @@ public class EnumUtil { PictureGenerateRequestStatus.CREATED, PictureGenerateRequestStatus.ASSIGNING, PictureGenerateRequestStatus.IN_PROGRESS, - PictureGenerateRequestStatus.MATCH_TO_ADMIN + PictureGenerateRequestStatus.MATCH_TO_ADMIN, + PictureGenerateRequestStatus.AWAIT_USER_VERIFICATION ); public static List PGREQ_IN_PROGRESS_LIST = List.of( From dc3680719dcf299c0812231a00b8b10ea345a17a Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Tue, 16 Jul 2024 01:16:41 +0900 Subject: [PATCH 13/16] =?UTF-8?q?Feat:=20#26=20Oauth=20=EC=9C=A0=EC=A0=80?= =?UTF-8?q?=20=EA=B0=80=EC=9E=85=EC=8B=9C=20apple=EC=9D=80=20username?= =?UTF-8?q?=EC=9D=B4=20=EC=97=86=EC=96=B4=20null=20->=20""=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- genti-domain/src/main/java/com/gt/genti/user/model/User.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/genti-domain/src/main/java/com/gt/genti/user/model/User.java b/genti-domain/src/main/java/com/gt/genti/user/model/User.java index 32ba55f7..7cb9dccb 100644 --- a/genti-domain/src/main/java/com/gt/genti/user/model/User.java +++ b/genti-domain/src/main/java/com/gt/genti/user/model/User.java @@ -132,7 +132,9 @@ public void prePersist() { if (this.introduction == null) { this.introduction = ""; } - + if (this.username == null) { + this.username = ""; + } if (this.requestTaskCount == null) { this.requestTaskCount = 0; } From 6156f3de2cf11e19de9335e5e764dd6a086db59c Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Tue, 16 Jul 2024 01:17:08 +0900 Subject: [PATCH 14/16] =?UTF-8?q?Feat:=20#26=20Oauth=20redirect=20?= =?UTF-8?q?=EB=98=90=ED=95=9C=20ResponseCode.java=20=EC=97=90=20=EC=A0=95?= =?UTF-8?q?=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/gt/genti/error/ResponseCode.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/genti-common/src/main/java/com/gt/genti/error/ResponseCode.java b/genti-common/src/main/java/com/gt/genti/error/ResponseCode.java index 1f8864b6..eab91368 100644 --- a/genti-common/src/main/java/com/gt/genti/error/ResponseCode.java +++ b/genti-common/src/main/java/com/gt/genti/error/ResponseCode.java @@ -19,6 +19,7 @@ @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum ResponseCode { OK(null, HttpStatus.OK, true, null), + SEE_OTHER(null, HttpStatus.SEE_OTHER, true, null), /** * 인증/인가 */ @@ -97,7 +98,7 @@ public enum ResponseCode { UnexpectedPictureGenerateRequestStatus(ErrorConstants.UnexpectedPictureGenerateRequestStatus, HttpStatus.CONFLICT, false, "현재 사진생성요청의 상태가 [%s]임, 요청을 수행할 수 없습니다."), NoPictureGenerateRequest(ErrorConstants.NoPictureGenerateRequest, HttpStatus.NO_CONTENT, false, - "사진 생성요청이 1개도 없습니다."), + "사진 생성요청이 없습니다."), PictureGenerateRequestAlreadyInProgress(ErrorConstants.PictureGenerateRequestAlreadyInProgress, HttpStatus.BAD_REQUEST, false, "이미 작업이 진행중인 요청은 수정이 불가합니다."), PictureGenerateRequestNotAssignedToCreator(ErrorConstants.PictureGenerateRequestNotAssignedToCreator, From 0705ba59ca05a80b54b72f42e7cd69816e365d8b Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Tue, 16 Jul 2024 01:17:38 +0900 Subject: [PATCH 15/16] =?UTF-8?q?Feat:=20#31=20=EC=9D=98=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EA=B5=AC=ED=98=84=20=EC=A4=91=20=EC=9C=A0=EC=A0=80?= =?UTF-8?q?=EC=9D=98=20action=EC=9D=84=20PGREQ=EC=97=90=EC=84=9C=20PGRES?= =?UTF-8?q?=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- genti-common/src/main/java/com/gt/genti/model/LogItem.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/genti-common/src/main/java/com/gt/genti/model/LogItem.java b/genti-common/src/main/java/com/gt/genti/model/LogItem.java index cebc79ea..8509f883 100644 --- a/genti-common/src/main/java/com/gt/genti/model/LogItem.java +++ b/genti-common/src/main/java/com/gt/genti/model/LogItem.java @@ -18,14 +18,13 @@ public enum LogItem { PGREQ_ACCEPT("pgreq : accept"), PGREQ_REJECT("pgreq : reject"), PGREQ_INPROGESS("pgreq : inprogress"), - PGREQ_COMPLETED("pgreq : completed"), - PGREQ_VERIFY("pgreq : verify"), PGRES("pgres"), PGRES_PICTURE_COMPLETED("pgres : picture_completed"), PGRES_PICTURE_CREATED_BY_CREATOR("pgres : picture_created_by_creator"), PGRES_ASSIGNEE("pgres : assignee"), PGRES_SUBMIT("pgres : submit"), PGRES_MEMO("pgres : memo"), + PGRES_VERIFY("pgres : verify"), POST("post"), REPORT("report"), RESPONSE_EXAMPLE("response_example"), From d9963733b0682920d793b7875c9e65d5a612bfbb Mon Sep 17 00:00:00 2001 From: BYEONGRYEOL Date: Tue, 16 Jul 2024 01:32:41 +0900 Subject: [PATCH 16/16] =?UTF-8?q?Fix:=20#47=20cors=20=EB=AA=A8=EB=93=A0=20?= =?UTF-8?q?origin=20=ED=97=88=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/gt/genti/config/SecurityConfig.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/genti-auth/src/main/java/com/gt/genti/config/SecurityConfig.java b/genti-auth/src/main/java/com/gt/genti/config/SecurityConfig.java index 7500aca0..fd1644b5 100644 --- a/genti-auth/src/main/java/com/gt/genti/config/SecurityConfig.java +++ b/genti-auth/src/main/java/com/gt/genti/config/SecurityConfig.java @@ -40,7 +40,9 @@ public CorsConfigurationSource corsConfigurationSource() { config.addAllowedOrigin("https://kapi.kakao.com"); config.addAllowedOrigin("http://www.googleapis.com"); config.addAllowedOrigin("https://www.googleapis.com"); - // config.setAllowedOriginPatterns(List.of("*")); + + + config.setAllowedOriginPatterns(List.of("*")); config.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS")); config.setAllowedHeaders(List.of("Authorization", "Cache-Control", "Content-Type"));