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 #191

Merged
merged 2 commits into from
Oct 31, 2024
Merged

Dev #191

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 @@ -323,8 +323,7 @@ public Boolean finishPGRESByFrontend(Long userId){
.pictureRatio(foundpgreq.getPictureRatio())
.build();
pictureCompletedRepository.save(pictureCompleted);
foundpgres.userVerified();
foundpgreq.userVerified();
foundpgreq.submittedByAdmin();
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.List;

import com.gt.genti.responseexample.dto.response.ExampleWithSquarePicture;
import org.springframework.http.ResponseEntity;

import com.gt.genti.error.ResponseCode;
Expand Down Expand Up @@ -30,5 +31,5 @@ public interface UserResponseExampleApi {
@EnumResponses(value = {
@EnumResponse(ResponseCode.OK)
})
ResponseEntity<ApiResult<List<ExampleWithPictureFindResponseDto>>> getAllResponseExamplesInGenerateView();
ResponseEntity<ApiResult<List<ExampleWithSquarePicture>>> getAllResponseExamplesInGenerateView();
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import java.util.List;

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.RequestMapping;
Expand Down Expand Up @@ -34,7 +35,7 @@ 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<ExampleWithPictureFindResponseDto>>> getAllResponseExamplesInGenerateView(){
public ResponseEntity<ApiResult<List<ExampleWithSquarePicture>>> getAllResponseExamplesInGenerateView(){
return success(responseExampleService.getAllResponseExamplesInGenerateView());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.gt.genti.responseexample.dto.response;

import com.gt.genti.aws.AwsUtils;
import com.gt.genti.picture.responseexample.model.ResponseExample;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Schema(name = "[ResponseExample][Admin&User] 사진 생성뷰1에서의 예시 사진 응답 dto")
@Getter
@NoArgsConstructor
public class ExampleWithSquarePicture {
@Schema(description = "해당 사진의 Url", example = "https://**")
String url;

@Schema(description = "에시 프롬프트", example = "벚꽃길에서 벤치에 앉아있어요")
String prompt;

public ExampleWithSquarePicture(ResponseExample responseExample) {
this.url = AwsUtils.CLOUDFRONT_BASEURL + "/" + responseExample.getKey();
this.prompt = responseExample.getExamplePrompt();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Optional;
import java.util.stream.Collectors;

import com.gt.genti.responseexample.dto.response.ExampleWithSquarePicture;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -67,10 +68,10 @@ public void addResponseExamples(List<ExampleSaveCommand> commandList,
.build()).toList());
}

public List<ExampleWithPictureFindResponseDto> getAllResponseExamplesInGenerateView() {
List<ExampleWithPictureFindResponseDto> examples = responseExampleRepository.findAllByPromptOnlyIsTrue()
public List<ExampleWithSquarePicture> getAllResponseExamplesInGenerateView() {
List<ExampleWithSquarePicture> examples = responseExampleRepository.findAllByPromptOnlyIsTrue()
.stream()
.map(ExampleWithPictureFindResponseDto::new)
.map(ExampleWithSquarePicture::new)
.collect(Collectors.toList());
Collections.shuffle(examples);

Expand Down