Skip to content

Commit

Permalink
Merge pull request #96 from TecheerTeam/refactor#95
Browse files Browse the repository at this point in the history
  • Loading branch information
m3k0813 committed Jul 29, 2024
1 parent cd50168 commit e2342a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class PetBoardRequestDto {
private String title;
private String description;
private PetInfo petInfo;
private String username;
private Long userId;

public PetBoard toEntity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,22 @@ public Long createPetBoard(PetBoardRequestDto petBoardRequestDto, MultipartFile
petInfo.setPublicApi(false);
petInfo.setPetBoardStored(false);

Users user = userRepository.findById(petBoardRequestDto.getUserId())
.orElseThrow(
() -> new EntityNotFoundException("User not found with id: " + petBoardRequestDto.getUserId()));

Shelter shelter = petInfo.getShelter();
if (shelter != null) {
shelter = shelterRepository.save(shelter);
String careNm = "[개인보호] " + user.getUsername();
shelter.setCareNm(careNm);
}
petInfo.setShelter(shelter);

//PetInfo savedPetInfo = petInfoRepository.save(petInfo);

Status status = Status.fromProcessState(petInfo.getProcessState());

Users user = userRepository.findById(petBoardRequestDto.getUserId())
.orElseThrow(
() -> new EntityNotFoundException("User not found with id: " + petBoardRequestDto.getUserId()));

// Save main image to S3 and set as popfile
String mainImageUrl = null;
if (mainImage != null && !mainImage.isEmpty()) {
Expand Down

0 comments on commit e2342a2

Please sign in to comment.