Skip to content

Commit

Permalink
delete(expense): 필요없는 클래스 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
ehBeak committed Dec 26, 2023
1 parent e7f7ad3 commit a91a073
Show file tree
Hide file tree
Showing 43 changed files with 84 additions and 1,244 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
package com.connect.accountApp.domain.expense.adapter.in.web.controller;

import com.connect.accountApp.domain.expense.adapter.in.web.controller.response.DailyExpenseResponse;
import com.connect.accountApp.domain.expense.application.port.in.DeleteExpenseUseCase;
import com.connect.accountApp.domain.expense.application.port.in.command.DailyExpenseCommand;
import com.connect.accountApp.global.common.adapter.in.web.response.SuccessResponse;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.Size;
import java.time.LocalDate;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -28,7 +21,6 @@ public class DeleteExpenseController {
@DeleteMapping("/{expense_id}")
public ResponseEntity getDailyExpenseOfDay(@AuthenticationPrincipal UserDetails userDetails,
@PathVariable("expense_id") Long expenseId) {
String username = userDetails.getUsername();
deleteExpenseUseCase.deleteExpense(expenseId);
return ResponseEntity.ok(SuccessResponse.create204NoContentResponse());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ public class GetDailyExpenseController {

@GetMapping("/daily-total/day/{year}/{month}/{dayOfMonth}")
public ResponseEntity getDailyExpenseOfDay(@AuthenticationPrincipal UserDetails userDetails,
@Min(0) @PathVariable("year") int year,
@Size(min = 1, max = 12) @PathVariable("month") int month,
@PathVariable("dayOfMonth") int dayOfMonth) {
@Min(0) @PathVariable("year") int year,
@Size(min = 1, max = 12) @PathVariable("month") int month,
@PathVariable("dayOfMonth") int dayOfMonth) {

String userEmail = userDetails.getUsername();
LocalDate date = LocalDate.of(year, month, dayOfMonth);

List<DailyExpenseCommand> commands = getDailyExpenseUseCase.getDailyExpense(userEmail, date);
DailyExpenseResponse response = new DailyExpenseResponse(commands);

return ResponseEntity.ok(SuccessResponse.create200SuccessResponse(response));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public class GetDailyTotalExpensesController { // 월별 지출 캘린더

@GetMapping("/daily-total/month/{year}/{month}/{dayOfMonth}")
public ResponseEntity getDailyTotalExpenses(@AuthenticationPrincipal UserDetails userDetails,
@PathVariable("year") int year,
@PathVariable("month") int month,
@PathVariable("dayOfMonth") int dayOfMonth) {
@PathVariable("year") int year,
@PathVariable("month") int month,
@PathVariable("dayOfMonth") int dayOfMonth) {

String userEmail = userDetails.getUsername();
LocalDate date = LocalDate.of(year, month, dayOfMonth);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ public class GetExpenseController {

@GetMapping("/{expense_id}")
public ResponseEntity getDailyExpenseOfDay(@AuthenticationPrincipal UserDetails userDetails, @PathVariable("expense_id") Long expenseId) {

String userEmail = userDetails.getUsername();


Expense expense = getExpenseUseCase.getExpense(expenseId);
GetExpenseResponse response = new GetExpenseResponse(expense);

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ public class RegisterExpenseController {
@PostMapping("")
public ResponseEntity registerExpense(@AuthenticationPrincipal UserDetails userDetails,
@RequestBody RegisterExpenseRequest request) {

log.info("[controller] : {}", "RegisterExpenseController");

String userEmail = userDetails.getUsername();
Long expenseId = registerExpenseUseCase.registerExpense(userEmail, request);
return ResponseEntity.ok(SuccessResponse.create201CreatedResponse(expenseId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@ public class SearchExpenseController {

@PostMapping("/search")
public ResponseEntity searchExpense(@AuthenticationPrincipal UserDetails userDetails,
@RequestParam("expense_date_max") LocalDate expenseDateMax,
@RequestParam("expense_date_max") LocalDate expenseDateMax,
@RequestParam("expense_date_min") LocalDate expenseDateMin,
@RequestParam("expense_category_name") String expenseCategoryName,
@RequestParam("expense_amount_max") BigDecimal expenseAmountMax,
@RequestParam("expense_amount_min") BigDecimal expenseAmountMin,
@RequestParam("sorted_by_newest") Boolean sortedByNewest) {

String userEmail = userDetails.getUsername();
SearchedCondition condition = new SearchedCondition(expenseDateMax, expenseDateMin, expenseCategoryName,
expenseAmountMax, expenseAmountMin, sortedByNewest);
SearchedCondition condition =
new SearchedCondition(
expenseDateMax, expenseDateMin, expenseCategoryName,
expenseAmountMax, expenseAmountMin, sortedByNewest);
List<DailyExpenseCommand> commands = searchExpenseUseCase.getSearchedExpense(userEmail, condition);
DailyExpenseResponse response = new DailyExpenseResponse(commands);
return ResponseEntity.ok(SuccessResponse.create200SuccessResponse(response));
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit a91a073

Please sign in to comment.