-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: HyeonJun0530 <[email protected]> Co-authored-by: 김현준 <[email protected]> Co-authored-by: 홍성우 <[email protected]>
- Loading branch information
1 parent
bc1bee2
commit 96600c4
Showing
257 changed files
with
16,282 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: CD Workflow | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
docker: | ||
timeout-minutes: 10 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# JDK setting - github actions에서 사용할 JDK 설정 | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
# 환경별 properties 파일 생성 - API-KEY | ||
- name: make application-API-KEY.properties | ||
run: | | ||
cd ./src/main/resources | ||
touch ./application-API-KEY.properties | ||
echo "${{ secrets.YML }}" > ./application-API-KEY.properties | ||
shell: bash | ||
|
||
# gradle 권한 설정 | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
# gradle build | ||
- name: Build with Gradle | ||
run: ./gradlew clean build -x test | ||
|
||
# Docker | ||
- name: Login DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Docker Image Build & Push | ||
run: | | ||
docker build -t ${{ secrets.DOCKERHUB_REGISTRY }}/${{ secrets.DOCKERHUB_IMAGE_NAME }} -f Dockerfile . | ||
docker push ${{ secrets.DOCKERHUB_REGISTRY }}/${{ secrets.DOCKERHUB_IMAGE_NAME }} | ||
- name: EC2 Login | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST_NAME }} | ||
username: ${{secrets.USER_NAME }} | ||
key: ${{ secrets.SERVER_SSH_KEY }} | ||
script: | | ||
docker-compose down | ||
docker image prune -f | ||
docker rm $(docker ps -a -q) | ||
docker pull ${{ secrets.DOCKERHUB_REGISTRY }}/${{ secrets.DOCKERHUB_IMAGE_NAME }} | ||
docker-compose up -d | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,4 @@ out/ | |
|
||
### VS Code ### | ||
.vscode/ | ||
src/main/resources/application-API-KEY.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM openjdk:17-alpine | ||
|
||
WORKDIR /usr/src/app | ||
|
||
ARG JAR_PATH=./build/libs | ||
|
||
COPY ${JAR_PATH}/leaguehub-backend-0.0.1-SNAPSHOT.jar ${JAR_PATH}/leaguehub-backend-0.0.1-SNAPSHOT.jar | ||
|
||
CMD ["java","-jar","-Dspring.profiles.active=prod","./build/libs/leaguehub-backend-0.0.1-SNAPSHOT.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lombok.addLombokGeneratedAnnotation = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
...ain/java/leaguehub/leaguehubbackend/domain/channel/controller/ChannelBoardController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
package leaguehub.leaguehubbackend.domain.channel.controller; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.Parameters; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import jakarta.validation.Valid; | ||
import leaguehub.leaguehubbackend.domain.channel.dto.ChannelBoardDto; | ||
import leaguehub.leaguehubbackend.domain.channel.dto.ChannelBoardIndexListDto; | ||
import leaguehub.leaguehubbackend.domain.channel.dto.ChannelBoardInfoDto; | ||
import leaguehub.leaguehubbackend.domain.channel.dto.ChannelBoardLoadDto; | ||
import leaguehub.leaguehubbackend.domain.channel.service.ChannelBoardService; | ||
import leaguehub.leaguehubbackend.global.exception.global.ExceptionResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.validation.BindingResult; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import static org.springframework.http.HttpStatus.OK; | ||
|
||
@Slf4j | ||
@RestController | ||
@RequestMapping("/api") | ||
@RequiredArgsConstructor | ||
public class ChannelBoardController { | ||
|
||
private final ChannelBoardService channelBoardService; | ||
|
||
@Operation(summary = "채널 보드 만들기") | ||
@Parameter(name = "channelLink", description = "해당 채널의 링크", example = "42aa1b11ab88") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ChannelBoardLoadDto.class))), | ||
@ApiResponse(responseCode = "400", description = "채널 링크가 올바르지 않음, 관리자 권한 없음", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionResponse.class))) | ||
}) | ||
@PostMapping("/channel/{channelLink}/new") | ||
public ResponseEntity createChannelBoard(@PathVariable("channelLink") String channelLink, | ||
@RequestBody @Valid ChannelBoardDto request, | ||
BindingResult bindingResult) { | ||
ChannelBoardLoadDto channelBoardLoadDto = channelBoardService.createChannelBoard(channelLink, request); | ||
|
||
return new ResponseEntity(channelBoardLoadDto, OK); | ||
} | ||
|
||
@Operation(summary = "채널 보드 업데이트") | ||
@Parameters(value = { | ||
@Parameter(name = "channelLink", description = "해당 채널의 링크", example = "42aa1b11ab88"), | ||
@Parameter(name = "boardId", description = "게시판 고유 Id", example = "0, 1, 2") | ||
}) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200"), | ||
@ApiResponse(responseCode = "400", description = "채널 링크가 올바르지 않음, 관리자 권한 없음", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionResponse.class))) | ||
}) | ||
@PostMapping("/channel/{channelLink}/{boardId}") | ||
public ResponseEntity updateChannelBoard(@PathVariable("channelLink") String channelLink, | ||
@PathVariable("boardId") Long boardId, | ||
@RequestBody ChannelBoardDto channelBoardDto) { | ||
channelBoardService.updateChannelBoard(channelLink, boardId, channelBoardDto); | ||
|
||
return new ResponseEntity("Board successfully updated", OK); | ||
} | ||
|
||
@Operation(summary = "채널 보드 삭제") | ||
@Parameters(value = { | ||
@Parameter(name = "channelLink", description = "해당 채널의 링크", example = "42aa1b11ab88"), | ||
@Parameter(name = "boardId", description = "게시판 고유 Id", example = "0, 1, 2") | ||
}) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200"), | ||
@ApiResponse(responseCode = "400", description = "채널 링크가 올바르지 않음, 관리자 권한 없음", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionResponse.class))) | ||
}) | ||
@DeleteMapping("/channel/{channelLink}/{boardId}") | ||
public ResponseEntity deleteChannelBoard(@PathVariable("channelLink") String channelLink, | ||
@PathVariable("boardId") Long boardId) { | ||
|
||
channelBoardService.deleteChannelBoard(channelLink, boardId); | ||
|
||
return new ResponseEntity("Board successfully deleted", OK); | ||
} | ||
|
||
@Operation(summary = "채널 보드 가져오기 - 단일 채널 보드 읽기") | ||
@Parameters(value = { | ||
@Parameter(name = "channelLink", description = "해당 채널의 링크", example = "42aa1b11ab88"), | ||
@Parameter(name = "boardId", description = "게시판 고유 Id", example = "0, 1, 2") | ||
}) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ChannelBoardDto.class))), | ||
@ApiResponse(responseCode = "400", description = "채널 링크가 올바르지 않음", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionResponse.class))) | ||
}) | ||
@GetMapping("/channel/{channelLink}/{boardId}") | ||
public ResponseEntity getChannelBoard(@PathVariable("channelLink") String channelLink, | ||
@PathVariable("boardId") Long boardId) { | ||
ChannelBoardDto channelBoardDto = channelBoardService.getChannelBoard(channelLink, boardId); | ||
|
||
return new ResponseEntity(channelBoardDto, OK); | ||
} | ||
|
||
@Operation(summary = "채널 보드 인덱스 업데이트 - 채널 보드 인덱스 커스텀") | ||
@Parameter(name = "channelLink", description = "해당 채널의 링크", example = "42aa1b11ab88") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200"), | ||
@ApiResponse(responseCode = "400", description = "채널 링크가 올바르지 않음, 권한x", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionResponse.class))) | ||
}) | ||
@PostMapping("/channel/{channelLink}/order") | ||
public ResponseEntity updateChannelBoardIndex(@PathVariable("channelLink") String channelLink, | ||
@RequestBody @Valid ChannelBoardIndexListDto channelBoardIndexListDto) { | ||
channelBoardService.updateChannelBoardIndex(channelLink, channelBoardIndexListDto.getChannelBoardLoadDtoList()); | ||
|
||
return new ResponseEntity("BoardIndex successfully updated", OK); | ||
} | ||
|
||
@Operation(summary = "채널 보드 가져오기 - 채널 로드시 현재 라운드와 제목과 보드ID 가져오기 리스트로 반환") | ||
@Parameter(name = "channelLink", description = "해당 채널의 링크", example = "42aa1b11ab88") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ChannelBoardInfoDto.class))), | ||
@ApiResponse(responseCode = "400", description = "채널 링크가 올바르지 않음", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExceptionResponse.class))) | ||
}) | ||
@GetMapping("/channel/{channelLink}/boards") | ||
public ResponseEntity loadChannelBoards(@PathVariable("channelLink") String channelLink) { | ||
|
||
ChannelBoardInfoDto channelBoardLoadDtoList = channelBoardService.loadChannelBoards(channelLink); | ||
|
||
return new ResponseEntity(channelBoardLoadDtoList, OK); | ||
} | ||
} |
Oops, something went wrong.