-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from devocean-finut/develop
Deploy v1
- Loading branch information
Showing
55 changed files
with
1,646 additions
and
480 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,26 @@ | ||
name: Deploy to EC2 | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up SSH key | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.FINUT_SSH_KEY }} | ||
|
||
- name: Deploy to EC2 | ||
env: | ||
EC2_HOST: ${{ secrets.FINUT_EC2_HOST }} | ||
EC2_USER: ${{ secrets.FINUT_EC2_USER }} | ||
run: | | ||
ssh -o StrictHostKeyChecking=no $EC2_USER@$EC2_HOST 'bash /home/ec2-user/app/deploy.sh' |
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
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
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
39 changes: 0 additions & 39 deletions
39
src/main/java/com/finut/finut_server/controller/InterestRateController.java
This file was deleted.
Oops, something went wrong.
101 changes: 101 additions & 0 deletions
101
src/main/java/com/finut/finut_server/controller/QuestController.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,101 @@ | ||
package com.finut.finut_server.controller; | ||
|
||
import com.finut.finut_server.apiPayload.ApiResponse; | ||
import com.finut.finut_server.apiPayload.code.ErrorReasonDTO; | ||
import com.finut.finut_server.domain.quest.Quest; | ||
import com.finut.finut_server.domain.quest.QuestDTO; | ||
import com.finut.finut_server.domain.questDone.QuestDone; | ||
import com.finut.finut_server.domain.questQuiz.QuestQuiz; | ||
import com.finut.finut_server.domain.questQuiz.QuestQuizRepository; | ||
import com.finut.finut_server.domain.quiz.Quiz; | ||
import com.finut.finut_server.domain.user.Users; | ||
import com.finut.finut_server.domain.user.UsersRepository; | ||
import com.finut.finut_server.service.LevelService; | ||
import com.finut.finut_server.service.QuestQuizService; | ||
import com.finut.finut_server.service.QuestService; | ||
import com.finut.finut_server.service.UsersService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@RestController | ||
@RequestMapping("/quest") | ||
@Tag(name = "Quest Controller", description = "ํ์คํธ ๊ด๋ จ api") | ||
public class QuestController { | ||
@Autowired | ||
private UsersService usersService; | ||
|
||
@Autowired | ||
private QuestQuizService questQuizService; | ||
|
||
@Autowired | ||
private QuestService questService; | ||
|
||
@Autowired | ||
private LevelService levelService; | ||
|
||
@Operation(summary = "์ ์ฒด ํ์คํธ ๊ฐ์ ธ์ค๊ธฐ", description = "์ ์ฒด ํ์คํธ๋ฅผ ๊ฐ์ ธ์ต๋๋ค") | ||
@ApiResponses(value = { | ||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "์ฑ๊ณต", content = @Content(mediaType = "application/json", | ||
schema = @Schema(implementation = Quest.class))), | ||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "400", description = "ํ์คํธ ๋ด์ฉ์ ์ ๋๋ก ๊ฐ์ง๊ณ ์ค์ง ๋ชปํ์ต๋๋ค.", | ||
content = @Content), | ||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "500", description = "์๋ฒ ์๋ฌ, ๊ด๋ฆฌ์์๊ฒ ๋ฌธ์ ๋ฐ๋๋๋ค.", | ||
content = @Content(mediaType = "application/json", | ||
schema = @Schema(implementation = ErrorReasonDTO.class))) | ||
}) | ||
@GetMapping("") | ||
public ApiResponse<List<QuestDTO>> getQuests(){ | ||
List<QuestDTO> quests = questService.getAllQuests(); | ||
return ApiResponse.onSuccess(quests); | ||
} | ||
|
||
|
||
@Operation(summary = "ํด๋น ํ์คํธ ํด์ฆ๋ค ๊ฐ์ ธ์ค๊ธฐ", description = "ํด๋น ํ์คํธ์ ํด์ฆ์ ๋ชจ๋ ๊ฐ์ ธ์ต๋๋ค.") | ||
@ApiResponses(value = { | ||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "์ฑ๊ณต", content = @Content(mediaType = "application/json", | ||
schema = @Schema(implementation = QuestQuiz.class))), | ||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "400", description = "ํ์คํธ ํด์ฆ ๋ด์ฉ์ ์ ๋๋ก ๊ฐ์ง๊ณ ์ค์ง ๋ชปํ์ต๋๋ค.", | ||
content = @Content), | ||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "500", description = "์๋ฒ ์๋ฌ, ๊ด๋ฆฌ์์๊ฒ ๋ฌธ์ ๋ฐ๋๋๋ค.", | ||
content = @Content(mediaType = "application/json", | ||
schema = @Schema(implementation = ErrorReasonDTO.class))) | ||
}) | ||
@GetMapping("/{questId}") | ||
public ApiResponse<List<QuestQuiz>> getQuestQuizes(@PathVariable Long questId){ | ||
List<QuestQuiz> questQuizzes = questQuizService.getQuestQuizzes(questId); | ||
return ApiResponse.onSuccess(questQuizzes); | ||
} | ||
|
||
|
||
|
||
@Operation(summary = "ํ์คํธ ์ฑ๊ณต", description = "ํ์คํธ ์ฑ๊ณต์ Level์ ๋ค์ ๋ ๋ฒจ์ผ๋ก ๋ฐ๊ฟ๋๋ค.") | ||
@ApiResponses(value = { | ||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "์ฑ๊ณต", content = @Content(mediaType = "application/json", | ||
schema = @Schema(implementation = QuestDone.class))), | ||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "400", description = "", | ||
content = @Content), | ||
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "500", description = "์๋ฒ ์๋ฌ, ๊ด๋ฆฌ์์๊ฒ ๋ฌธ์ ๋ฐ๋๋๋ค.", | ||
content = @Content(mediaType = "application/json", | ||
schema = @Schema(implementation = ErrorReasonDTO.class))) | ||
}) | ||
@GetMapping("/done-quest/{questId}") | ||
public ApiResponse<Users> updateQuestDone(@PathVariable Long questId, HttpServletRequest request, HttpServletResponse response) { | ||
Users user = usersService.getUserIdByToken(request, response); | ||
questService.updateQuestDone(user, questId); | ||
user = levelService.upgradeUserLevel(user.getId()); | ||
return ApiResponse.onSuccess(user); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.