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

[멀티 모듈 연동] 킬리안(박명규) 제출합니다 🚀 #104

Open
wants to merge 108 commits into
base: audrb96
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
47236cc
feat : admin index 페이지 이동
Jun 6, 2024
9a7db21
feat : admin reservation 페이지 이동
Jun 6, 2024
4116e8c
feat : 예약 조회 API
Jun 6, 2024
5a6f7d0
test : ObjectValidator Test
Jun 6, 2024
3f21e66
test : Admin Page Test 추가
Jun 6, 2024
9e08ced
feature : ReservationDateTime Null validate 추가
Jun 6, 2024
e68de60
test : ReservationDateTimeTest 시간 포멧 출력 테스트
Jun 6, 2024
b2821a4
test : /reservation 컨트롤러 테스트
Jun 6, 2024
fe7a701
fix: theme 추가로 인한 링크 추가 및 기존 링크 수정
boorownie Jun 6, 2024
97663d9
feat: theme 추가로 인한 html 및 js 파일 생성
boorownie Jun 6, 2024
1327dd9
feature : 예약관리 API 개발
Jun 8, 2024
0e84634
test : 예약 추가 컨트롤러 테스트 추가
Jun 8, 2024
dd402af
feature : 예약 삭제 API 구현
Jun 8, 2024
3ee22f0
test : 예약 삭제 컨트롤러 테스트 구현
Jun 8, 2024
779d30e
feature : reservationRepository id 조회 추가
Jun 8, 2024
8259a2c
feature : save 구현 수정
Jun 8, 2024
2259228
test : save, delete repository 테스트 작성
Jun 8, 2024
eac45a2
refactor : 안쓰는 함수 정리, 코드 정리
Jun 8, 2024
1a44f57
feat : 데이터 베이스 설정
Jun 9, 2024
79d7678
feat : MySQL JdbcTemplate repository 구현
Jun 9, 2024
59ef1b8
refactor : InMemoryRepository test 패키지 이동
Jun 9, 2024
d7863a5
refactor : schema.sql 패키지 이동
Jun 9, 2024
0455166
feature : schema.sql 테이블이 이미 존재하는 경우 삭제하고 생성하도록 변경
Jun 9, 2024
ca9484e
bug : generatedKeyHolder 오류 수정
Jun 9, 2024
44324c3
feature: 테스트를 위한 레포지토리 빈 등록 config 생성
Jun 9, 2024
dd3f819
feature: DB 초기화 SQL 작성
Jun 9, 2024
8e7840c
test : MySQLJdbcReservationRepository 테스트 구현
Jun 9, 2024
75d3719
feature : 테이블 컬럼명 static final String 으로 변경
Jun 9, 2024
21ad71d
bug : InMemoryReservationRepository 오류 수정
Jun 9, 2024
5ef1d8a
Merge remote-tracking branch 'next-step/audrb96' into reservation-man…
Jun 9, 2024
f45c3a0
bug : 머지 중 발생한 오류 수정
Jun 9, 2024
add056e
refactor : @AutoWired 삭제
Jun 9, 2024
764919a
feat : time 페이지 컨트롤러 생성
Jun 11, 2024
accc679
feat : ReservationTime 생성 API 틀 생성
Jun 11, 2024
1bad707
refactor : 테스트 패키지 이동
Jun 11, 2024
27f49a9
test : ReservationTime생성 컨트롤러 테스트 작성
Jun 11, 2024
e3e9ef5
test : time page 테스트 추가
Jun 11, 2024
bbdce90
feature : 스키마 reservation_time 추가
Jun 12, 2024
addf956
feature : reservationTime 생성 API 추가
Jun 12, 2024
ef62d11
test : MySQLJdbcReservationTimeRepository test 추가
Jun 12, 2024
c1107c3
feature : findById() Optional 리턴하도록 변경
Jun 12, 2024
a2adf57
feature : reservation time repository Delete, findAll 기능 추가 및 테스트
Jun 12, 2024
6754cc2
feature : 전체 예약 시간 조회 API 개발
Jun 13, 2024
5bbd143
test : 전체 예약 시간 조회 API 컨트롤러 테스트
Jun 13, 2024
aa57736
refactor : 전체 조회 클래스명 변경
Jun 13, 2024
9e820c4
test : RestAssured 포트 지정
Jun 13, 2024
468c8fb
test : RestAssured 랜덤 포트 변경
Jun 13, 2024
10fe4d6
test : RestAssured 오류 수정
Jun 13, 2024
a74bfc7
feature : 예약 시간 삭제 API 개발
Jun 13, 2024
d5aea5f
test : 예약 시간 삭제 API 컨트롤러 테스트
Jun 13, 2024
fa835b8
feature : 예약 클래스 수정
Jun 13, 2024
e40115f
feature : 예약 클래스 수정으로 인한 예약 Command API 수정
Jun 13, 2024
331b7d4
feature : 예약 read 도메인 모델 생성
Jun 13, 2024
fa170ec
feature : 예약 query, command 서비스 분리
Jun 13, 2024
0d11641
feature : Reservation 전체 조회 쿼리 수정
Jun 13, 2024
d4f18d0
feature : static class time으로 리턴하도록 변경
Jun 13, 2024
bbb4f0e
feature : Theme Api, domain, service 생성
Jun 14, 2024
5827c92
test : Theme 생성 API 컨트롤러 테스트
Jun 14, 2024
bcb4bb4
feature : Theme 생성 API 개발
Jun 14, 2024
64febfe
feature : Theme findById 기능 추가
Jun 14, 2024
55d4381
feature : theme repository findAll() 기능 추가
Jun 14, 2024
24f1de5
test : Theme create Repository 테스트 작성
Jun 14, 2024
eec02a9
test : Theme 전체 조회 API 컨트롤러 테스트
Jun 14, 2024
21746b7
feature : 방탈출 테마 삭제 API 개발
Jun 14, 2024
067d434
test : 방탈출 테마 삭제 API 컨트롤러 테스트
Jun 14, 2024
0ee4f12
refactor : util 클래스 인스턴스 생성 방지 방식 변경
Jun 14, 2024
24b6b34
feature : spring validation 의존성 추가
Jun 15, 2024
cf83d08
feature : RuntimeError 예외 처리
Jun 15, 2024
bc44bee
feature : errorResponse getter 추가
Jun 15, 2024
23b7af0
feature : API requestBody validation 체크
Jun 15, 2024
79a1891
feature : 예약 시간 삭제시 validation 추가
Jun 15, 2024
c21c96b
feature : 예외 처리 수정 및 지나간 시간에는 예약할 수 없도록 validation 추가
Jun 16, 2024
68306c3
refactor : 변수명 정리
Jun 16, 2024
6a6a691
test : 예약 생성 시 생성 시간 validate 테스트 추가
Jun 17, 2024
7ff54c8
feature : 이미 존재하는 시간의 예약인지 확인 기능 추가
Jun 17, 2024
7d8c9b4
refactor : 전달 파라미터 수정
Jun 17, 2024
a8a9aa6
refactor : 전달 파라미터 수정
Jun 17, 2024
f63b475
feature : 인덱스 설정
Jun 17, 2024
b556f57
feature : 존재하는 시간은 생성할 수 없도록 validation 추가
Jun 17, 2024
cb002f6
refactor : 코드 정리
Jun 17, 2024
8878d8e
test : 이미 생성된 예약시간 validate 테스트
Jun 18, 2024
2d512fe
refactor : 코드 정리
Jun 18, 2024
8f428ea
Merge remote-tracking branch 'next-step/audrb96' into reservation-man…
Jun 18, 2024
922e01b
refactor : Reservation이 ReservationTime을 직접 참조하도록 변경
Jun 18, 2024
1f66d4a
refactor : Reservation 생성 Creator로 분리
Jun 18, 2024
1c6fcdd
feature : reservation 생성시 themeId 저장
Jun 19, 2024
8f054b2
test : 실패 테스트 수정
Jun 19, 2024
43b26d8
Merge branch 'next-step:main' into main
audrb96 Jun 19, 2024
a09d723
Merge remote-tracking branch 'origin/main' into reservation-managemen…
Jun 19, 2024
7ef0d8d
feature : 응답 status값 변경
Jun 19, 2024
3816675
feature : NotFoundException 처리
Jun 20, 2024
409837a
refactor : 함수명 정리
Jun 23, 2024
053c9d2
feature : 리뷰 반영, 예외 처리 리팩토링
Jun 23, 2024
25c2b03
refactor : ErrorKeys 팩토리 메소드 변경
Jun 23, 2024
0ba30c1
feature: 조회 오류 수정, 레포지토리 리팩토링
Jun 23, 2024
53b29f5
refactor : 함수명 변경
Jun 24, 2024
37ee56f
refactor : 멀티 모듈 적용
Jun 25, 2024
67b1d35
refactor : mysql 테스트 오류 수정
Jun 26, 2024
1d272cd
refactor : validator static 으로 변경
Jun 26, 2024
a4e2c17
refactor : 도메인에 레포지토리 적용
Jun 26, 2024
6b5c928
refactor : repository Optional 리턴하도록 변경
Jun 26, 2024
7707be8
refactor : 모듈 구조 변경
Jun 26, 2024
1e2a7cf
refactor : 패키지 수정
Jun 27, 2024
757a479
refactor : reservationTime creator, reader 개발
Jun 27, 2024
a026f45
feature : 빌드 설정
Jun 27, 2024
f30a595
chore : indent 수정
Jun 27, 2024
a0b1511
Merge remote-tracking branch 'next-step/audrb96' into reservation-man…
Jun 27, 2024
6d4df39
refactor : delete source
Jun 27, 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
18 changes: 18 additions & 0 deletions application/api/roomescape-reservation-api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
bootJar {
enabled = true
}

