From 7a3f5e0b43caf2df5322dc394a6598377815fc17 Mon Sep 17 00:00:00 2001 From: jcw1031 Date: Sun, 3 Mar 2024 10:30:07 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=EB=8B=A4=EC=9D=8C=EB=82=A0=20?= =?UTF-8?q?=EC=8B=9D=EB=8B=A8=20=EB=A9=94=EB=89=B4=EC=97=90=20operatingTim?= =?UTF-8?q?e=EC=9D=B4=20=ED=98=84=EC=9E=AC=20=EB=82=A0=EC=A7=9C=20?= =?UTF-8?q?=EA=B8=B0=EC=A4=80=EC=9D=B4=EC=97=88=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 4 ++-- .../controller/dto/menu/MealListDto.java | 5 ++-- .../controller/dto/menu/MenuResponse.java | 1 - .../java/ac/knu/likeknu/domain/Cafeteria.java | 23 +++++++++---------- .../ac/knu/likeknu/service/MenuService.java | 1 - src/main/resources/application.properties | 11 +-------- 6 files changed, 17 insertions(+), 28 deletions(-) diff --git a/build.gradle b/build.gradle index 395a8b80..126bd4cf 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' - id 'org.springframework.boot' version '3.1.3' - id 'io.spring.dependency-management' version '1.1.3' + id 'org.springframework.boot' version '3.2.3' + id 'io.spring.dependency-management' version '1.1.4' } group = 'ac.knu' diff --git a/src/main/java/ac/knu/likeknu/controller/dto/menu/MealListDto.java b/src/main/java/ac/knu/likeknu/controller/dto/menu/MealListDto.java index 7bfe755f..7b6d946e 100644 --- a/src/main/java/ac/knu/likeknu/controller/dto/menu/MealListDto.java +++ b/src/main/java/ac/knu/likeknu/controller/dto/menu/MealListDto.java @@ -9,6 +9,7 @@ import java.time.LocalDate; import java.util.ArrayList; +import java.util.Collections; import java.util.List; @Getter @@ -40,7 +41,7 @@ public static MealListDto of(MealType mealType, Cafeteria cafeteria, Menu menu) return MealListDto.builder() .mealType(mealType.getMealTypeKr()) - .operatingTime(cafeteria.getTime(mealType)) + .operatingTime(cafeteria.getTime(mealType, menu.getMenuDate())) .menus(menuList) .date(menu.getMenuDate()) .build(); @@ -49,7 +50,7 @@ public static MealListDto of(MealType mealType, Cafeteria cafeteria, Menu menu) public static MealListDto empty(MealType mealType, LocalDate date) { return MealListDto.builder() .mealType(mealType.getMealTypeKr()) - .menus(new ArrayList<>()) + .menus(Collections.emptyList()) .date(date) .build(); } diff --git a/src/main/java/ac/knu/likeknu/controller/dto/menu/MenuResponse.java b/src/main/java/ac/knu/likeknu/controller/dto/menu/MenuResponse.java index c2994ba2..803ed254 100644 --- a/src/main/java/ac/knu/likeknu/controller/dto/menu/MenuResponse.java +++ b/src/main/java/ac/knu/likeknu/controller/dto/menu/MenuResponse.java @@ -34,5 +34,4 @@ public static MenuResponse of(Cafeteria cafeteria, Map= 6; + private boolean isWeekend(LocalDate date) { + return date.getDayOfWeek().getValue() >= 6; } private boolean isBreakfast(MealType mealType) { diff --git a/src/main/java/ac/knu/likeknu/service/MenuService.java b/src/main/java/ac/knu/likeknu/service/MenuService.java index 82a00417..3f8b2c0c 100644 --- a/src/main/java/ac/knu/likeknu/service/MenuService.java +++ b/src/main/java/ac/knu/likeknu/service/MenuService.java @@ -53,5 +53,4 @@ private MealListDto findRepositoryAndMapDto(MealType mealType, Cafeteria cafeter .map(menu -> MealListDto.of(mealType, cafeteria, menu)) .orElse(MealListDto.empty(mealType, date)); } - } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 24c6e4b4..257b3064 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,10 +1 @@ -spring.datasource.url=jdbc:mysql://${DB_HOST}:${DB_PORT}/${DB_SCHEMA}?characterEncoding=UTF-8&serverTimezone=UTC -spring.datasource.username=${DB_USERNAME} -spring.datasource.password=${DB_PASSWORD} - -spring.jpa.hibernate.ddl-auto=validate - -admin.username=${ADMIN_USERNAME} -admin.password=${ADMIN_PASSWORD} - -slack.webhook=${SLACK_WEBHOOK} +spring.profiles.active=dev \ No newline at end of file From 6bf26c27197cdad83734fa8f2809fe8e770b5137 Mon Sep 17 00:00:00 2001 From: jcw1031 Date: Sun, 3 Mar 2024 10:31:31 +0900 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20application.properties=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.properties | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 257b3064..24c6e4b4 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1,10 @@ -spring.profiles.active=dev \ No newline at end of file +spring.datasource.url=jdbc:mysql://${DB_HOST}:${DB_PORT}/${DB_SCHEMA}?characterEncoding=UTF-8&serverTimezone=UTC +spring.datasource.username=${DB_USERNAME} +spring.datasource.password=${DB_PASSWORD} + +spring.jpa.hibernate.ddl-auto=validate + +admin.username=${ADMIN_USERNAME} +admin.password=${ADMIN_PASSWORD} + +slack.webhook=${SLACK_WEBHOOK}