From 7f692b60ee39b8adbe69a1981ff849a6d4ff66a9 Mon Sep 17 00:00:00 2001 From: ryogaeng Date: Sun, 18 Aug 2024 14:31:39 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[fix]=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EC=B6=94=EA=B0=80=EC=8B=9C=20deleted=20=3D=20false?= =?UTF-8?q?=20=EB=AA=85=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/category/converter/CategoryConverter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/category/converter/CategoryConverter.java b/src/main/java/com/bbteam/budgetbuddies/domain/category/converter/CategoryConverter.java index 69069b9d..17ab7c4d 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/category/converter/CategoryConverter.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/category/converter/CategoryConverter.java @@ -14,6 +14,7 @@ public Category toCategoryEntity(CategoryRequestDTO categoryRequestDTO, User use .name(categoryRequestDTO.getName()) .isDefault(categoryRequestDTO.getIsDefault()) .user(user) + .deleted(false) .build(); } From 0e1ae6419341f58a388e718bcf7f787943f852c5 Mon Sep 17 00:00:00 2001 From: ryogaeng Date: Sun, 18 Aug 2024 14:31:39 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[fix]=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=EC=B6=94=EA=B0=80=EC=8B=9C=20deleted=20=3D=20false?= =?UTF-8?q?=20=EB=AA=85=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/category/converter/CategoryConverter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/category/converter/CategoryConverter.java b/src/main/java/com/bbteam/budgetbuddies/domain/category/converter/CategoryConverter.java index 69069b9d..17ab7c4d 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/category/converter/CategoryConverter.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/category/converter/CategoryConverter.java @@ -14,6 +14,7 @@ public Category toCategoryEntity(CategoryRequestDTO categoryRequestDTO, User use .name(categoryRequestDTO.getName()) .isDefault(categoryRequestDTO.getIsDefault()) .user(user) + .deleted(false) .build(); } From f43c44c0c987c4f661de6dc22700318770788694 Mon Sep 17 00:00:00 2001 From: ryogaeng Date: Sun, 18 Aug 2024 17:19:18 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[feat]=20=EC=97=94=EB=93=9C=ED=8F=AC?= =?UTF-8?q?=EC=9D=B8=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/expense/controller/ExpenseApi.java | 4 +++- .../domain/expense/controller/ExpenseController.java | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/expense/controller/ExpenseApi.java b/src/main/java/com/bbteam/budgetbuddies/domain/expense/controller/ExpenseApi.java index 4785623b..70ddae63 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/expense/controller/ExpenseApi.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/expense/controller/ExpenseApi.java @@ -32,7 +32,9 @@ public interface ExpenseApi { @ApiResponse(responseCode = "AUTH004", description = "access 토큰 만료", content = @Content(schema = @Schema(implementation = ApiResponse.class))), @ApiResponse(responseCode = "AUTH006", description = "access 토큰 모양이 이상함", content = @Content(schema = @Schema(implementation = ApiResponse.class)))}) ResponseEntity createExpense( - @Parameter(description = "user_id, category_id, amount, description, expenseDate") ExpenseRequestDto expenseRequestDto); + @Parameter(description = "user_id") @PathVariable Long userId, + @Parameter(description = "category_id, amount, description, expenseDate") @RequestBody ExpenseRequestDto expenseRequestDto + ); @Operation(summary = "월별 소비 조회", description = "무한 스크롤을 통한 조회로 예상하여 Slice를 통해서 조회") @ApiResponses({ diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/expense/controller/ExpenseController.java b/src/main/java/com/bbteam/budgetbuddies/domain/expense/controller/ExpenseController.java index 7ab52043..d2762713 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/expense/controller/ExpenseController.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/expense/controller/ExpenseController.java @@ -30,11 +30,11 @@ public class ExpenseController implements ExpenseApi { private final ExpenseService expenseService; @Override - @PostMapping("/add") + @PostMapping("/add/{userId}") public ResponseEntity createExpense( - @Parameter(description = "user_id, category_id, amount, description, expenseDate") - @RequestBody ExpenseRequestDto expenseRequestDto) { - ExpenseResponseDto response = expenseService.createExpense(expenseRequestDto); + @Parameter(description = "user_id") @PathVariable Long userId, + @Parameter(description = "category_id, amount, description, expenseDate") @RequestBody ExpenseRequestDto expenseRequestDto) { + ExpenseResponseDto response = expenseService.createExpense(userId, expenseRequestDto); return ResponseEntity.ok(response); } From 071481d79919605db0d4da4bfaae24659afbaf16 Mon Sep 17 00:00:00 2001 From: ryogaeng Date: Sun, 18 Aug 2024 17:19:27 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[feat]=20userId=20=EC=A0=9C=EC=99=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../budgetbuddies/domain/expense/dto/ExpenseRequestDto.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/expense/dto/ExpenseRequestDto.java b/src/main/java/com/bbteam/budgetbuddies/domain/expense/dto/ExpenseRequestDto.java index b5ca5bdc..3b3fe854 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/expense/dto/ExpenseRequestDto.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/expense/dto/ExpenseRequestDto.java @@ -14,7 +14,6 @@ @NoArgsConstructor @AllArgsConstructor public class ExpenseRequestDto { - private Long userId; private Long categoryId; private Long amount; private String description; From bc87b9f69e901623432faf689cb42f2baee10bcb Mon Sep 17 00:00:00 2001 From: ryogaeng Date: Sun, 18 Aug 2024 17:19:35 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[feat]=20=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../expense/service/ExpenseService.java | 2 +- .../expense/service/ExpenseServiceImpl.java | 28 +++---------------- 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/expense/service/ExpenseService.java b/src/main/java/com/bbteam/budgetbuddies/domain/expense/service/ExpenseService.java index 1ca3e6cb..4374284e 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/expense/service/ExpenseService.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/expense/service/ExpenseService.java @@ -8,7 +8,7 @@ import com.bbteam.budgetbuddies.domain.expense.dto.MonthlyExpenseCompactResponseDto; public interface ExpenseService { - ExpenseResponseDto createExpense(ExpenseRequestDto expenseRequestDto); + ExpenseResponseDto createExpense(Long userId, ExpenseRequestDto expenseRequestDto); MonthlyExpenseCompactResponseDto getMonthlyExpense(Long userId, LocalDate localDate); diff --git a/src/main/java/com/bbteam/budgetbuddies/domain/expense/service/ExpenseServiceImpl.java b/src/main/java/com/bbteam/budgetbuddies/domain/expense/service/ExpenseServiceImpl.java index ccc35448..40390a76 100644 --- a/src/main/java/com/bbteam/budgetbuddies/domain/expense/service/ExpenseServiceImpl.java +++ b/src/main/java/com/bbteam/budgetbuddies/domain/expense/service/ExpenseServiceImpl.java @@ -34,8 +34,8 @@ public class ExpenseServiceImpl implements ExpenseService { private final ConsumptionGoalService consumptionGoalService; @Override - public ExpenseResponseDto createExpense(ExpenseRequestDto expenseRequestDto) { - User user = userRepository.findById(expenseRequestDto.getUserId()) + public ExpenseResponseDto createExpense(Long userId, ExpenseRequestDto expenseRequestDto) { + User user = userRepository.findById(userId) .orElseThrow(() -> new IllegalArgumentException("Invalid user ID")); Category category = categoryRepository.findById(expenseRequestDto.getCategoryId()) .orElseThrow(() -> new IllegalArgumentException("Invalid category ID")); @@ -54,27 +54,7 @@ public ExpenseResponseDto createExpense(ExpenseRequestDto expenseRequestDto) { Case 2) !default && 키테고리 테이블의 UserId 컬럼의 값이 나와 맞으면 (= custom category) */ - else if (!category.getIsDefault() && category.getUser().getId().equals(expenseRequestDto.getUserId())) { - // custom category - } else { - throw new IllegalArgumentException("User and category are not matched properly."); - } - - /* - case 1) - - 카테고리 ID가 1~10 사이 && default => DB의 immutable 필드인 default category - - DB 관리 이슈로 category에 default 카테고리의 중복이 발생할 경우, 이를 대비하기 위해 1<= id <= 10 조건도 추가 - */ - if (expenseRequestDto.getCategoryId() >= 1 && expenseRequestDto.getCategoryId() <= 10 - && category.getIsDefault()) { - // category.setUser(user); - // default category - } - /* - Case 2) - !default && 키테고리 테이블의 UserId 컬럼의 값이 나와 맞으면 (= custom cateogory) - */ - else if (!category.getIsDefault() && category.getUser().getId().equals(expenseRequestDto.getUserId())) { + else if (!category.getIsDefault() && category.getUser().getId().equals(userId)) { // custom category } else { throw new IllegalArgumentException("User and category are not matched properly."); @@ -84,7 +64,7 @@ else if (!category.getIsDefault() && category.getUser().getId().equals(expenseRe expenseRepository.save(expense); // 소비 목표 업데이트 - consumptionGoalService.updateConsumeAmount(expenseRequestDto.getUserId(), expenseRequestDto.getCategoryId(), + consumptionGoalService.updateConsumeAmount(userId, expenseRequestDto.getCategoryId(), expenseRequestDto.getAmount()); return expenseConverter.toExpenseResponseDto(expense); From e24a16d37febc0f4c1f2bcad46ac3fa690961e10 Mon Sep 17 00:00:00 2001 From: MJJ Date: Mon, 19 Aug 2024 03:19:43 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[feat]=20ci/cd=20deploy.sh=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/gradle.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 3df82ec4..54e8902d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -25,8 +25,8 @@ jobs: - name: Ensure resource directory exists run: mkdir -p ./src/main/resources - - name : injection-yml - run : echo -E "${{ secrets.YML }}" > ./src/main/resources/application.yml + - name: injection-yml + run: echo -E "${{ secrets.YML }}" > ./src/main/resources/application.yml - name: Log in to Docker Hub uses: docker/login-action@v3 @@ -43,4 +43,4 @@ jobs: key: ${{ secrets.PRIVATE_KEY }} host: ${{ secrets.HOST_DEV }} username: ${{ secrets.USERNAME }} - script: ${{ secrets.SCRIPT }} + script: ${{ secrets.DEPLOY_SCRIPT }}