Skip to content

Commit

Permalink
Update: FE의 잘못된 요청에 대하여 오류내용 설명
Browse files Browse the repository at this point in the history
  • Loading branch information
BYEONGRYEOL committed Jun 7, 2024
1 parent 236fa6c commit 9c4aa31
Show file tree
Hide file tree
Showing 63 changed files with 177 additions and 131 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import org.springframework.web.bind.annotation.RestController;

import com.gt.genti.application.service.PictureGenerateWorkService;
import com.gt.genti.dto.admin.PGRESUpdateByAdminResponseDto;
import com.gt.genti.dto.common.CommonPictureKeyUpdateRequestDto;
import com.gt.genti.dto.admin.response.PGRESUpdateByAdminResponseDto;
import com.gt.genti.dto.common.request.CommonPictureKeyUpdateRequestDto;
import com.gt.genti.other.auth.UserDetailsImpl;

import jakarta.validation.Valid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import org.springframework.web.bind.annotation.RestController;

import com.gt.genti.application.service.ReportService;
import com.gt.genti.dto.admin.ReportFindResponseDto;
import com.gt.genti.dto.admin.ReportUpdateRequestDto;
import com.gt.genti.dto.admin.response.ReportFindResponseDto;
import com.gt.genti.dto.admin.request.ReportUpdateRequestDto;

import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import com.gt.genti.application.service.UserService;
import com.gt.genti.domain.enums.UserRole;
import com.gt.genti.domain.enums.converter.EnumUtil;
import com.gt.genti.dto.admin.UserRoleUpdateRequestDto;
import com.gt.genti.dto.admin.UserStatusUpdateRequestDto;
import com.gt.genti.dto.admin.UserFindByAdminResponseDto;
import com.gt.genti.dto.admin.request.UserRoleUpdateRequestDto;
import com.gt.genti.dto.admin.request.UserStatusUpdateRequestDto;
import com.gt.genti.dto.admin.response.UserFindByAdminResponseDto;

import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gt.genti.dto.admin.ExampleSaveRequestDto;
import com.gt.genti.dto.admin.ExampleWithPictureFindResponseDto;
import com.gt.genti.dto.admin.request.ExampleSaveRequestDto;
import com.gt.genti.dto.admin.response.ExampleWithPictureFindResponseDto;
import com.gt.genti.other.auth.UserDetailsImpl;
import com.gt.genti.service.ResponseExampleService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gt.genti.dto.creator.CreatorFindResponseDto;
import com.gt.genti.dto.creator.AccountUpdateRequestDto;
import com.gt.genti.dto.creator.CreatorStatusUpdateRequestDto;
import com.gt.genti.dto.creator.CreatorStatusUpdateResponseDto;
import com.gt.genti.dto.creator.response.CreatorFindResponseDto;
import com.gt.genti.dto.creator.request.AccountUpdateRequestDto;
import com.gt.genti.dto.creator.request.CreatorStatusUpdateRequestDto;
import com.gt.genti.dto.creator.response.CreatorStatusUpdateResponseDto;
import com.gt.genti.other.auth.UserDetailsImpl;
import com.gt.genti.service.CreatorService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

import com.gt.genti.application.service.PictureGenerateWorkService;
import com.gt.genti.domain.enums.PictureGenerateRequestStatus;
import com.gt.genti.dto.creator.PGREQBriefFindByCreatorResponseDto;
import com.gt.genti.dto.creator.response.PGREQBriefFindByCreatorResponseDto;
import com.gt.genti.dto.PGREQDetailFindResponseDto;
import com.gt.genti.dto.creator.PGRESUpdateByCreatorResponseDto;
import com.gt.genti.dto.MemoUpdateRequestDto;
import com.gt.genti.dto.common.CommonPictureKeyUpdateRequestDto;
import com.gt.genti.dto.creator.response.PGRESUpdateByCreatorResponseDto;
import com.gt.genti.dto.creator.request.MemoUpdateRequestDto;
import com.gt.genti.dto.common.request.CommonPictureKeyUpdateRequestDto;
import com.gt.genti.other.auth.UserDetailsImpl;

import jakarta.validation.Valid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.springframework.web.bind.annotation.RestController;

import com.gt.genti.application.service.ReportService;
import com.gt.genti.dto.admin.ReportSaveRequestDto;
import com.gt.genti.dto.admin.request.ReportSaveRequestDto;
import com.gt.genti.other.auth.UserDetailsImpl;

import jakarta.validation.Valid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import org.springframework.web.bind.annotation.RestController;

