Skip to content

Commit

Permalink
Refactor : 패키지 이동
Browse files Browse the repository at this point in the history
  • Loading branch information
this-is-spear committed Jan 15, 2024
1 parent 0d40076 commit 64c8b21
Show file tree
Hide file tree
Showing 125 changed files with 385 additions and 1,358 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Numble Challenge - Banking API

- 테스트 할 API는 [API 문서](https://this-is-spear.github.io/hello-banking-api/src/main/resources/static/docs/index.html)에서 확인 할 수 있습니다.
- 서버는 `run.sh` 를 실행하면 됩니다.
-

### Development Environment

Expand Down
Empty file removed mysql/conf.d
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi;
package bankingapi;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi;
package bankingapi;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package numble.bankingapi.alarm.application;
package bankingapi.alarm.application;

import bankingapi.alarm.domain.AlarmService;
import bankingapi.alarm.dto.AlarmMessage;
import bankingapi.banking.domain.NotifyService;
import org.springframework.stereotype.Service;

import lombok.RequiredArgsConstructor;
import numble.bankingapi.alarm.domain.AlarmService;
import numble.bankingapi.alarm.dto.AlarmMessage;
import numble.bankingapi.banking.domain.NotifyService;

@Service
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.alarm.domain;
package bankingapi.alarm.domain;

public interface AlarmService {
void notify(Long userId, String message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.alarm.dto;
package bankingapi.alarm.dto;

public record AlarmMessage(
TaskStatus status,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.alarm.dto;
package bankingapi.alarm.dto;

public enum TaskStatus {
SUCCESS("성공"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.alarm.dto;
package bankingapi.alarm.dto;

public enum TaskType {
WITHDRAW("출금"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package numble.bankingapi.alarm.infra;
package bankingapi.alarm.infra;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import numble.bankingapi.alarm.domain.AlarmService;
import bankingapi.alarm.domain.AlarmService;

@Service
public class NumbleAlarmService implements AlarmService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
package numble.bankingapi.banking.application;
package bankingapi.banking.application;

import java.util.stream.Collectors;

import bankingapi.alarm.dto.AlarmMessage;
import bankingapi.alarm.dto.TaskStatus;
import bankingapi.alarm.dto.TaskType;
import bankingapi.banking.exception.InvalidMemberException;
import bankingapi.member.domain.Member;
import bankingapi.member.domain.MemberService;
import bankingapi.social.domain.Friend;
import bankingapi.social.domain.FriendService;
import org.springframework.stereotype.Service;

import lombok.RequiredArgsConstructor;
import numble.bankingapi.alarm.dto.AlarmMessage;
import numble.bankingapi.alarm.dto.TaskStatus;
import numble.bankingapi.alarm.dto.TaskType;
import numble.bankingapi.banking.domain.Account;
import numble.bankingapi.banking.domain.AccountHistory;
import numble.bankingapi.banking.domain.AccountNumber;
import numble.bankingapi.banking.domain.AccountService;
import numble.bankingapi.banking.domain.Money;
import numble.bankingapi.banking.domain.NotifyService;
import numble.bankingapi.banking.dto.HistoryResponse;
import numble.bankingapi.banking.dto.HistoryResponses;
import numble.bankingapi.banking.dto.TargetResponse;
import numble.bankingapi.banking.dto.TargetResponses;
import numble.bankingapi.banking.dto.TransferCommand;
import numble.bankingapi.banking.exception.InvalidMemberException;
import numble.bankingapi.member.domain.Member;
import numble.bankingapi.member.domain.MemberService;
import numble.bankingapi.social.domain.Friend;
import numble.bankingapi.social.domain.FriendService;
import bankingapi.banking.domain.Account;
import bankingapi.banking.domain.AccountHistory;
import bankingapi.banking.domain.AccountNumber;
import bankingapi.banking.domain.AccountService;
import bankingapi.banking.domain.Money;
import bankingapi.banking.domain.NotifyService;
import bankingapi.banking.dto.HistoryResponse;
import bankingapi.banking.dto.HistoryResponses;
import bankingapi.banking.dto.TargetResponse;
import bankingapi.banking.dto.TargetResponses;
import bankingapi.banking.dto.TransferCommand;

@Service
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package numble.bankingapi.banking.application;
package bankingapi.banking.application;

import bankingapi.banking.domain.AccountNumber;
import bankingapi.banking.domain.AccountService;
import bankingapi.banking.domain.Money;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import lombok.RequiredArgsConstructor;
import numble.bankingapi.banking.domain.AccountNumber;
import numble.bankingapi.banking.domain.AccountService;
import numble.bankingapi.banking.domain.Money;
import numble.bankingapi.concurrency.ConcurrencyManager;
import bankingapi.concurrency.ConcurrencyManager;

@Service
@RequiredArgsConstructor
Expand All @@ -17,7 +17,7 @@ public class ConcurrencyFacade {

@Transactional
public void transferWithLock(AccountNumber accountNumber, AccountNumber toAccountNumber,
Money amount) {
Money amount) {
concurrencyManager.executeWithLock(accountNumber.getNumber(), toAccountNumber.getNumber(),
() -> accountService.transferMoney(accountNumber, toAccountNumber, amount)
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.banking.domain;
package bankingapi.banking.domain;

import java.util.Objects;

Expand All @@ -18,7 +18,7 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import numble.bankingapi.common.BaseEntity;
import bankingapi.common.BaseEntity;

@Getter
@Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.banking.domain;
package bankingapi.banking.domain;

import java.util.Objects;

Expand All @@ -17,7 +17,7 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import numble.bankingapi.common.BaseEntity;
import bankingapi.common.BaseEntity;

@Getter
@Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.banking.domain;
package bankingapi.banking.domain;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.banking.domain;
package bankingapi.banking.domain;

import java.util.Objects;
import java.util.regex.Pattern;
Expand All @@ -9,7 +9,7 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import numble.bankingapi.banking.exception.InvalidAccountNumberException;
import bankingapi.banking.exception.InvalidAccountNumberException;

@Getter
@ToString
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.banking.domain;
package bankingapi.banking.domain;

import java.util.List;
import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package numble.bankingapi.banking.domain;
package bankingapi.banking.domain;

import java.util.List;

import bankingapi.util.generator.AccountNumberGenerator;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import lombok.RequiredArgsConstructor;
import numble.bankingapi.util.generator.AccountNumberGenerator;

@Service
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.banking.domain;
package bankingapi.banking.domain;

public enum HistoryType {
DEPOSIT,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package numble.bankingapi.banking.domain;
package bankingapi.banking.domain;

import jakarta.persistence.Embeddable;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import numble.bankingapi.banking.exception.NotNegativeMoneyException;
import bankingapi.banking.exception.NotNegativeMoneyException;

@Getter
@Embeddable
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/bankingapi/banking/domain/NotifyService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package bankingapi.banking.domain;

import bankingapi.alarm.dto.AlarmMessage;

public interface NotifyService {
void notify(Long userId, AlarmMessage alarmType);
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package numble.bankingapi.banking.dto;
package bankingapi.banking.dto;

import java.time.LocalDateTime;

import numble.bankingapi.banking.domain.AccountNumber;
import numble.bankingapi.banking.domain.HistoryType;
import numble.bankingapi.banking.domain.Money;
import bankingapi.banking.domain.AccountNumber;
import bankingapi.banking.domain.HistoryType;
import bankingapi.banking.domain.Money;

public record HistoryResponse(
HistoryType historyType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package numble.bankingapi.banking.dto;
package bankingapi.banking.dto;

import java.util.List;

import numble.bankingapi.banking.domain.Money;
import bankingapi.banking.domain.Money;

public record HistoryResponses(
Money balance,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package numble.bankingapi.banking.dto;
package bankingapi.banking.dto;

import numble.bankingapi.banking.domain.AccountNumber;
import bankingapi.banking.domain.AccountNumber;

public record TargetResponse(
String name,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.banking.dto;
package bankingapi.banking.dto;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package numble.bankingapi.banking.dto;
package bankingapi.banking.dto;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import numble.bankingapi.banking.domain.Money;
import bankingapi.banking.domain.Money;

@JsonSerialize
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.banking.exception;
package bankingapi.banking.exception;

public class InvalidAccountNumberException extends RuntimeException {
public InvalidAccountNumberException(String message) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.banking.exception;
package bankingapi.banking.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.banking.exception;
package bankingapi.banking.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package numble.bankingapi.banking.infra;
package bankingapi.banking.infra;

import java.util.List;

import bankingapi.banking.domain.AccountHistory;
import bankingapi.banking.domain.AccountNumber;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import numble.bankingapi.banking.domain.AccountHistory;
import numble.bankingapi.banking.domain.AccountHistoryRepository;
import numble.bankingapi.banking.domain.AccountNumber;
import bankingapi.banking.domain.AccountHistoryRepository;

@Repository
public interface JpaAccountHistoryRepository extends JpaRepository<AccountHistory, Long>, AccountHistoryRepository {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package numble.bankingapi.banking.infra;
package bankingapi.banking.infra;

import java.util.List;
import java.util.Optional;

import bankingapi.banking.domain.AccountNumber;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import jakarta.persistence.LockModeType;
import numble.bankingapi.banking.domain.Account;
import numble.bankingapi.banking.domain.AccountNumber;
import numble.bankingapi.banking.domain.AccountRepository;
import bankingapi.banking.domain.Account;
import bankingapi.banking.domain.AccountRepository;

@Repository
public interface JpaAccountRepository extends JpaRepository<Account, Long>, AccountRepository {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.banking.ui;
package bankingapi.banking.ui;

import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
Expand All @@ -12,11 +12,11 @@
import org.springframework.web.bind.annotation.RestController;

import lombok.RequiredArgsConstructor;
import numble.bankingapi.banking.application.AccountApplicationService;
import numble.bankingapi.banking.domain.Money;
import numble.bankingapi.banking.dto.HistoryResponses;
import numble.bankingapi.banking.dto.TargetResponses;
import numble.bankingapi.banking.dto.TransferCommand;
import bankingapi.banking.application.AccountApplicationService;
import bankingapi.banking.domain.Money;
import bankingapi.banking.dto.HistoryResponses;
import bankingapi.banking.dto.TargetResponses;
import bankingapi.banking.dto.TransferCommand;

@RestController
@RequestMapping("account")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.common;
package bankingapi.common;

import java.time.LocalDateTime;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package numble.bankingapi.concurrency;
package bankingapi.concurrency;

public interface ConcurrencyManager {
void executeWithLock(String lockName1, String lockName2, Runnable runnable);
Expand Down
Loading

0 comments on commit 64c8b21

Please sign in to comment.