Skip to content

Commit

Permalink
Merge pull request #205 from Genti2024/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
LeeJae-H authored Nov 30, 2024
2 parents 2b0b454 + eeb0c6c commit 9e2cb19
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ public interface UserResponseExampleApi {
@EnumResponses(value = {
@EnumResponse(ResponseCode.OK)
})
ResponseEntity<ApiResult<List<ExampleWithSquarePicture>>> getAllResponseExamplesInGenerateView();
ResponseEntity<ApiResult<List<ExampleWithSquarePicture>>> getAllResponseExamplesInGenerateView(String type);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -34,9 +35,11 @@ public ResponseEntity<ApiResult<List<ExampleWithPictureFindResponseDto>>> getAll


@Logging(item = LogItem.RESPONSE_EXAMPLE, action = LogAction.VIEW, requester = LogRequester.USER)
@GetMapping("/with-picture-square")
public ResponseEntity<ApiResult<List<ExampleWithSquarePicture>>> getAllResponseExamplesInGenerateView(){
return success(responseExampleService.getAllResponseExamplesInGenerateView());
@GetMapping("/with-picture-square/{type}")
public ResponseEntity<ApiResult<List<ExampleWithSquarePicture>>> getAllResponseExamplesInGenerateView(
@PathVariable(name = "type") String type
){
return success(responseExampleService.getAllResponseExamplesInGenerateView(type));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public void addResponseExamples(List<ExampleSaveCommand> commandList,
.build()).toList());
}

public List<ExampleWithSquarePicture> getAllResponseExamplesInGenerateView() {
List<ExampleWithSquarePicture> examples = responseExampleRepository.findAllByPromptOnlyIsTrue()
public List<ExampleWithSquarePicture> getAllResponseExamplesInGenerateView(String type) {
List<ExampleWithSquarePicture> examples = responseExampleRepository.findAllByType(type)
.stream()
.map(ExampleWithSquarePicture::new)
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
public interface ResponseExampleRepository extends JpaRepository<ResponseExample, Long> {
List<ResponseExample> findAllByPromptOnlyIsFalse();
Page<ResponseExample> findAllByPromptOnlyIsFalse(Pageable pageable);
List<ResponseExample> findAllByPromptOnlyIsTrue();
List<ResponseExample> findAllByType(String type);
}

0 comments on commit 9e2cb19

Please sign in to comment.