import com.gt.genti.application.service.PostService;
import com.gt.genti.dto.user.PostBriefFindResponseDto;
import com.gt.genti.dto.user.PostDetailResponseDto;
import com.gt.genti.dto.user.response.PostBriefFindResponseDto;
import com.gt.genti.dto.user.response.PostDetailResponseDto;
import com.gt.genti.other.annotation.ToBeUpdated;
import com.gt.genti.other.aop.annotation.CheckUserIsQuit;
import com.gt.genti.other.auth.UserDetailsImpl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gt.genti.dto.common.CommonPictureUrlResponseDto;
import com.gt.genti.dto.user.UserFindResponseDto;
import com.gt.genti.dto.common.response.CommonPictureUrlResponseDto;
import com.gt.genti.dto.user.response.UserFindResponseDto;
import com.gt.genti.other.annotation.ToBeUpdated;
import com.gt.genti.other.aop.annotation.CheckUserIsQuit;
import com.gt.genti.other.auth.UserDetailsImpl;
import com.gt.genti.dto.user.UserInfoUpdateRequestDto;
import com.gt.genti.dto.user.request.UserInfoUpdateRequestDto;
import com.gt.genti.application.service.UserService;

import jakarta.validation.Valid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gt.genti.dto.admin.ExampleWithPictureFindResponseDto;
import com.gt.genti.dto.admin.response.ExampleWithPictureFindResponseDto;
import com.gt.genti.service.ResponseExampleService;

import lombok.RequiredArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
import org.springframework.web.bind.annotation.RestController;

import com.gt.genti.adapter.usecase.PictureGenerateRequestUseCase;
import com.gt.genti.dto.user.PGREQBriefFindByUserResponseDto;
import com.gt.genti.dto.user.PGREQDetailFindByUserResponseDto;
import com.gt.genti.dto.user.PGREQSaveRequestDto;
import com.gt.genti.dto.user.PGREQUpdateRequestDto;
import com.gt.genti.dto.user.response.PGREQBriefFindByUserResponseDto;
import com.gt.genti.dto.user.response.PGREQDetailFindByUserResponseDto;
import com.gt.genti.dto.user.request.PGREQSaveRequestDto;
import com.gt.genti.dto.user.request.PGREQUpdateRequestDto;
import com.gt.genti.other.auth.UserDetailsImpl;

import io.swagger.v3.oas.annotations.Operation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import org.springframework.transaction.annotation.Transactional;

import com.gt.genti.domain.PictureGenerateRequest;
import com.gt.genti.dto.user.PGREQBriefFindByUserResponseDto;
import com.gt.genti.dto.user.PGREQUpdateRequestDto;
import com.gt.genti.dto.user.PGREQDetailFindByUserResponseDto;
import com.gt.genti.dto.user.PGREQSaveRequestDto;
import com.gt.genti.dto.user.response.PGREQBriefFindByUserResponseDto;
import com.gt.genti.dto.user.request.PGREQUpdateRequestDto;
import com.gt.genti.dto.user.response.PGREQDetailFindByUserResponseDto;
import com.gt.genti.dto.user.request.PGREQSaveRequestDto;

