Skip to content

Commit

Permalink
[refactor]: 패키지 정리 및 리팩토링 (#74)
Browse files Browse the repository at this point in the history
Co-authored-by: EunChanNam <namhm23@gmail.com>
  • Loading branch information
ssssujini99 and EunChanNam authored Jan 14, 2024
1 parent 2332c10 commit 768ce6c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 80 deletions.
41 changes: 41 additions & 0 deletions api/src/main/java/dev/hooon/booking/BookingApiController.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,34 @@
import org.springframework.data.web.PageableDefault;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import dev.hooon.auth.annotation.NoAuth;
import dev.hooon.auth.jwt.JwtAuthorization;
import dev.hooon.booking.application.BookingService;
import dev.hooon.booking.application.fascade.TicketBookingFacade;
import dev.hooon.booking.dto.request.TicketBookingRequest;
import dev.hooon.booking.dto.response.BookingCancelResponse;
import dev.hooon.booking.dto.response.BookingListResponse;
import dev.hooon.booking.dto.response.TicketBookingResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;

@Tag(name = "Booking API")
@RestController
@RequiredArgsConstructor
public class BookingApiController {

private final BookingService bookingService;
private final TicketBookingFacade ticketBookingFacade;

@GetMapping("/api/users/booking")
@Operation(summary = "예매 조회 API", description = "예매를 조회한다")
Expand All @@ -36,4 +48,33 @@ public ResponseEntity<BookingListResponse> getBookings(
);
return ResponseEntity.ok(bookingListResponse);
}

@PostMapping("/api/bookings/cancel/{booking_id}")
@Operation(summary = "예매 취소 API", description = "예매를 취소한다")
@ApiResponse(responseCode = "200", useReturnTypeSchema = true)
public ResponseEntity<BookingCancelResponse> cancelBooking(
@Parameter(hidden = true) @JwtAuthorization Long userId,
@PathVariable("booking_id") Long bookingId
) {
BookingCancelResponse bookingCancelResponse = bookingService.cancelBooking(
userId,
bookingId
);
return ResponseEntity.ok(bookingCancelResponse);
}

@NoAuth
@PostMapping("/api/bookings")
@Operation(summary = "티켓 예매 API", description = "티켓을 예매한다")
@ApiResponse(responseCode = "200", useReturnTypeSchema = true)
public ResponseEntity<TicketBookingResponse> bookingTicket(
@Parameter(hidden = true) @JwtAuthorization Long userId,
@Valid @RequestBody TicketBookingRequest ticketBookingRequest
) {
TicketBookingResponse ticketBookingResponse = ticketBookingFacade.bookingTicket(
userId,
ticketBookingRequest.seatIds()
);
return ResponseEntity.ok(ticketBookingResponse);
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.hooon.bookingcancel;
package dev.hooon.booking;

import static org.springframework.http.HttpHeaders.*;
import static org.springframework.http.MediaType.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.hooon.ticketbooking;
package dev.hooon.booking;

import static org.springframework.http.HttpHeaders.*;
import static org.springframework.http.MediaType.*;
Expand Down

0 comments on commit 768ce6c

Please sign in to comment.