Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #205

Merged
merged 2 commits into from
Nov 30, 2024
Merged

Dev #205

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}