public interface PictureGenerateRequestUseCase {
public List<PGREQDetailFindByUserResponseDto> getAllPictureGenerateRequestForUser(Long userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
import com.gt.genti.domain.PicturePose;
import com.gt.genti.domain.PictureUserFace;
import com.gt.genti.domain.User;
import com.gt.genti.dto.user.PGREQBriefFindByUserResponseDto;
import com.gt.genti.dto.user.PGREQDetailFindByUserResponseDto;
import com.gt.genti.dto.PGREQDetailFindResponseDto;
import com.gt.genti.dto.user.PGREQSaveRequestDto;
import com.gt.genti.dto.user.PGREQUpdateRequestDto;
import com.gt.genti.dto.user.request.PGREQSaveRequestDto;
import com.gt.genti.dto.user.request.PGREQUpdateRequestDto;
import com.gt.genti.dto.user.response.PGREQBriefFindByUserResponseDto;
import com.gt.genti.dto.user.response.PGREQDetailFindByUserResponseDto;
import com.gt.genti.error.DefaultErrorCode;
import com.gt.genti.error.DomainErrorCode;
import com.gt.genti.error.ExpectedException;
Expand Down Expand Up @@ -58,7 +58,7 @@ public Page<PGREQDetailFindResponseDto> getAllPictureGenerateRequest(
@Override
public List<PGREQDetailFindByUserResponseDto> getAllPictureGenerateRequestForUser(Long userId) {
User foundUser = findUser(userId);

List<PGREQDetailFindByUserResponseDto> result = pictureGenerateRequestPort.findAllByRequester(
foundUser).stream().map(
PGREQDetailFindByUserResponseDto::new
Expand Down Expand Up @@ -118,35 +118,39 @@ public List<PGREQBriefFindByUserResponseDto> getAllMyPictureGenerateRequests(Lon
@Override
@Transactional
public PictureGenerateRequest createPictureGenerateRequest(Long requesterId,
PGREQSaveRequestDto PGREQSaveRequestDto) {
PGREQSaveRequestDto pgreqSaveRequestDto) {

User foundUploader = findUser(requesterId);

String posePictureKey = PGREQSaveRequestDto.getPosePictureKey();

PicturePose foundPicturePose = pictureService.findByUrlPicturePose(posePictureKey)
.orElseGet(() -> {
log.info("""
%s 유저가 요청에 포함한 포즈참고사진 key [%s] 기존 사진을 찾을 수 없어 신규 저장"""
.formatted(foundUploader.getEmail(), posePictureKey));
return pictureService.updatePicture(
CreatePicturePoseCommand.builder()
.key(posePictureKey)
.uploader(foundUploader).build());
});
String posePictureKey = "";
PicturePose foundPicturePose = null;
if (!Objects.isNull(pgreqSaveRequestDto.getPosePictureKey())) {
posePictureKey = pgreqSaveRequestDto.getPosePictureKey();
String finalPosePictureKey = posePictureKey;
foundPicturePose = pictureService.findByUrlPicturePose(posePictureKey)
.orElseGet(() -> {
log.info("""
%s 유저가 요청에 포함한 포즈참고사진 key [%s] 기존 사진을 찾을 수 없어 신규 저장"""
.formatted(foundUploader.getEmail(), finalPosePictureKey));
return pictureService.updatePicture(
CreatePicturePoseCommand.builder()
.key(finalPosePictureKey)
.uploader(foundUploader).build());
});
}

List<String> facePictureUrl = PGREQSaveRequestDto.getFacePictureKeyList();
List<String> facePictureUrl = pgreqSaveRequestDto.getFacePictureKeyList();
List<PictureUserFace> uploadedFacePictureList = pictureService.updateIfNotExistsPictureUserFace(facePictureUrl,
foundUploader);

String promptAdvanced = openAIService.getAdvancedPrompt(
new PromptAdvancementRequestCommand(PGREQSaveRequestDto.getPrompt()));
new PromptAdvancementRequestCommand(pgreqSaveRequestDto.getPrompt()));
log.info(promptAdvanced);

PictureGenerateRequest pgr = PictureGenerateRequest.builder()
.requester(foundUploader)
.promptAdvanced(promptAdvanced)
.pgreqSaveRequestDto(PGREQSaveRequestDto)
.pgreqSaveRequestDto(pgreqSaveRequestDto)
.picturePose(foundPicturePose)
.userFacePictureList(uploadedFacePictureList)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
import com.gt.genti.domain.User;
import com.gt.genti.domain.enums.PictureGenerateRequestStatus;
import com.gt.genti.domain.enums.PictureGenerateResponseStatus;
import com.gt.genti.dto.common.CommonPictureKeyUpdateRequestDto;
import com.gt.genti.dto.MemoUpdateRequestDto;
import com.gt.genti.dto.creator.PGREQBriefFindByCreatorResponseDto;
import com.gt.genti.dto.common.request.CommonPictureKeyUpdateRequestDto;
import com.gt.genti.dto.creator.request.MemoUpdateRequestDto;
import com.gt.genti.dto.creator.response.PGREQBriefFindByCreatorResponseDto;
import com.gt.genti.dto.PGREQDetailFindResponseDto;
import com.gt.genti.dto.admin.PGRESUpdateByAdminResponseDto;
import com.gt.genti.dto.creator.PGRESUpdateByCreatorResponseDto;
import com.gt.genti.dto.admin.response.PGRESUpdateByAdminResponseDto;
import com.gt.genti.dto.creator.response.PGRESUpdateByCreatorResponseDto;
import com.gt.genti.error.DomainErrorCode;
import com.gt.genti.error.ExpectedException;
import com.gt.genti.other.util.TimeUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.springframework.stereotype.Service;

import com.gt.genti.domain.Post;
import com.gt.genti.dto.user.PostBriefFindResponseDto;
import com.gt.genti.dto.user.PostDetailResponseDto;
import com.gt.genti.dto.user.response.PostBriefFindResponseDto;
import com.gt.genti.dto.user.response.PostDetailResponseDto;
import com.gt.genti.repository.PostRepository;

import lombok.AccessLevel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import com.gt.genti.domain.PictureGenerateResponse;
import com.gt.genti.domain.Report;
import com.gt.genti.domain.enums.ReportStatus;
import com.gt.genti.dto.admin.ReportSaveRequestDto;
import com.gt.genti.dto.admin.ReportFindResponseDto;
import com.gt.genti.dto.admin.ReportUpdateRequestDto;
import com.gt.genti.dto.admin.request.ReportSaveRequestDto;
import com.gt.genti.dto.admin.response.ReportFindResponseDto;
import com.gt.genti.dto.admin.request.ReportUpdateRequestDto;
import com.gt.genti.error.DomainErrorCode;
import com.gt.genti.error.ExpectedException;
import com.gt.genti.repository.PictureGenerateResponseRepository;
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/gt/genti/application/service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
import com.gt.genti.domain.User;
import com.gt.genti.domain.common.PictureEntity;
import com.gt.genti.domain.enums.UserRole;
import com.gt.genti.dto.common.CommonPictureUrlResponseDto;
import com.gt.genti.dto.admin.UserFindByAdminResponseDto;
import com.gt.genti.dto.user.UserFindResponseDto;
import com.gt.genti.dto.user.UserInfoUpdateRequestDto;
import com.gt.genti.dto.admin.UserRoleUpdateRequestDto;
import com.gt.genti.dto.admin.UserStatusUpdateRequestDto;
import com.gt.genti.dto.common.response.CommonPictureUrlResponseDto;
import com.gt.genti.dto.admin.response.UserFindByAdminResponseDto;
import com.gt.genti.dto.user.response.UserFindResponseDto;
import com.gt.genti.dto.user.request.UserInfoUpdateRequestDto;
import com.gt.genti.dto.admin.request.UserRoleUpdateRequestDto;
import com.gt.genti.dto.admin.request.UserStatusUpdateRequestDto;
import com.gt.genti.error.DomainErrorCode;
import com.gt.genti.error.ExpectedException;
import com.gt.genti.repository.CreatorRepository;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/gt/genti/domain/PictureGenerateRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import com.gt.genti.domain.enums.converter.EnumUtil;
import com.gt.genti.domain.enums.converter.RequestStatusConverter;
import com.gt.genti.domain.enums.converter.ShotCoverageConverter;
import com.gt.genti.dto.user.PGREQUpdateRequestDto;
import com.gt.genti.dto.user.PGREQSaveRequestDto;
import com.gt.genti.dto.user.request.PGREQUpdateRequestDto;
import com.gt.genti.dto.user.request.PGREQSaveRequestDto;
import com.gt.genti.error.DomainErrorCode;
import com.gt.genti.error.ExpectedException;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/gt/genti/domain/ResponseExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.gt.genti.domain.common.Picture;
import com.gt.genti.domain.common.PictureEntity;
import com.gt.genti.dto.admin.ExampleSaveRequestDto;
import com.gt.genti.dto.admin.request.ExampleSaveRequestDto;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/gt/genti/domain/common/Picture.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gt.genti.domain.common;

import com.gt.genti.dto.common.CommonPictureUrlResponseDto;
import com.gt.genti.dto.common.response.CommonPictureUrlResponseDto;

public interface Picture {
Long getId();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.gt.genti.domain.common;

import com.gt.genti.domain.User;
import com.gt.genti.dto.common.CommonPictureUrlResponseDto;
import com.gt.genti.dto.common.response.CommonPictureUrlResponseDto;

import jakarta.persistence.Column;
import jakarta.persistence.JoinColumn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.gt.genti.domain.enums.CameraAngle;
import com.gt.genti.domain.enums.PictureGenerateRequestStatus;
import com.gt.genti.domain.enums.ShotCoverage;
import com.gt.genti.dto.admin.PGRESDetailFindByAdminResponseDto;
import com.gt.genti.dto.admin.response.PGRESDetailFindByAdminResponseDto;
import com.gt.genti.other.util.TimeUtils;

import lombok.AccessLevel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package com.gt.genti.dto.admin;
package com.gt.genti.dto.admin.request;

import com.gt.genti.other.valid.Key;

import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
public class ExampleSaveRequestDto {
@Key
String key;
@NotNull
String prompt;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package com.gt.genti.dto.admin;
package com.gt.genti.dto.admin.request;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class ReportSaveRequestDto {
@NotNull
Long pictureGenerateResponseId;
@NotBlank
String content;
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package com.gt.genti.dto.admin;
package com.gt.genti.dto.admin.request;

import com.gt.genti.domain.enums.ReportStatus;

import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
public class ReportUpdateRequestDto {
@NotNull
Long id;
@NotNull
ReportStatus reportStatus;
}
Loading

0 comments on commit 9c4aa31

Please sign in to comment.