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

[Backend : feat] Country 엔티티에 필요없는 정보 삭제 #126

Merged
merged 2 commits into from
Aug 8, 2024
Merged
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 @@ -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
Loading