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
138 changes: 69 additions & 69 deletions .github/workflows/dev_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
name: LuckyVicky CI/CD

on:
pull_request:
types:
- closed
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop'

steps:
# 1. GitHub 저장소에서 코드 체크아웃
- name: Checkout
uses: actions/checkout@v4

# 2. JDK 17 설정
- name: Set up JDK 17
uses: actions/setup-java@v4.0.0
with:
java-version: '17'
distribution: 'adopt'

# 3. gradlew 파일 실행 권한 추가
- name: Grant execute permission for gradlew
run: chmod +x gradlew
shell: bash

# 4. Gradle 빌드 (테스트는 제외)
- name: Build with Gradle
run: ./gradlew clean build -x test
shell: bash

# 5. 현재 시간 가져오기 (배포 버전 레이블에 사용)
- name: Get current time
uses: josStorer/get-current-time@v2
id: current-time
with:
format: 'YYYY-MM-DDTHH:mm:ss'
utcOffset: '+09:00'

- name: Show current time
run: echo "${{ steps.current-time.outputs.formattedTime }}"
shell: bash

# 6. 배포 패키지 생성
- name: Generate deployment package
run: |
mkdir -p deploy
cp build/libs/*.jar deploy/application.jar
cp Procfile deploy/Procfile
cp -r .ebextensions_dev deploy/.ebextensions
cp -r .platform deploy/.platform
cd deploy && zip -r deploy.zip .

# 7. Elastic Beanstalk으로 배포
- name: Deploy to Elastic Beanstalk
uses: einaregilsson/beanstalk-deploy@v20
with:
aws_access_key: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }}
application_name: 'persi-dev'
environment_name: 'Persi-dev-env'
version_label: github-action-${{ steps.current-time.outputs.formattedTime }}
region: 'ap-northeast-2'
deployment_package: 'deploy/deploy.zip'
wait_for_deployment: false
#name: LuckyVicky CI/CD
#
#on:
# pull_request:
# types:
# - closed
# workflow_dispatch:
#
#jobs:
# build:
# runs-on: ubuntu-latest
# if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop'
#
# steps:
# # 1. GitHub 저장소에서 코드 체크아웃
# - name: Checkout
# uses: actions/checkout@v4
#
# # 2. JDK 17 설정
# - name: Set up JDK 17
# uses: actions/setup-java@v4.0.0
# with:
# java-version: '17'
# distribution: 'adopt'
#
# # 3. gradlew 파일 실행 권한 추가
# - name: Grant execute permission for gradlew
# run: chmod +x gradlew
# shell: bash
#
# # 4. Gradle 빌드 (테스트는 제외)
# - name: Build with Gradle
# run: ./gradlew clean build -x test
# shell: bash
#
# # 5. 현재 시간 가져오기 (배포 버전 레이블에 사용)
# - name: Get current time
# uses: josStorer/get-current-time@v2
# id: current-time
# with:
# format: 'YYYY-MM-DDTHH:mm:ss'
# utcOffset: '+09:00'
#
# - name: Show current time
# run: echo "${{ steps.current-time.outputs.formattedTime }}"
# shell: bash
#
# # 6. 배포 패키지 생성
# - name: Generate deployment package
# run: |
# mkdir -p deploy
# cp build/libs/*.jar deploy/application.jar
# cp Procfile deploy/Procfile
# cp -r .ebextensions_dev deploy/.ebextensions
# cp -r .platform deploy/.platform
# cd deploy && zip -r deploy.zip .
#
# # 7. Elastic Beanstalk으로 배포
# - name: Deploy to Elastic Beanstalk
# uses: einaregilsson/beanstalk-deploy@v20
# with:
# aws_access_key: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }}
# aws_secret_key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }}
# application_name: 'persi-dev'
# environment_name: 'Persi-dev-env'
# version_label: github-action-${{ steps.current-time.outputs.formattedTime }}
# region: 'ap-northeast-2'
# deployment_package: 'deploy/deploy.zip'
# wait_for_deployment: false
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version = '0.0.1-SNAPSHOT'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
languageVersion = JavaLanguageVersion.of(21)
}
}

Expand Down Expand Up @@ -64,6 +64,11 @@ dependencies {
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.springframework.boot:spring-boot-starter-test'

implementation 'org.glassfish.tyrus:tyrus-client:2.1.3'
implementation 'org.glassfish.tyrus:tyrus-container-grizzly-client:2.1.3'
implementation 'org.glassfish.tyrus.bundles:tyrus-standalone-client:2.1.3'
implementation 'jakarta.websocket:jakarta.websocket-api:2.1.1'

}

configurations.all {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class PachinkoController {
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "PACHINKO_2001", description = "빠칭코 선택완료 칸 확인 성공"),
})
@GetMapping("/chosen-squares")
public ApiResponse<PachinkoChosenResDto> SelectedSquares(
public ApiResponse<PachinkoChosenResDto> ChosenSquares(
@AuthenticationPrincipal CustomUserDetails customUserDetails
) {
User user = userService.findByUserName(customUserDetails.getUsername());
Expand All @@ -57,6 +57,18 @@ public ApiResponse<PachinkoChosenResDto> SelectedSquares(
PachinkoConverter.pachinkoChosenResDto(jewelsNumber, currentRound, meChosenSet, chosenSquares));
}

@Operation(summary = "빠칭코 선택된 칸 반환", description = "빠칭코에서 선택 완료된 칸 반환하는 메서드입니다.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "PACHINKO_T_2000", description = "빠칭코 선택완료 칸 확인 성공"),
})
@GetMapping("/selected-squares")
public ApiResponse<Set<Integer>> SelectedSquares() {

Set<Integer> chosenSquares = pachinkoService.viewSelectedSquares();

return ApiResponse.onSuccess(SuccessCode.PACHINKO_GET_SQUARES_SUCCESS, chosenSquares);
}

@Operation(summary = "빠칭코 첫 게임 시작", description = "빠칭코 첫 게임의 각 칸에 대한 보상을 정하는 메서드입니다.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "PACHINKO_2002", description = "빠칭코 첫 게임 시작 성공"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,11 @@ public static Pachinko savePachinko(Long currentRound, Integer squareNum, JewelT
.build();
}

public static UserPachinko saveUserPachinko(Long currentRound, User user) {
public static UserPachinko saveUserPachinko(User user, Long currentRound, Integer squareNumber) {
return UserPachinko.builder()
.round(currentRound)
.user(user)
.square1(0)
.square2(0)
.square3(0)
.square(squareNumber)
.build();
}

Expand Down
33 changes: 3 additions & 30 deletions src/main/java/LuckyVicky/backend/pachinko/domain/UserPachinko.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,19 @@
@AllArgsConstructor
@Table(
name = "user_pachinko",
uniqueConstraints = @UniqueConstraint(columnNames = {"user_id", "round"})
uniqueConstraints = @UniqueConstraint(columnNames = {"round", "square"})
)
public class UserPachinko {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

private Long round; // 게임 번호
private Long round;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
private User user;

private Integer square1;
private Integer square;

private Integer square2;

private Integer square3;

public void setSquares(int square1, int square2, int square3) {
this.square1 = square1;
this.square2 = square2;
this.square3 = square3;
}

public boolean addSquare(int squareNumber) {
if (square1 == null || square1 == 0) {
square1 = squareNumber;
return true;
} else if (square2 == null || square2 == 0) {
square2 = squareNumber;
return true;
} else if (square3 == null || square3 == 0) {
square3 = squareNumber;
return true;
}
return false;
}

public boolean canSelectMore() {
return square3 == null || square3 == 0; // 세 번째 칸이 비어 있으면 선택 가능
}
}
Loading