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

[1 - 2단계 방탈출 예약 대기] 리브(김민주) 미션 제출합니다. #13

Merged
merged 42 commits into from
May 20, 2024
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3f4a417
migrate first mission code
Minjoo522 May 14, 2024
a938996
chore: 의존성 추가
Minjoo522 May 14, 2024
84f3c95
chore: yml을 properties로 변경
Minjoo522 May 14, 2024
20e8418
refactor: 토큰 만료기한 설정
Minjoo522 May 14, 2024
00b100a
feat: Member 엔티티에 JPA 도입
Minjoo522 May 14, 2024
4244018
feat: Reservation, ReservationTime, Theme 엔티티에 JPA 도입
Minjoo522 May 14, 2024
aec9a5a
feat: [2단계] 내 예약 목록 조회 기능 클라이언트 코드
woowabrie May 11, 2024
5c12370
feat: 유저 예약 조회 페이지 렌더링
Minjoo522 May 15, 2024
c420dcd
feat: 유저 예약 조회 api 구현
Minjoo522 May 15, 2024
4f9e9a3
style: 코드 포멧팅
Minjoo522 May 15, 2024
c224b2b
feat: Member equals, hashCode 재정의
Minjoo522 May 15, 2024
7f9ef62
chore: 불필요한 의존성 제거
Minjoo522 May 15, 2024
0e2303e
style: 불필요한 개행 제거 및 개행 추가
Minjoo522 May 15, 2024
2420b10
refactor: SpringBootTest random port 사용 및 추상 클래스로 중복 제거
Minjoo522 May 16, 2024
a067267
refactor: 변수명 명확하게 변경
Minjoo522 May 16, 2024
f038f01
refactor: Member 정보 List가 아닌 Object 형식으로 응답
Minjoo522 May 16, 2024
d1a8b3c
refactor: Reservation 정보 List가 아닌 Object 형식으로 응답
Minjoo522 May 16, 2024
9baf5b7
refactor: user Reservation 정보 List가 아닌 Object 형식으로 응답
Minjoo522 May 16, 2024
a4ed374
refactor: ReservationTime 정보 List가 아닌 Object 형식으로 응답
Minjoo522 May 16, 2024
b18ba89
refactor: ReservationStatus 정보 List가 아닌 Object 형식으로 응답
Minjoo522 May 16, 2024
476c202
refactor: Theme 정보 List가 아닌 Object 형식으로 응답
Minjoo522 May 16, 2024
ecd0398
refactor: List<ReservationStatus>를 담는 일급 객체 사용하도록 변경
Minjoo522 May 16, 2024
799af57
refactor: 예약 생성 관련 코드 하나로 통합
Minjoo522 May 16, 2024
dddb6f4
refactor: 예약된 테마 시간 JPQL 사용하지 않도록 변경
Minjoo522 May 16, 2024
59be832
refactor: 예약 관련 관리자 API 분리
Minjoo522 May 16, 2024
9f2d268
refactor: 회원 조회 관련 관리자만 접근 가능한 API로 변경
Minjoo522 May 16, 2024
7b94d74
test: 불필요한 테스트 삭제
Minjoo522 May 16, 2024
edf9e2f
refactor: 테스트 속도를 위해 @DirtiesContext 제거
Minjoo522 May 16, 2024
3706585
test: 불필요한 테스트 제거
Minjoo522 May 16, 2024
20351f7
style: 개행 추가
Minjoo522 May 16, 2024
69c9929
refactor: createReservation -> create 메서드 명 변경
Minjoo522 May 16, 2024
a06f5af
refactor: Member의 name, email, password 포장
Minjoo522 May 17, 2024
9a5323a
refactor: Member, Role 패키지 이동
Minjoo522 May 17, 2024
bfcac76
refactor: vo equals & hashCode 재정의
Minjoo522 May 17, 2024
a59e0a4
refactor: 예외 응답 객체 사용 및 커스텀 애플리케이션 예외 추상 클래스 생성
Minjoo522 May 18, 2024
92b5148
refactor: IllegalArgumentException -> 커스텀 예외로 변경
Minjoo522 May 18, 2024
5b3d5d1
refactor: 예외 객체가 다양한 자료형을 받을 수 있도록 변경
Minjoo522 May 18, 2024
92fbca0
refactor: id 유효성 검사 커스텀 어노테이션 생성 및 사용
Minjoo522 May 18, 2024
c6c744e
refactor: 유효성 검사 접근 제한자 private으로 변경
Minjoo522 May 18, 2024
29eee7f
refactor: 예약 유효성 검사 및 생성 메서드 이름 변경
Minjoo522 May 18, 2024
230f5e3
refactor: @Transactional 사용
Minjoo522 May 19, 2024
cd71c48
refactor: 메서드 이름 역할에 맞게 변경
Minjoo522 May 19, 2024
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
Prev Previous commit
Next Next commit
refactor: ReservationTime 정보 List가 아닌 Object 형식으로 응답
Minjoo522 committed May 16, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit a4ed3745a6fbf82af3fc7352e1c6f93a1366de49
Original file line number Diff line number Diff line change
@@ -18,7 +18,8 @@
import roomescape.domain.ReservationTime;
import roomescape.service.dto.request.ReservationTimeSaveRequest;
import roomescape.service.dto.response.ReservationStatusResponse;
import roomescape.service.dto.response.ReservationTimeResponse;
import roomescape.service.dto.response.reservationTime.ReservationTimeResponse;
import roomescape.service.dto.response.reservationTime.ReservationTimeResponses;
import roomescape.service.reservationtime.ReservationTimeCreateService;
import roomescape.service.reservationtime.ReservationTimeDeleteService;
import roomescape.service.reservationtime.ReservationTimeFindService;
@@ -40,13 +41,9 @@ public ReservationTimeApiController(ReservationTimeCreateService reservationTime
}

