Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 24 additions & 4 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379

mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: testdb
MYSQL_USER: testuser
MYSQL_PASSWORD: testpass
options: >-
--health-cmd="mysqladmin ping -h localhost"
--health-interval=10s
--health-timeout=5s
--health-retries=5
ports:
- 3306:3306

steps:
- name: Checkout Repository
Expand All @@ -38,9 +55,12 @@ jobs:
echo "jwt.secret.key=${{ secrets.JWT_SECRET_KEY }}" >> ./src/main/resources/application.properties
echo "spring.redis.host=redis" >> ./src/main/resources/application.properties
echo "spring.redis.port=6379" >> ./src/main/resources/application.properties
echo "spring.datasource.url=jdbc:mysql://localhost:3306/testdb" >> ./src/main/resources/application.properties
echo "spring.datasource.username=testuser" >> ./src/main/resources/application.properties
echo "spring.datasource.password=testpass" >> ./src/main/resources/application.properties
echo "spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver" >> ./src/main/resources/application.properties
echo "spring.jpa.hibernate.ddl-auto=update" >> ./src/main/resources/application.properties
echo "spring.jpa.show-sql=true" >> ./src/main/resources/application.properties

- name: Build Project
run: ./gradlew clean build

- name: Run Tests
run: ./gradlew test
run: ./gradlew clean build -x test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import lombok.RequiredArgsConstructor;
import org.example.siljeun.domain.payment.dto.PaymentConfirmRequestDto;
import org.example.siljeun.domain.payment.service.PaymentService;
import org.example.siljeun.global.security.PrincipalDetails;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -27,9 +29,11 @@ public String index() {
@GetMapping("/success")
@ResponseBody
public ResponseEntity<String> sandboxSuccess(@RequestParam String paymentKey,
@RequestParam Long userId,
@AuthenticationPrincipal PrincipalDetails userDetails,
@RequestParam Long seatScheduleInfoId,
@RequestParam Long amount) {
Long userId = userDetails.getUserId();

System.out.println("결제 성공 콜백 도착");
System.out.println("paymentKey: " + paymentKey);
System.out.println("userId: " + userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.example.siljeun.domain.reservation.dto.response.ReservationInfoResponse;
import org.example.siljeun.domain.reservation.service.ReservationService;
import org.example.siljeun.global.dto.ResponseDto;
import org.example.siljeun.global.security.CustomUserDetails;
import org.example.siljeun.global.security.PrincipalDetails;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.DeleteMapping;
Expand All @@ -26,7 +26,7 @@ public class ReservationController {

@PatchMapping("/{reservationId}/discount")
public ResponseEntity<ResponseDto<Void>> updatePrice(
@AuthenticationPrincipal CustomUserDetails userDetails,
@AuthenticationPrincipal PrincipalDetails userDetails,
@PathVariable Long reservationId,
@RequestBody @Valid UpdatePriceRequest requestDto) {
String username = userDetails.getUsername();
Expand All @@ -36,15 +36,15 @@ public ResponseEntity<ResponseDto<Void>> updatePrice(

@DeleteMapping("/{reservationId}")
public ResponseEntity<ResponseDto<Void>> delete(
@AuthenticationPrincipal CustomUserDetails userDetails, @PathVariable Long reservationId) {
@AuthenticationPrincipal PrincipalDetails userDetails, @PathVariable Long reservationId) {
String username = userDetails.getUsername();
reservationService.delete(username, reservationId);
return ResponseEntity.ok(ResponseDto.success("예매 취소 완료", null));
}

@GetMapping("/{reservationId}")
public ResponseEntity<ResponseDto<ReservationInfoResponse>> findById(
@AuthenticationPrincipal CustomUserDetails userDetails, @PathVariable Long reservationId) {
@AuthenticationPrincipal PrincipalDetails userDetails, @PathVariable Long reservationId) {
String username = userDetails.getUsername();
ReservationInfoResponse dto = reservationService.findById(username, reservationId);
return ResponseEntity.ok(ResponseDto.success("예매 조회 성공", dto));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

import lombok.RequiredArgsConstructor;
import org.example.siljeun.domain.schedule.service.SeatScheduleInfoService;
import org.example.siljeun.domain.seat.dto.response.SeatScheduleInfoResponse;
import org.example.siljeun.global.security.CustomUserDetails;
import org.example.siljeun.global.security.PrincipalDetails;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
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.RequestMapping;

import java.util.List;
import java.util.Map;
Expand All @@ -24,7 +22,7 @@ public class SeatScheduleInfoController {
@PostMapping("/seat-schedule-info/{seatScheduleInfoId}")
public ResponseEntity<String> selectSeat(
@PathVariable Long seatScheduleInfoId,
@AuthenticationPrincipal CustomUserDetails userDetails
@AuthenticationPrincipal PrincipalDetails userDetails
){
seatScheduleInfoService.selectSeat(userDetails.getUserId(), seatScheduleInfoId);
return ResponseEntity.ok("좌석이 선택되었습니다.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.sessionManagement(session -> session
.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(auth -> auth
.requestMatchers("/auth/**", "/oauth2/**", "/login/**", "/ws/**", "/ws").permitAll()
.requestMatchers("/auth/**", "/oauth2/**", "/login/**", "/ws/**", "/ws","/checkout.html","/payments","/success.html").permitAll()
.anyRequest().authenticated()
)
// .oauth2Login(oauth2 -> oauth2
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/checkout.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
// ------ '결제하기' 버튼 누르면 결제창 띄우기 ------
button.addEventListener("click", async function () {
await widgets.requestPayment({
orderId: "lU3SuueaaxS1gJbn4bECN6",
orderId: "lU3SuueaaxS1gJbn4bEC12",
orderName: "토스 티셔츠 외 2건",
successUrl: window.location.origin + "/success.html",
failUrl: window.location.origin + "/fail.html",
Expand Down