Skip to content

Commit

Permalink
[Backend : feat] Country 엔티티에 필요없는 정보 삭제 (#126)
Browse files Browse the repository at this point in the history
* WIP on backend/feature/120-receipt-api

* fix : 충돌 해결 및 주석 처리
  • Loading branch information
Dayon-Hong authored Aug 8, 2024
1 parent 32b625d commit 1ba72fd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class Country {

private String currencyCode ;

@OneToMany (mappedBy = "country")
private List<Schedule> schedules;
private String currencyName ;

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class SaveScheduleImageRequest {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime saveDate;

public Long scheduleId() {
return scheduleId;
}
// public Long scheduleId() {
// return scheduleId;
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
import lombok.Getter;

@Getter
public final class SaveScheduleImageResponse {
private final ScheduleImage scheduleImage;
public class SaveScheduleImageResponse {
private Long id;
private Long scheduleId;
private String path;

public SaveScheduleImageResponse(ScheduleImage scheduleImage) {
this.scheduleImage = scheduleImage;
this.id = scheduleImage.getId();
this.scheduleId = scheduleImage.getSchedule().getId();
this.path = scheduleImage.getPath();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public ScheduleImageS3Repository(S3Template s3template,
}

public String save(SaveScheduleImageRequest request, MultipartFile image) {
String path = IMAGE + request.scheduleId() + SLASH + image.getOriginalFilename();
String path = IMAGE + request.getScheduleId() + SLASH + image.getOriginalFilename();
S3Resource result = s3template.upload(bucketName, path, getInputStream(image));
return getUrl(result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class ScheduleImageService implements SaveImageService {
@Override
public SaveScheduleImageResponse save(SaveScheduleImageRequest request, MultipartFile image) {
String imagePath = scheduleImageS3Repository.save(request, image);
Schedule schedule = scheduleRepository.findById(request.scheduleId()).orElseThrow(IllegalArgumentException::new);
Schedule schedule = scheduleRepository.findById(request.getScheduleId()).orElseThrow(IllegalArgumentException::new);
ScheduleImage scheduleImage = new ScheduleImage(schedule, imagePath);

scheduleImageRepository.save(scheduleImage);
Expand Down

0 comments on commit 1ba72fd

Please sign in to comment.