@GetMapping("/times")
public ResponseEntity<List<ReservationTimeResponse>> getReservationTimes() {
public ResponseEntity<ReservationTimeResponses> getReservationTimes() {
List<ReservationTime> reservationTimes = reservationTimeFindService.findReservationTimes();
return ResponseEntity.ok(
reservationTimes.stream()
.map(ReservationTimeResponse::new)
.toList()
);
return ResponseEntity.ok(ReservationTimeResponses.from(reservationTimes));
}

@GetMapping("/times/available")
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

import java.time.LocalDate;
import roomescape.domain.Reservation;
import roomescape.service.dto.response.ReservationTimeResponse;
import roomescape.service.dto.response.reservationTime.ReservationTimeResponse;
import roomescape.service.dto.response.ThemeResponse;
import roomescape.service.dto.response.member.MemberIdAndNameResponse;

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package roomescape.service.dto.response;
package roomescape.service.dto.response.reservationTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalTime;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package roomescape.service.dto.response.reservationTime;

import java.util.List;
import roomescape.domain.ReservationTime;

public record ReservationTimeResponses(List<ReservationTimeResponse> reservationTimes) {

public static ReservationTimeResponses from(List<ReservationTime> reservationTimes) {
List<ReservationTimeResponse> responses = reservationTimes.stream()
.map(ReservationTimeResponse::new)
.toList();
return new ReservationTimeResponses(responses);
}
}
2 changes: 1 addition & 1 deletion src/main/resources/static/js/reservation-with-member.js
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ function render(data) {
function fetchTimes() {
requestRead(TIME_API_ENDPOINT)
.then(data => {
timesOptions.push(...data);
timesOptions.push(...data.reservationTimes);
})
.catch(error => console.error('Error fetching time:', error));
}
2 changes: 1 addition & 1 deletion src/main/resources/static/js/time.js
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ function render(data) {
const tableBody = document.getElementById('table-body');
tableBody.innerHTML = '';

data.forEach(item => {
data.reservationTimes.forEach(item => {
const row = tableBody.insertRow();

cellFields.forEach((field, index) => {
Original file line number Diff line number Diff line change
@@ -8,8 +8,6 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import roomescape.controller.BaseControllerTest;

public class ReservationTimeApiControllerTest extends BaseControllerTest {
@@ -38,7 +36,7 @@ void ReservationTime_CREATE_READ_DELETE_Success() {
.when().get("/times")
.then().log().all()
.statusCode(200)
.body("size()", is(3));
.body("reservationTimes.size()", is(3));

RestAssured.given().log().all()
.when().delete("/times/3")