Skip to content

Commit

Permalink
[#42] Refactor: Meal 에서 title 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
SY2on committed Jan 26, 2024
1 parent b9dfbd9 commit 84ace00
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class SecurityConfig {
};

private static final String[] AUTH_WHITELIST = {
"/", "/user/join", "/user/login", "/user/user-emails/{email}/exist", "/user/check-nickname",
"/","/oauths/**", "/user/join", "/user/login", "/user/user-emails/{email}/exist", "/user/check-nickname",
"/menu/**", "/restaurants/**", "/review/info","/review/list", "/oauth/**", "/inquiries/{userInquiriesId}",
"/inquiries/list", "/admin/login"
};
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/ssu/eatssu/domain/menu/dto/MenuRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@ public static class MealCreateRequest {

@Schema(description = "메뉴명 리스트", example = "[\"돈까스\", \"샐러드\", \"김치\"]")
private List<String> menuNames;

private String title;
}
}
13 changes: 1 addition & 12 deletions src/main/java/ssu/eatssu/domain/menu/entity/Meal.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,13 @@ public class Meal {
@Enumerated(EnumType.STRING)
private Restaurant restaurant;

private String title;

@OneToMany(mappedBy = "meal", cascade = CascadeType.ALL)
private List<MealMenu> mealMenus = new ArrayList<>();

private Meal(Date date, TimePart timePart, Restaurant restaurant, String title) {
public Meal(Date date, TimePart timePart, Restaurant restaurant) {
this.date = date;
this.timePart = timePart;
this.restaurant = restaurant;
this.title = title;
}

public static Meal withTitle(Date date, TimePart timePart, Restaurant restaurant, String title) {
return new Meal(date, timePart, restaurant, title);
}

public static Meal withoutTitle(Date date, TimePart timePart, Restaurant restaurant) {
return new Meal(date, timePart, restaurant, null);
}

public List<String> getMenuNames() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,7 @@ public void createMeal(Date date, Restaurant restaurant, TimePart timePart,
if (MenuValidator.validateExistedMeal(meals, request)) {
return;
}
Meal meal;

if(request.getTitle() == null){
meal = Meal.withoutTitle(date, timePart, restaurant);
} else{
meal = Meal.withTitle(date, timePart, restaurant, request.getTitle());
}
Meal meal = new Meal(date, timePart, restaurant);

mealRepository.save(meal);

Expand Down

0 comments on commit 84ace00

Please sign in to comment.