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

fix: 주간 스케줄 저장 시 500에러 해결 #46

Merged
merged 4 commits into from
Feb 7, 2025
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 @@ -5,13 +5,12 @@
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.time.DayOfWeek;
import java.time.LocalTime;

public record WeeklyScheduleUpdateRequest(
@NotBlank
@NotNull
@Min(value = 0) @Max(value = 7)
int dayOfWeekNum, // 0 = 일요일, 1 = 월요일, ...
boolean isActive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
import com.keunsori.keunsoriserver.domain.admin.reservation.domain.WeeklySchedule;

import java.time.LocalDate;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

public record DailyAvailableResponse(
LocalDate date,
boolean isActive,
LocalTime startTime,
LocalTime endTime
String startTime,
String endTime
) {
public static DailyAvailableResponse from(DailySchedule dailySchedule){
return new DailyAvailableResponse(
dailySchedule.getDate(),
dailySchedule.isActive(),
dailySchedule.getStartTime(),
dailySchedule.getEndTime()
dailySchedule.getStartTime().format(DateTimeFormatter.ofPattern("HH:mm")),
dailySchedule.getEndTime().format(DateTimeFormatter.ofPattern("HH:mm"))
);
}

public static DailyAvailableResponse of(LocalDate date, WeeklySchedule weeklySchedule){
return new DailyAvailableResponse(
date,
weeklySchedule.isActive(),
weeklySchedule.getStartTime(),
weeklySchedule.getEndTime()
weeklySchedule.getStartTime().format(DateTimeFormatter.ofPattern("HH:mm")),
weeklySchedule.getEndTime().format(DateTimeFormatter.ofPattern("HH:mm"))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
import com.keunsori.keunsoriserver.domain.admin.reservation.domain.WeeklySchedule;
import com.keunsori.keunsoriserver.global.util.DayOfWeekUtil;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

public record WeeklyScheduleResponse(
int dayOfWeekNum, // 0 = 일요일, 1 = 월요일, ...
boolean isActive,
LocalTime startTime,
LocalTime endTime
String startTime,
String endTime
) {
public static WeeklyScheduleResponse from(WeeklySchedule weeklySchedule){
return new WeeklyScheduleResponse(
DayOfWeekUtil.getCustomDayValue(weeklySchedule.getDayOfWeek()),
weeklySchedule.isActive(),
weeklySchedule.getStartTime(),
weeklySchedule.getEndTime()
weeklySchedule.getStartTime().format(DateTimeFormatter.ofPattern("HH:mm")),
weeklySchedule.getEndTime().format(DateTimeFormatter.ofPattern("HH:mm"))
);
}
}