Skip to content

Commit

Permalink
feat: 예약 조회에 예약자 회사명 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
nuyh99 committed Jan 3, 2024
1 parent 1934088 commit e036a4e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

public record ReservationResponse(Long id, Status status, String cancelReason, LocalDateTime startTime,
LocalDateTime endTime, String name, String phone, LocalDateTime reservedAt,
Long roomId, String roomName) {
Long roomId, String roomName, String company) {

public static ReservationResponse of(final Reservation reservation, final Member member, final Room room) {
return new ReservationResponse(
reservation.getId(), reservation.getStatus(), reservation.getCancelReason(),
reservation.getStartTime(), reservation.getEndTime(), member.getName(), member.getPhone(),
reservation.getCreatedTime(), room.getId(), room.getName());
reservation.getCreatedTime(), room.getId(), room.getName(), member.getCompany());
}
}
23 changes: 13 additions & 10 deletions src/main/resources/static/api/openapi3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ paths:
현재 유저 정보 조회하기:
value: "{\"name\":\"연어\",\"phone\":\"01012341234\",\"email\":\"\
[email protected]\",\"role\":\"USER\",\"company\":\"우형\",\"region\"\
:\"BUSAN\",\"createdAt\":\"2024-01-03T18:20:13.450063\"}"
:\"BUSAN\",\"createdAt\":\"2024-01-03T18:43:32.259641\"}"
post:
tags:
- members
Expand Down Expand Up @@ -276,18 +276,18 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/reservations-117751723'
$ref: '#/components/schemas/reservations1059448458'
examples:
자신의 회의실 예약 목록 최신 순으로 보기:
value: "[{\"id\":1,\"status\":\"RESERVED\",\"cancelReason\":null,\"\
startTime\":\"2024-01-03T18:20:15.252433\",\"endTime\":\"2024-01-03T20:20:15.252438\"\
startTime\":\"2024-01-03T18:43:33.966951\",\"endTime\":\"2024-01-03T20:43:33.966958\"\
,\"name\":\"황재현\",\"phone\":\"01012341234\",\"reservedAt\":\"\
2024-01-03T18:20:15.252449\",\"roomId\":1,\"roomName\":\"대회의실\"\
},{\"id\":2,\"status\":\"CANCELED\",\"cancelReason\":\"쓰기 싫어졌어\
..\",\"startTime\":\"2024-01-03T18:20:15.252458\",\"endTime\"\
:\"2024-01-03T20:20:15.252459\",\"name\":\"황재현\",\"phone\":\"\
01012341234\",\"reservedAt\":\"2024-01-03T18:20:15.252462\",\"\
roomId\":1,\"roomName\":\"대회의실\"}]"
2024-01-03T18:43:33.966968\",\"roomId\":1,\"roomName\":\"대회의실\"\
,\"company\":\"요기요\"},{\"id\":2,\"status\":\"CANCELED\",\"cancelReason\"\
:\"쓰기 싫어졌어요..\",\"startTime\":\"2024-01-03T18:43:33.966976\",\"\
endTime\":\"2024-01-03T20:43:33.966978\",\"name\":\"황재현\",\"phone\"\
:\"01012341234\",\"reservedAt\":\"2024-01-03T18:43:33.96698\"\
,\"roomId\":1,\"roomName\":\"대회의실\",\"company\":\"토스뱅크\"}]"
post:
tags:
- reservations
Expand Down Expand Up @@ -476,7 +476,7 @@ components:
roomId:
type: number
description: 회의실 ID
reservations-117751723:
reservations1059448458:
type: array
items:
type: object
Expand All @@ -487,6 +487,9 @@ components:
name:
type: string
description: 예약자 성함
company:
type: string
description: 예약자 회사
startTime:
type: string
description: 시작 시각
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ void findAll() throws Exception {

final ReservationResponse reservation1 = new ReservationResponse(
1L, Status.RESERVED, null, LocalDateTime.now(), LocalDateTime.now().plusHours(2),
"황재현", "01012341234", LocalDateTime.now(), 1L, "대회의실");
"황재현", "01012341234", LocalDateTime.now(), 1L, "대회의실", "요기요");
final ReservationResponse reservation2 = new ReservationResponse(
2L, Status.CANCELED, "쓰기 싫어졌어요..", LocalDateTime.now(), LocalDateTime.now().plusHours(2),
"황재현", "01012341234", LocalDateTime.now(), 1L, "대회의실");
"황재현", "01012341234", LocalDateTime.now(), 1L, "대회의실", "토스뱅크");

given(reservationService.findAll(any(), any()))
.willReturn(List.of(reservation1, reservation2));
Expand All @@ -160,6 +160,7 @@ void findAll() throws Exception {
fieldWithPath("[].phone").description("예약자 휴대폰 번호"),
fieldWithPath("[].reservedAt").description("예약 일시"),
fieldWithPath("[].roomId").description("회의실 ID"),
fieldWithPath("[].company").description("예약자 회사"),
fieldWithPath("[].roomName").description("회의실 이름"))))
.andReturn()
.getResponse();
Expand Down

0 comments on commit e036a4e

Please sign in to comment.