Skip to content

Commit 13507f3

Browse files
committed
휴일 조회 시 검색 기준 설정 가능하게 변경 입력하지 않으면 현재 날짜로 입력
1 parent e944f52 commit 13507f3

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

grpc_service/service/room_exception_service.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,23 @@ class RoomExceptionServiceHandler < RoomExceptionService::Service
2525
def get_room_exceptions(request, _call)
2626
authorize!("student")
2727

28+
# 기준 날짜 파싱
29+
from_date =
30+
if request.from_date.present?
31+
Date.parse(request.from_date)
32+
else
33+
Date.today # 기본 검색 기준은 현 시점으로
34+
end
35+
2836
exceptions = ::RoomException
2937
.where(room_id: request.room_id, deleted_at: nil)
38+
.where("holiday_date >= ?", from_date)
3039
.order(:holiday_date)
3140

41+
response_items = exceptions.map { |ex| room_exception_to_proto(ex) }
42+
3243
GetRoomExceptionsResponse.new(
33-
room_exceptions: exceptions.map { |ex| room_exception_to_proto(ex) }
44+
room_exceptions: response_items
3445
)
3546
end
3647

proto_export/studyroom/room_exception/room_exception.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ message RoomException {
1818

1919
message GetRoomExceptionsRequest {
2020
int64 room_id = 1;
21+
string from_date = 2;
2122
}
2223

2324
message GetRoomExceptionsResponse {

0 commit comments

Comments
 (0)