jar {
enabled = false
}

dependencies {
implementation project(':core:core-domain:roomescape-reservation-domain')
implementation project(':core:core-db:roomescape-mysql-jdbc-db')

implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'

testImplementation 'io.rest-assured:rest-assured:5.3.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

@SpringBootApplication
public class RoomEscapeApplication {

public static void main(String[] args) {
SpringApplication.run(RoomEscapeApplication.class, args);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ public enum ApplicationErrorCode {
CANNOT_DELETE_EXIST_RESERVATION_AT_THIS_TIME("이 시간에 존재하는 예약이 있어 삭제할 수 없습니다."),
CANNOT_CREATE_EXIST_RESERVATION_AT_THIS_TIME("이 시간에 존재하는 예약이 있어 예약을 생성할 수 없습니다."),
CANNOT_CREATE_EXIST_RESERVATION_TIME("이 시간의 예약 시간은 이미 존재하여 생성할 수 없습니다."),
NOT_FOUND_ENTITY("엔티티를 찾을 수 없습니다.");
NOT_FOUND_ENTITY_RESERVATION_TIME("예약 시간 엔티티를 찾을 수 없습니다."),
NOT_FOUND_ENTITY_THEME("테마 엔티티를 찾을 수 없습니다.");

private final String message;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.springframework.validation.BindException;
import org.springframework.validation.FieldError;
import roomescape.application.error.exception.ApplicationException;
import roomescape.domain.error.exception.DomainException;
import roomescape.error.exception.DomainException;

import java.util.Collections;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package roomescape.application.error.exception;


import roomescape.application.error.code.ApplicationErrorCode;
import roomescape.application.error.key.ApplicationErrorKeys;

public class ApplicationException extends RuntimeException {

private final ApplicationErrorCode code;

public ApplicationException(ApplicationErrorCode code) {
super(code.getMessage());
this.code = code;
}
private final ApplicationErrorKeys keys;

public ApplicationException(ApplicationErrorCode code, String message) {
super(message);
public ApplicationException(ApplicationErrorCode code, ApplicationErrorKeys keys) {
super(keys.toMessage() + code.getMessage());
this.code = code;
this.keys = keys;
}

public ApplicationErrorCode getCode() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package roomescape.application.error.exception;

import roomescape.application.error.code.ApplicationErrorCode;
import roomescape.application.error.key.ApplicationErrorKey;
import roomescape.application.error.key.ApplicationErrorKeys;
import roomescape.domain.reservationtime.ReservationTime;

import static roomescape.application.error.code.ApplicationErrorCode.CANNOT_CREATE_EXIST_RESERVATION_TIME;

public class CreateReservationTimeValidateException extends ApplicationException {

private static final String TIME_FORMAT = "HH:mm";

private static final String ERROR_KEY_NAME_START_AT = "startAt";

public CreateReservationTimeValidateException(ApplicationErrorCode code, ApplicationErrorKeys keys) {
super(code, keys);
}

public static CreateReservationTimeValidateException existTime(ReservationTime reservationTime) {
return new CreateReservationTimeValidateException(
CANNOT_CREATE_EXIST_RESERVATION_TIME,
ApplicationErrorKeys.of(
new ApplicationErrorKey(
ERROR_KEY_NAME_START_AT,
reservationTime.getFormatStartAt(TIME_FORMAT)
))
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package roomescape.application.error.exception;

import roomescape.application.error.code.ApplicationErrorCode;
import roomescape.application.error.key.ApplicationErrorKey;
import roomescape.application.error.key.ApplicationErrorKeys;
import roomescape.domain.reservation.vo.ReservationDate;
import roomescape.domain.reservationtime.ReservationTime;

import static roomescape.application.error.code.ApplicationErrorCode.CANNOT_CREATE_EXIST_RESERVATION_AT_THIS_TIME;

public class CreateReservationValidateException extends ApplicationException {

private static final String ERROR_KEY_NAME_DATE = "date";
private static final String ERROR_KEY_TIME_ID = "timeId";
private static final String DATE_FORMAT = "yyyy-MM-dd";

public CreateReservationValidateException(ApplicationErrorCode code, ApplicationErrorKeys keys) {
super(code, keys);
}

public static CreateReservationValidateException existTime(
ReservationDate reservationDate,
ReservationTime reservationTime
) {
return new CreateReservationValidateException(
CANNOT_CREATE_EXIST_RESERVATION_AT_THIS_TIME,
ApplicationErrorKeys.of(
new ApplicationErrorKey(ERROR_KEY_NAME_DATE, reservationDate.getFormatted(DATE_FORMAT)),
new ApplicationErrorKey(ERROR_KEY_TIME_ID, reservationTime.getId().toString())
)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package roomescape.application.error.exception;

import roomescape.application.error.code.ApplicationErrorCode;
import roomescape.application.error.key.ApplicationErrorKey;
import roomescape.application.error.key.ApplicationErrorKeys;
import roomescape.domain.reservationtime.vo.ReservationTimeId;

import static roomescape.application.error.code.ApplicationErrorCode.CANNOT_DELETE_EXIST_RESERVATION_AT_THIS_TIME;

public class DeleteReservationTimeValidateException extends ApplicationException {

private static final String ERROR_KEY_TIME_ID = "timeId";

public DeleteReservationTimeValidateException(ApplicationErrorCode code, ApplicationErrorKeys keys) {
super(code, keys);
}

public static DeleteReservationTimeValidateException existReservation(ReservationTimeId reservationTimeId) {
return new DeleteReservationTimeValidateException(
CANNOT_DELETE_EXIST_RESERVATION_AT_THIS_TIME,
ApplicationErrorKeys.of(
new ApplicationErrorKey(ERROR_KEY_TIME_ID, reservationTimeId.id().toString())
)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@
import roomescape.application.error.dto.ErrorResponse;
import roomescape.application.error.logger.ExceptionLogger;
import roomescape.application.error.util.ResponseEntityFactory;
import roomescape.domain.error.exception.DomainException;
import roomescape.error.exception.DomainException;
import roomescape.error.exception.NotFoundDomainException;

@Order(Ordered.HIGHEST_PRECEDENCE)
@RestControllerAdvice
public class DomainExceptionHandler {

private final ExceptionLogger exceptionLogger = new ExceptionLogger(this.getClass());

@ExceptionHandler(NotFoundDomainException.class)
public ResponseEntity<ErrorResponse> handleException(NotFoundDomainException ex) {
exceptionLogger.log(ex);

return ResponseEntityFactory.notFound(ex);
}

@ExceptionHandler(DomainException.class)
public ResponseEntity<ErrorResponse> handleException(DomainException ex) {
exceptionLogger.log(ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.springframework.web.bind.annotation.RestControllerAdvice;
import roomescape.application.error.dto.ErrorResponse;
import roomescape.application.error.exception.ApplicationException;
import roomescape.application.error.exception.NotFoundException;
import roomescape.application.error.logger.ExceptionLogger;
import roomescape.application.error.util.ResponseEntityFactory;

Expand All @@ -17,13 +16,6 @@ public class ServiceExceptionHandler {

private final ExceptionLogger exceptionLogger = new ExceptionLogger(this.getClass());

@ExceptionHandler(NotFoundException.class)
public ResponseEntity<ErrorResponse> handleException(NotFoundException ex) {
exceptionLogger.log(ex);

return ResponseEntityFactory.notFound(ex);
}

@ExceptionHandler(ApplicationException.class)
public ResponseEntity<ErrorResponse> handleException(ApplicationException ex) {
exceptionLogger.log(ex);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package roomescape.application.error.key;

public class ApplicationErrorKey {

private static final String MESSAGE_FORMAT = "[%s : %s] ";

private final String name;
private final String value;

public ApplicationErrorKey(String name, String value) {
this.name = name;
this.value = value;
}

public String toMessage() {
return String.format(MESSAGE_FORMAT, this.name, this.value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package roomescape.application.error.key;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class ApplicationErrorKeys {

private final List<ApplicationErrorKey> keys;

public ApplicationErrorKeys(List<ApplicationErrorKey> keys) {
this.keys = keys;
}

public static ApplicationErrorKeys of(ApplicationErrorKey... keys) {
return new ApplicationErrorKeys(new ArrayList<>(Arrays.asList(keys)));
}

public String toMessage() {
return keys.stream()
.map(ApplicationErrorKey::toMessage)
.collect(Collectors.joining(", "));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
import org.springframework.validation.BindException;
import roomescape.application.error.dto.ErrorResponse;
import roomescape.application.error.exception.ApplicationException;
import roomescape.application.error.exception.NotFoundException;
import roomescape.domain.error.exception.DomainException;
import roomescape.error.exception.DomainException;
import roomescape.error.exception.NotFoundDomainException;

import static org.springframework.http.HttpStatus.*;
import static roomescape.application.error.code.ApplicationErrorCode.RUN_TIME_EXCEPTION;

public final class ResponseEntityFactory {

private ResponseEntityFactory() {
throw new UnsupportedOperationException(ResponseEntityFactory.class.getName() + "의 인스턴스는 생성되어서 안됩니다.");
throw new UnsupportedOperationException(this.getClass().getName() + "의 인스턴스는 생성되어서 안됩니다.");
}

public static ResponseEntity<ErrorResponse> internalServerError(RuntimeException runtimeException) {
Expand All @@ -40,7 +40,7 @@ public static ResponseEntity<ErrorResponse> badRequest(DomainException domainExc
.body(ErrorResponse.from(domainException));
}

public static ResponseEntity<ErrorResponse> notFound(NotFoundException notFoundException) {
public static ResponseEntity<ErrorResponse> notFound(NotFoundDomainException notFoundException) {
return ResponseEntity
.status(NOT_FOUND)
.body(ErrorResponse.from(notFoundException));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package roomescape.application.api;
package roomescape.application.presentation.api;

import jakarta.validation.Valid;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import roomescape.application.api.dto.request.CreateReservationRequest;
import roomescape.application.api.dto.response.CreateReservationResponse;
import roomescape.application.presentation.api.dto.request.CreateReservationRequest;
import roomescape.application.presentation.api.dto.response.CreateReservationResponse;
import roomescape.application.service.ReservationCommandService;
import roomescape.application.service.command.DeleteReservationCommand;
import roomescape.domain.reservation.Reservation;
Expand All @@ -22,15 +22,15 @@ public ReservationCommandApi(ReservationCommandService reservationCommandService

@PostMapping("/reservations")
public ResponseEntity<CreateReservationResponse> createReservation(@RequestBody @Valid CreateReservationRequest request) {
Reservation reservation = reservationCommandService.createReservation(request.toCreateReservationCommand());
Reservation reservation = reservationCommandService.create(request.toCreateReservationCommand());

return ResponseEntity.created(URI.create(String.format("/reservations/%d", reservation.getId())))
.body(CreateReservationResponse.from(reservation));
}

@DeleteMapping("/reservations/{reservationId}")
public ResponseEntity<Void> deleteReservation(@PathVariable Long reservationId) {
reservationCommandService.deleteReservation(new DeleteReservationCommand(reservationId));
reservationCommandService.delete(new DeleteReservationCommand(reservationId));

return ResponseEntity.noContent().build();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package roomescape.application.api;
package roomescape.application.presentation.api;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import roomescape.application.api.dto.response.FindAllReservationsResponse;
import roomescape.application.presentation.api.dto.response.FindAllReservationsResponse;
import roomescape.application.service.ReservationQueryService;
import roomescape.domain.reservation.ReservationViews;

Expand All @@ -19,8 +19,8 @@ public ReservationQueryApi(ReservationQueryService reservationQueryService) {
}

@GetMapping("/reservations")
public ResponseEntity<List<FindAllReservationsResponse>> findAllReservations() {
ReservationViews reservationViews = reservationQueryService.findAllReservations();
public ResponseEntity<List<FindAllReservationsResponse>> findAll() {
ReservationViews reservationViews = reservationQueryService.findAll();

return ResponseEntity.ok(FindAllReservationsResponse.toFindAllReservationsResponses(reservationViews));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package roomescape.application.api;
package roomescape.application.presentation.api;

import jakarta.validation.Valid;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import roomescape.application.api.dto.request.CreateReservationTimeRequest;
import roomescape.application.api.dto.response.CreateReservationTimeResponse;
import roomescape.application.presentation.api.dto.request.CreateReservationTimeRequest;
import roomescape.application.presentation.api.dto.response.CreateReservationTimeResponse;
import roomescape.application.service.ReservationTimeService;
import roomescape.application.service.command.DeleteReservationTimeCommand;
import roomescape.domain.reservationtime.ReservationTime;
Expand All @@ -21,20 +21,19 @@ public ReservationTimeCommandApi(ReservationTimeService reservationTimeService)
}

@PostMapping("/times")
public ResponseEntity<CreateReservationTimeResponse> createReservationTime(
public ResponseEntity<CreateReservationTimeResponse> create(
@RequestBody @Valid CreateReservationTimeRequest request
) {
ReservationTime reservationTime =
reservationTimeService.createReservationTime(request.toCreateReservationTimeCommand());
ReservationTime reservationTime = reservationTimeService.create(request.toCommand());

return ResponseEntity
.created(URI.create(String.format("/times/%d", reservationTime.getId())))
.body(CreateReservationTimeResponse.from(reservationTime));
}

@DeleteMapping("/times/{reservationTimeId}")
public ResponseEntity<Void> deleteReservationTime(@PathVariable Long reservationTimeId) {
reservationTimeService.deleteReservationTime(new DeleteReservationTimeCommand(reservationTimeId));
public ResponseEntity<Void> delete(@PathVariable Long reservationTimeId) {
reservationTimeService.delete(new DeleteReservationTimeCommand(reservationTimeId));

return ResponseEntity.noContent().build();
}
Expand Down
Loading