From ab88a16e7702a2c09da0a761d1e2d4047d07af1f Mon Sep 17 00:00:00 2001 From: Hong0329 <97835512+Hong0329@users.noreply.github.com> Date: Thu, 4 Jan 2024 16:13:06 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[SETTING]=20CI=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CI.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/CI.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..c564fee --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,35 @@ +name: CI + +on: + pull_request: + branches: [ "develop" ] + +jobs: + build: + runs-on: ubuntu-20.04 + env: + working-directory: growthookServer + + steps: + - name: 체크아웃 + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'corretto' + java-version: '17' + + - name: application.yaml 생성 + run: | + mkdir src/main/resources + cd src/main/resources + echo "${{ secrets.APPLICATION }}" > ./application.yaml + working-directory: ${{ env.working-directory }} + + - name: 빌드 + run: | + chmod +x gradlew + ./gradlew build -x test + working-directory: ${{ env.working-directory }} + shell: bash From 67435469eec481dd1a5b9a1666ba844642b4cd3d Mon Sep 17 00:00:00 2001 From: yeseul106 <20191037@sungshin.ac.kr> Date: Thu, 4 Jan 2024 19:43:53 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[FEAT]=20#52=20=EC=A0=84=EC=B2=B4=20?= =?UTF-8?q?=EB=B3=B4=EA=B4=80=ED=95=A8=EC=9D=98=20=EB=AA=A8=EB=93=A0=20?= =?UTF-8?q?=EC=94=A8=EC=95=97=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20API=20=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/seed/controller/SeedController.java | 13 ++++++++++--- ...esponseDto.java => SeedListGetResponseDto.java} | 2 +- .../api/seed/repository/SeedRepository.java | 2 ++ .../api/seed/service/Impl/SeedServiceImpl.java | 14 +++++++++++--- .../api/seed/service/SeedService.java | 9 +++++---- .../common/response/SuccessStatus.java | 1 + 6 files changed, 30 insertions(+), 11 deletions(-) rename growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/response/{SeedListByCaveGetResponseDto.java => SeedListGetResponseDto.java} (91%) diff --git a/growthookServer/src/main/java/com/example/growthookserver/api/seed/controller/SeedController.java b/growthookServer/src/main/java/com/example/growthookserver/api/seed/controller/SeedController.java index c238171..d6827f0 100644 --- a/growthookServer/src/main/java/com/example/growthookserver/api/seed/controller/SeedController.java +++ b/growthookServer/src/main/java/com/example/growthookserver/api/seed/controller/SeedController.java @@ -5,7 +5,7 @@ import com.example.growthookserver.api.seed.dto.request.SeedUpdateRequestDto; import com.example.growthookserver.api.seed.dto.response.SeedCreateResponseDto; import com.example.growthookserver.api.seed.dto.response.SeedDetailGetResponseDto; -import com.example.growthookserver.api.seed.dto.response.SeedListByCaveGetResponseDto; +import com.example.growthookserver.api.seed.dto.response.SeedListGetResponseDto; import com.example.growthookserver.api.seed.dto.response.SeedMoveResponseDto; import com.example.growthookserver.api.seed.service.SeedService; import com.example.growthookserver.common.response.ApiResponse; @@ -15,7 +15,6 @@ import jakarta.validation.Valid; import java.util.List; import lombok.RequiredArgsConstructor; -import org.springframework.boot.actuate.autoconfigure.observation.ObservationProperties.Http; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; @@ -68,8 +67,16 @@ public ApiResponse moveSeed(@PathVariable Long seedId, @Val @GetMapping("/cave/{caveId}/seed/list") @ResponseStatus(HttpStatus.OK) @Operation(summary = "SeedListByCaveGet", description = "보관함별 씨앗 리스트를 조회하는 API입니다.") - public ApiResponse> getSeedListByCave(@PathVariable Long caveId) { + public ApiResponse> getSeedListByCave(@PathVariable Long caveId) { return ApiResponse.success(SuccessStatus.GET_SEED_LIST_BY_CAVE, seedService.getSeedListByCave(caveId)); } + @GetMapping("seed/list") + @ResponseStatus(HttpStatus.OK) + @Operation(summary = "SeedListGet", description = "전체 씨앗 리스트를 조회하는 API입니다.") + public ApiResponse> getSeedList() { + return ApiResponse.success(SuccessStatus.GET_SEED_LIST, seedService.getSeedList()); + } + + } diff --git a/growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/response/SeedListByCaveGetResponseDto.java b/growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/response/SeedListGetResponseDto.java similarity index 91% rename from growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/response/SeedListByCaveGetResponseDto.java rename to growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/response/SeedListGetResponseDto.java index 427a3aa..ee20805 100644 --- a/growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/response/SeedListByCaveGetResponseDto.java +++ b/growthookServer/src/main/java/com/example/growthookserver/api/seed/dto/response/SeedListGetResponseDto.java @@ -8,7 +8,7 @@ @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor(staticName = "of") -public class SeedListByCaveGetResponseDto { +public class SeedListGetResponseDto { private Long seedId; private String insight; private Long remainingDays; diff --git a/growthookServer/src/main/java/com/example/growthookserver/api/seed/repository/SeedRepository.java b/growthookServer/src/main/java/com/example/growthookserver/api/seed/repository/SeedRepository.java index 2501e05..e065b37 100644 --- a/growthookServer/src/main/java/com/example/growthookserver/api/seed/repository/SeedRepository.java +++ b/growthookServer/src/main/java/com/example/growthookserver/api/seed/repository/SeedRepository.java @@ -12,6 +12,8 @@ public interface SeedRepository extends JpaRepository { Optional findSeedById(Long seedId); List findByCaveIdOrderByIdDesc(Long caveId); + List findAllByOrderByIdDesc(); + default Seed findSeedByIdOrThrow(Long seedId) { return findSeedById(seedId) .orElseThrow(()-> new NotFoundException(ErrorStatus.NOT_FOUND_SEED.getMessage())); diff --git a/growthookServer/src/main/java/com/example/growthookserver/api/seed/service/Impl/SeedServiceImpl.java b/growthookServer/src/main/java/com/example/growthookserver/api/seed/service/Impl/SeedServiceImpl.java index c5d3006..930e96b 100644 --- a/growthookServer/src/main/java/com/example/growthookserver/api/seed/service/Impl/SeedServiceImpl.java +++ b/growthookServer/src/main/java/com/example/growthookserver/api/seed/service/Impl/SeedServiceImpl.java @@ -10,7 +10,7 @@ import com.example.growthookserver.api.seed.dto.request.SeedUpdateRequestDto; import com.example.growthookserver.api.seed.dto.response.SeedCreateResponseDto; import com.example.growthookserver.api.seed.dto.response.SeedDetailGetResponseDto; -import com.example.growthookserver.api.seed.dto.response.SeedListByCaveGetResponseDto; +import com.example.growthookserver.api.seed.dto.response.SeedListGetResponseDto; import com.example.growthookserver.api.seed.dto.response.SeedMoveResponseDto; import com.example.growthookserver.api.seed.repository.SeedRepository; import com.example.growthookserver.api.seed.service.SeedService; @@ -82,9 +82,17 @@ public SeedMoveResponseDto moveSeed(Long seedId, SeedMoveRequestDto seedMoveRequ } @Override - public List getSeedListByCave(Long caveId) { + public List getSeedListByCave(Long caveId) { return seedRepository.findByCaveIdOrderByIdDesc(caveId).stream() - .map(seed -> SeedListByCaveGetResponseDto.of(seed.getId(), seed.getInsight(), calculateRemainingDays(seed.getLockDate()), + .map(seed -> SeedListGetResponseDto.of(seed.getId(), seed.getInsight(), calculateRemainingDays(seed.getLockDate()), + seed.getIsLocked(), seed.getIsScraped(), checkHasActionPlan(seed))) + .collect(Collectors.toList()); + } + + @Override + public List getSeedList() { + return seedRepository.findAllByOrderByIdDesc().stream() + .map(seed -> SeedListGetResponseDto.of(seed.getId(), seed.getInsight(), calculateRemainingDays(seed.getLockDate()), seed.getIsLocked(), seed.getIsScraped(), checkHasActionPlan(seed))) .collect(Collectors.toList()); } diff --git a/growthookServer/src/main/java/com/example/growthookserver/api/seed/service/SeedService.java b/growthookServer/src/main/java/com/example/growthookserver/api/seed/service/SeedService.java index 780c319..16beb26 100644 --- a/growthookServer/src/main/java/com/example/growthookserver/api/seed/service/SeedService.java +++ b/growthookServer/src/main/java/com/example/growthookserver/api/seed/service/SeedService.java @@ -1,13 +1,11 @@ package com.example.growthookserver.api.seed.service; -import com.example.growthookserver.api.cave.dto.request.CaveCreateRequestDto; -import com.example.growthookserver.api.cave.dto.response.CaveCreateResponseDto; import com.example.growthookserver.api.seed.dto.request.SeedCreateRequestDto; import com.example.growthookserver.api.seed.dto.request.SeedMoveRequestDto; import com.example.growthookserver.api.seed.dto.request.SeedUpdateRequestDto; import com.example.growthookserver.api.seed.dto.response.SeedCreateResponseDto; import com.example.growthookserver.api.seed.dto.response.SeedDetailGetResponseDto; -import com.example.growthookserver.api.seed.dto.response.SeedListByCaveGetResponseDto; +import com.example.growthookserver.api.seed.dto.response.SeedListGetResponseDto; import com.example.growthookserver.api.seed.dto.response.SeedMoveResponseDto; import java.util.List; @@ -28,5 +26,8 @@ public interface SeedService { SeedMoveResponseDto moveSeed(Long seedId, SeedMoveRequestDto seedMoveRequestDto); //* 보관함별 씨앗 리스트 조회 - List getSeedListByCave(Long caveId); + List getSeedListByCave(Long caveId); + + //* 씨앗 전체 리스트 조회 + List getSeedList(); } diff --git a/growthookServer/src/main/java/com/example/growthookserver/common/response/SuccessStatus.java b/growthookServer/src/main/java/com/example/growthookserver/common/response/SuccessStatus.java index b705aa3..d25c081 100644 --- a/growthookServer/src/main/java/com/example/growthookserver/common/response/SuccessStatus.java +++ b/growthookServer/src/main/java/com/example/growthookserver/common/response/SuccessStatus.java @@ -35,6 +35,7 @@ public enum SuccessStatus { GET_SEED_DETAIL(HttpStatus.OK, "씨앗 상세 정보 조회 성공"), MOVE_SEED_SUCCESS(HttpStatus.OK, "씨앗 이동 성공"), GET_SEED_LIST_BY_CAVE(HttpStatus.OK, "보관함별로 씨앗 리스트 조회 성공"), + GET_SEED_LIST(HttpStatus.OK, "전체 씨앗 리스트 조회 성공" ), /** * actionplan