Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Fix: Resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
tjdtn0219 committed Nov 27, 2023
2 parents 5323839 + a082716 commit 7a53bed
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ public ResponseDto<MypageDeleteResponse> deleteMember(

return new ResponseDto<>(HttpStatus.OK.value(), mypageDeleteResponse);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import java.util.List;

import static ybe.mini.travelserver.global.security.Role.HAS_ROLE_USER;
import static ybe.mini.travelserver.global.security.Role.ROLE_USER;

@Slf4j
@RequestMapping("/reservations")
Expand All @@ -27,7 +27,7 @@ public class ReservationController {

private final ReservationService reservationService;

@PreAuthorize(HAS_ROLE_USER)
@PreAuthorize("hasRole('ROLE_USER')")
@PostMapping
public ResponseDto<ReservationCreateResponse> tryReservation (
@RequestBody @Valid ReservationCreateRequest createRequest,
Expand All @@ -51,7 +51,7 @@ public ResponseDto<ReservationCreateResponse> tryReservationFromCart (
);
}

@PreAuthorize(HAS_ROLE_USER)
@PreAuthorize("hasRole('ROLE_USER')")
@GetMapping
public ResponseDto<List<ReservationGetResponse>> getMyReservations (
@AuthenticationPrincipal PrincipalDetails principalDetails
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package ybe.mini.travelserver.domain.reservation_room.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.*;
import lombok.Builder;

import java.io.Serializable;
Expand All @@ -19,13 +18,15 @@ public record ReservationRoomCreateRequest(
Long roomTypeId,

@NotNull
@FutureOrPresent
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm")
LocalDateTime checkIn,

@NotNull
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm")
LocalDateTime checkOut,
@NotNull
@Min(value = 1, message = "숙박 인원은 최소 1명 이어야 합니다.")
Integer guestNumber
) implements Serializable {
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
@Getter
@AllArgsConstructor
public enum DTOErrorMessage implements ErrorMessage {
METHOD_ARGUMENT_NOT_VALID(BAD_REQUEST, "DTO 값이 유효하지 않습니다");
METHOD_ARGUMENT_NOT_VALID(BAD_REQUEST, "DTO 값이 유효하지 않습니다"),
;

private final HttpStatus status;
private final String message;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ public ProblemDetail handleMethodArgumentNotValidException(
String errorMessage = Objects.requireNonNull(ex.getBindingResult().getFieldError()).getDefaultMessage();
return createProblemDetail(errorMessage, METHOD_ARGUMENT_NOT_VALID.getStatus().value(), request);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,6 @@ void getMyReservations_success() {
then(reservationService).should().getMyReservations(any());
}

@Test
@DisplayName("예약 결제")
void payReservation_success() {
//given
given(reservationService.updateReservationStatusToPay(any()))
.willReturn(1L);

//when
var actual = reservationController.payReservation(1L);

//then
var expected = new ResponseDto<>(OK.value(), 1L);
assertEquals(actual, expected);
then(reservationService).should().updateReservationStatusToPay(any());
}

@Test
@DisplayName("예약 삭제")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,6 @@ void createReservation_success() {

}

@Test
void updateReservationStatusToPay_success() {
//given
given(reservationRepository.findById(anyLong())).willReturn(Optional.ofNullable(dummyReservation()));

//when
var actual = reservationService.updateReservationStatusToPay(1L);

//then
var expected = 1L;
assertEquals(actual, expected);

}

@Test
void deleteReservation_success() {
//given
Expand Down

0 comments on commit 7a53bed

Please sign in to comment.