diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 2f99506..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: CD with Gradle - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -permissions: - contents: read - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout source code - - uses: actions/checkout@v3 - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - - name: make application yml - run: | - cd ./src/main/resources - touch ./application.yml - echo "${{ secrets.APPLICATION_YML }}" > ./application.yml - shell: bash - - - name: Build with Gradle - run: | - chmod +x ./gradlew - ./gradlew clean build -x test - - - name: Docker build & push to docker repo - run: | - docker login -u ${{ secrets.DOCKER_USERNAME_YUB }} -p ${{ secrets.DOCKER_PASSWORD_YUB }} - docker build -f Dockerfile -t ${{ secrets.DOCKER_USERNAME_YUB }}/hanafun . - docker push ${{ secrets.DOCKER_USERNAME_YUB }}/hanafun - - - name: Deploy to server - uses: appleboy/ssh-action@master - id: deploy - with: - host: ${{ secrets.EC2_HOST }} - username: ec2-user - key: ${{ secrets.EC2_SSH_KEY }} - envs: GITHUB_SHA - script: | - sudo docker ps - sudo docker pull ${{ secrets.DOCKER_USERNAME_YUB }}/hanafun - sudo docker stop hanafun - sudo docker rm hanafun - sudo docker run -it -d -p 8099:8080 --name hanafun ${{ secrets.DOCKER_USERNAME_YUB }}/hanafun - sudo docker image prune -f \ No newline at end of file diff --git a/src/main/java/com/hanaro/hanafun/lesson/controller/LessonController.java b/src/main/java/com/hanaro/hanafun/lesson/controller/LessonController.java index 1c5e59b..a707dcb 100644 --- a/src/main/java/com/hanaro/hanafun/lesson/controller/LessonController.java +++ b/src/main/java/com/hanaro/hanafun/lesson/controller/LessonController.java @@ -12,6 +12,7 @@ import com.hanaro.hanafun.lessondate.service.LessonDateService; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; +import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -27,8 +28,8 @@ public class LessonController { // 개설 클래스 관리- 개설 클래스 목록 출력 @GetMapping("/reservation/my/opened") - public ResponseEntity openedLessons(@RequestBody OpenedLessonsReqDto openedLessonsReqDto) { - List openedLessons = lessonService.openedLessons(openedLessonsReqDto); + public ResponseEntity openedLessons(@AuthenticationPrincipal Long userId) { + List openedLessons = lessonService.openedLessons(userId); return ResponseEntity.ok(new ApiResponse<>(true, "ok", openedLessons)); } diff --git a/src/main/java/com/hanaro/hanafun/lesson/service/LessonService.java b/src/main/java/com/hanaro/hanafun/lesson/service/LessonService.java index f6c297d..38d58ba 100644 --- a/src/main/java/com/hanaro/hanafun/lesson/service/LessonService.java +++ b/src/main/java/com/hanaro/hanafun/lesson/service/LessonService.java @@ -10,7 +10,7 @@ public interface LessonService { // 개설 클래스 관리- 개설 클래스 목록 출력 - List openedLessons(OpenedLessonsReqDto openedLessonsReqDto); + List openedLessons(Long userId); // 클래스 상세보기 LessonInfoResDto lessonInfo(Long lessonId); diff --git a/src/main/java/com/hanaro/hanafun/lesson/service/impl/LessonServiceImpl.java b/src/main/java/com/hanaro/hanafun/lesson/service/impl/LessonServiceImpl.java index 87a1cc6..300e735 100644 --- a/src/main/java/com/hanaro/hanafun/lesson/service/impl/LessonServiceImpl.java +++ b/src/main/java/com/hanaro/hanafun/lesson/service/impl/LessonServiceImpl.java @@ -37,8 +37,8 @@ public class LessonServiceImpl implements LessonService { // 개설 클래스 관리- 개설 클래스 목록 출력 @Transactional @Override - public List openedLessons(OpenedLessonsReqDto openedLessonsReqDto) { - HostEntity host = hostRepository.findHostEntityByUserEntity_UserId(openedLessonsReqDto.getUserId()); + public List openedLessons(Long userId) { + HostEntity host = hostRepository.findHostEntityByUserEntity_UserId(userId); List lessons = lessonRepository.findLessonEntitiesByHostEntity(host); List openedLessons = lessons.stream()