Skip to content

Commit

Permalink
refactor: itinerary 필드 접근 제어 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
JeongUijeong committed Oct 31, 2023
1 parent 7b8a7f7 commit 4fd8f12
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public class Accommodation extends Itinerary{
@Builder
public Accommodation(Long id, Trip trip, String itineraryName, String accommodationName, String accommodationRoadAddressName,
LocalDateTime checkIn, LocalDateTime checkOut) {
super(id, trip, itineraryName);
this.id = id;
this.trip = trip;
this.itineraryName = itineraryName;
this.accommodationName = accommodationName;
this.accommodationRoadAddressName = accommodationRoadAddressName;
this.checkIn = checkIn;
Expand All @@ -43,7 +45,7 @@ public AccommodationResponseDTO toAccommodationResponseDTO() {

public void updateAccommodationInfo(String itineraryName, String accommodationName,
String accommodationRoadAddressName, LocalDateTime checkIn, LocalDateTime checkOut) {
super.updateItineraryName(itineraryName);
this.itineraryName = itineraryName;
this.accommodationName = accommodationName;
this.accommodationRoadAddressName = accommodationRoadAddressName;
this.checkIn = checkIn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,11 @@ public abstract class Itinerary {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
protected Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "trip_id")
private Trip trip;
protected Trip trip;

private String itineraryName;

public Itinerary(Long id, Trip trip, String itineraryName) {
this.id = id;
this.trip = trip;
this.itineraryName = itineraryName;
}

protected void updateItineraryName(String itineraryName) {
this.itineraryName = itineraryName;
}
protected String itineraryName;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public class Transportation extends Itinerary{
public Transportation(Long id, Trip trip, String itineraryName, String transportation, String departurePlace,
String departurePlaceRoadAddressName, String destination, String destinationRoadAddressName,
LocalDateTime arrivalTime, LocalDateTime departureTime) {
super(id, trip, itineraryName);
this.id = id;
this.trip = trip;
this.itineraryName = itineraryName;
this.transportation = transportation;
this.departurePlace = departurePlace;
this.departurePlaceRoadAddressName = departurePlaceRoadAddressName;
Expand All @@ -56,7 +58,7 @@ public TransportationResponseDTO toTransportationResponseDTO() {
public void updateTransportationInfo(String itineraryName, String transportation,
String departurePlace, String departurePlaceRoadAddressName, String destination,
String destinationRoadAddressName, LocalDateTime departureTime, LocalDateTime arrivalTime) {
super.updateItineraryName(itineraryName);
this.itineraryName = itineraryName;
this.transportation = transportation;
this.departurePlace = departurePlace;
this.departurePlaceRoadAddressName = departurePlaceRoadAddressName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ public class Visit extends Itinerary {
private LocalDateTime departureTime;

@Builder
public Visit(Long id, Trip trip, String itineraryName, String placeName, String placeRoadAddressName, LocalDateTime arrivalTime,
LocalDateTime departureTime) {
super(id, trip, itineraryName);
public Visit(Long id, Trip trip, String itineraryName, String placeName,
String placeRoadAddressName, LocalDateTime arrivalTime, LocalDateTime departureTime) {
this.id = id;
this.trip = trip;
this.itineraryName = itineraryName;
this.placeName = placeName;
this.placeRoadAddressName = placeRoadAddressName;
this.arrivalTime = arrivalTime;
Expand All @@ -42,7 +44,7 @@ public VisitResponseDTO toVisitResponseDTO() {

public void updateVisitInfo(String itineraryName, String placeName, String placeRoadAddressName,
LocalDateTime visitDepartureTime, LocalDateTime visitArrivalTime) {
super.updateItineraryName(itineraryName);
this.itineraryName = itineraryName;
this.placeName = placeName;
this.placeRoadAddressName = placeRoadAddressName;
this.departureTime = visitDepartureTime;
Expand Down

0 comments on commit 4fd8f12

Please sign in to comment.