Skip to content

Commit

Permalink
Merge pull request #191 from Genti2024/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
LeeJae-H authored Oct 31, 2024
2 parents 136ecc1 + c3d7798 commit f6e6221
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 7 deletions.
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

0 comments on commit f6e6221

Please sign in to comment.