From 85a6ff0063611cbcb3c1a6361ab396ac9657ab18 Mon Sep 17 00:00:00 2001 From: LeeJaehyung <540900@naver.com> Date: Sun, 1 Dec 2024 04:51:34 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20#196=20=EC=82=AC=EC=A7=84=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EC=98=88=EC=8B=9C=20=EB=B7=B0(=EC=A0=95=EB=B0=A9?= =?UTF-8?q?=ED=98=95=20=EC=82=AC=EC=A7=84)=20=EC=A2=85=EB=A5=98=EA=B0=80?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=EB=90=A8(=EB=AC=B4=EB=A3=8C=20->=20?= =?UTF-8?q?=EB=AC=B4=EB=A3=8C,=20=EC=9C=A0=EB=A3=8C-1=EC=9D=B8,=20?= =?UTF-8?q?=EC=9C=A0=EB=A3=8C-2=EC=9D=B8)=EC=97=90=20=EB=94=B0=EB=9D=BC=20?= =?UTF-8?q?=ED=95=B4=EB=8B=B9=20API=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../responseexample/api/UserResponseExampleApi.java | 2 +- .../controller/UserExampleController.java | 9 ++++++--- .../dto/response/ExampleWithSquarePicture.java | 3 +++ .../responseexample/service/ResponseExampleService.java | 4 ++-- .../picture/responseexample/model/ResponseExample.java | 3 +++ .../repository/ResponseExampleRepository.java | 2 +- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/genti-api/src/main/java/com/gt/genti/responseexample/api/UserResponseExampleApi.java b/genti-api/src/main/java/com/gt/genti/responseexample/api/UserResponseExampleApi.java index 7f0a1f9e..01e41021 100644 --- a/genti-api/src/main/java/com/gt/genti/responseexample/api/UserResponseExampleApi.java +++ b/genti-api/src/main/java/com/gt/genti/responseexample/api/UserResponseExampleApi.java @@ -31,5 +31,5 @@ public interface UserResponseExampleApi { @EnumResponses(value = { @EnumResponse(ResponseCode.OK) }) - ResponseEntity>> getAllResponseExamplesInGenerateView(); + ResponseEntity>> getAllResponseExamplesInGenerateView(String type); } diff --git a/genti-api/src/main/java/com/gt/genti/responseexample/controller/UserExampleController.java b/genti-api/src/main/java/com/gt/genti/responseexample/controller/UserExampleController.java index 04474a09..050f8a4c 100644 --- a/genti-api/src/main/java/com/gt/genti/responseexample/controller/UserExampleController.java +++ b/genti-api/src/main/java/com/gt/genti/responseexample/controller/UserExampleController.java @@ -7,6 +7,7 @@ import com.gt.genti.responseexample.dto.response.ExampleWithSquarePicture; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -34,9 +35,11 @@ public ResponseEntity>> getAll @Logging(item = LogItem.RESPONSE_EXAMPLE, action = LogAction.VIEW, requester = LogRequester.USER) - @GetMapping("/with-picture-square") - public ResponseEntity>> getAllResponseExamplesInGenerateView(){ - return success(responseExampleService.getAllResponseExamplesInGenerateView()); + @GetMapping("/with-picture-square/{type}") + public ResponseEntity>> getAllResponseExamplesInGenerateView( + @PathVariable(name = "type") String type + ){ + return success(responseExampleService.getAllResponseExamplesInGenerateView(type)); } } diff --git a/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/ExampleWithSquarePicture.java b/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/ExampleWithSquarePicture.java index 231518f7..6828d559 100644 --- a/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/ExampleWithSquarePicture.java +++ b/genti-api/src/main/java/com/gt/genti/responseexample/dto/response/ExampleWithSquarePicture.java @@ -16,6 +16,9 @@ public class ExampleWithSquarePicture { @Schema(description = "에시 프롬프트", example = "벚꽃길에서 벤치에 앉아있어요") String prompt; + @Schema(description = "사진 유형", example = "FREE_SINGLE") + String type; + public ExampleWithSquarePicture(ResponseExample responseExample) { this.url = AwsUtils.CLOUDFRONT_BASEURL + "/" + responseExample.getKey(); this.prompt = responseExample.getExamplePrompt(); diff --git a/genti-api/src/main/java/com/gt/genti/responseexample/service/ResponseExampleService.java b/genti-api/src/main/java/com/gt/genti/responseexample/service/ResponseExampleService.java index 3726ab81..8f3a59ce 100644 --- a/genti-api/src/main/java/com/gt/genti/responseexample/service/ResponseExampleService.java +++ b/genti-api/src/main/java/com/gt/genti/responseexample/service/ResponseExampleService.java @@ -68,8 +68,8 @@ public void addResponseExamples(List commandList, .build()).toList()); } - public List getAllResponseExamplesInGenerateView() { - List examples = responseExampleRepository.findAllByPromptOnlyIsTrue() + public List getAllResponseExamplesInGenerateView(String type) { + List examples = responseExampleRepository.findAllByType(type) .stream() .map(ExampleWithSquarePicture::new) .collect(Collectors.toList()); diff --git a/genti-domain/src/main/java/com/gt/genti/picture/responseexample/model/ResponseExample.java b/genti-domain/src/main/java/com/gt/genti/picture/responseexample/model/ResponseExample.java index 02e35014..5647e8d6 100644 --- a/genti-domain/src/main/java/com/gt/genti/picture/responseexample/model/ResponseExample.java +++ b/genti-domain/src/main/java/com/gt/genti/picture/responseexample/model/ResponseExample.java @@ -31,6 +31,9 @@ public class ResponseExample extends PictureEntity implements Picture { @Column(name = "prompt_only") Boolean promptOnly; + @Column + private String type; + @Builder public ResponseExample(String key, String prompt, PictureRatio pictureRatio, User uploadedBy) { this.promptOnly = false; diff --git a/genti-domain/src/main/java/com/gt/genti/picture/responseexample/repository/ResponseExampleRepository.java b/genti-domain/src/main/java/com/gt/genti/picture/responseexample/repository/ResponseExampleRepository.java index b50c00bc..b38bf51f 100644 --- a/genti-domain/src/main/java/com/gt/genti/picture/responseexample/repository/ResponseExampleRepository.java +++ b/genti-domain/src/main/java/com/gt/genti/picture/responseexample/repository/ResponseExampleRepository.java @@ -11,5 +11,5 @@ public interface ResponseExampleRepository extends JpaRepository { List findAllByPromptOnlyIsFalse(); Page findAllByPromptOnlyIsFalse(Pageable pageable); - List findAllByPromptOnlyIsTrue(); + List findAllByType(String type); }