diff --git a/flick-adapter/http/src/main/java/sigma/http/member/MemberController.java b/flick-adapter/http/src/main/java/sigma/http/member/MemberController.java index ee3bf36..893dc09 100644 --- a/flick-adapter/http/src/main/java/sigma/http/member/MemberController.java +++ b/flick-adapter/http/src/main/java/sigma/http/member/MemberController.java @@ -36,6 +36,6 @@ public String newAccessToKen(@RequestHeader(value = "RefreshToken") String token @PostMapping("/setFirebase/{memberId}") public void setFirebaseToken(@PathVariable(value = "memberId") String memberId, @RequestBody SetFirebaseTokenRequest setFirebaseTokenRequest){ - return;newTokenUseCase.setNewFirebaseToken(memberId,setFirebaseTokenRequest.firebaseToken()); + newTokenUseCase.setNewFirebaseToken(memberId,setFirebaseTokenRequest.firebaseToken()); } } \ No newline at end of file diff --git a/flick-adapter/jpa/src/main/java/sigma/jpa/account/AccountConverter.java b/flick-adapter/jpa/src/main/java/sigma/jpa/account/AccountConverter.java index c2fb187..19068e5 100644 --- a/flick-adapter/jpa/src/main/java/sigma/jpa/account/AccountConverter.java +++ b/flick-adapter/jpa/src/main/java/sigma/jpa/account/AccountConverter.java @@ -2,7 +2,7 @@ import sigma.domain.account.model.Account; import sigma.domain.account.model.value.*; -import sigma.domain.account.model.value.AccountNumber; +import sigma.domain.member.model.value.MemberId; abstract class AccountConverter { @@ -14,7 +14,7 @@ static Account toDomain(final AccountJPAEntity entity) { return Account.builder() .id(new AccountId(entity.getId())) .accountInfo(new AccountInfo(entity.getNumber(), entity.getName())) - .holderId(new HolderId(entity.getHolderId())) + .holderId(new HolderId(new MemberId(entity.getHolderId()))) .balance(new Balance(entity.getBalance())) .type(entity.getType()) .profile(new Profile(entity.getProfileImage())) diff --git a/flick-adapter/jpa/src/main/java/sigma/jpa/account/AccountJPAEntity.java b/flick-adapter/jpa/src/main/java/sigma/jpa/account/AccountJPAEntity.java index a68a2c4..10b863c 100644 --- a/flick-adapter/jpa/src/main/java/sigma/jpa/account/AccountJPAEntity.java +++ b/flick-adapter/jpa/src/main/java/sigma/jpa/account/AccountJPAEntity.java @@ -24,7 +24,7 @@ public class AccountJPAEntity extends AbstractIdEntity { private String name; @NotNull - private Long holderId; + private String holderId; @NotNull private Long balance; diff --git a/flick-adapter/jpa/src/main/java/sigma/jpa/account/GroupMemberJPAEntity.java b/flick-adapter/jpa/src/main/java/sigma/jpa/account/GroupMemberJPAEntity.java index 6f03cf1..8d2ef56 100644 --- a/flick-adapter/jpa/src/main/java/sigma/jpa/account/GroupMemberJPAEntity.java +++ b/flick-adapter/jpa/src/main/java/sigma/jpa/account/GroupMemberJPAEntity.java @@ -17,7 +17,7 @@ public class GroupMemberJPAEntity extends AbstractIdEntity { @NotNull - private Long memberId; + private String memberId; @NotNull private Long accountId; diff --git a/flick-adapter/jpa/src/main/java/sigma/jpa/member/MemberJPAAdapter.java b/flick-adapter/jpa/src/main/java/sigma/jpa/member/MemberJPAAdapter.java index e61c2c3..2ca1c49 100644 --- a/flick-adapter/jpa/src/main/java/sigma/jpa/member/MemberJPAAdapter.java +++ b/flick-adapter/jpa/src/main/java/sigma/jpa/member/MemberJPAAdapter.java @@ -1,7 +1,6 @@ package sigma.jpa.member; import jakarta.persistence.EntityManager; -import jakarta.persistence.TypedQuery; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; import sigma.application.member.outport.MemberDBPort; diff --git a/flick-adapter/jpa/src/main/java/sigma/jpa/member/MemberJPAEntity.java b/flick-adapter/jpa/src/main/java/sigma/jpa/member/MemberJPAEntity.java index 6e9ba5f..705737c 100644 --- a/flick-adapter/jpa/src/main/java/sigma/jpa/member/MemberJPAEntity.java +++ b/flick-adapter/jpa/src/main/java/sigma/jpa/member/MemberJPAEntity.java @@ -7,17 +7,17 @@ import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; import sigma.domain.member.model.value.Role; -import sigma.jpa.common.entity.AbstractIdEntity; +import sigma.jpa.common.entity.AbstractTimeEntity; @Entity @Table(name = "tbl_member") @Getter @SuperBuilder @NoArgsConstructor(access = AccessLevel.PROTECTED) -public class MemberJPAEntity /* extends AbstractIdEntity*/ { +public class MemberJPAEntity /* extends AbstractIdEntity*/ extends AbstractTimeEntity { @jakarta.persistence.Id - private String Id; + private String id; @NotNull @Enumerated(value = EnumType.STRING) diff --git a/flick-api/build.gradle b/flick-api/build.gradle index 3f59477..0f0dbee 100644 --- a/flick-api/build.gradle +++ b/flick-api/build.gradle @@ -9,5 +9,5 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' - runtimeOnly 'mysql:mysql-connector-java:8.0.33' + runtimeOnly 'org.mariadb.jdbc:mariadb-java-client' } \ No newline at end of file diff --git a/flick-api/src/main/resources/application.yml b/flick-api/src/main/resources/application.yml index 41f38b0..7618f57 100644 --- a/flick-api/src/main/resources/application.yml +++ b/flick-api/src/main/resources/application.yml @@ -3,7 +3,7 @@ server: spring: datasource: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: org.mariadb.jdbc.Driver url: ${DB_URL} username: ${DB_USERNAME} password: ${DB_PASSWORD} diff --git a/flick-core/domain/src/main/java/sigma/domain/account/model/Account.java b/flick-core/domain/src/main/java/sigma/domain/account/model/Account.java index 729680a..3b4f9dc 100644 --- a/flick-core/domain/src/main/java/sigma/domain/account/model/Account.java +++ b/flick-core/domain/src/main/java/sigma/domain/account/model/Account.java @@ -5,6 +5,7 @@ import sigma.domain.account.model.exception.NotAccountHolder; import sigma.domain.account.model.value.*; import sigma.domain.common.value.AbstractId; +import sigma.domain.member.model.value.MemberId; import java.time.LocalDateTime; @@ -32,7 +33,7 @@ public Account(final AccountId id, final AccountInfo accountInfo, final HolderId this.modifiedAt = modifiedAt; } - private void isHolder(final AbstractId memberId) { + private void isHolder(final MemberId memberId) { if (!holderId.equals(memberId)) { throw NotAccountHolder.EXCEPTION; } @@ -44,7 +45,7 @@ private void canAfford(final Long amount) { } } - public void send(final Long amount, final AbstractId memberId) { + public void send(final Long amount, final MemberId memberId) { isHolder(memberId); canAfford(amount); diff --git a/flick-core/domain/src/main/java/sigma/domain/account/model/value/HolderId.java b/flick-core/domain/src/main/java/sigma/domain/account/model/value/HolderId.java index f49c3fb..8bc14e2 100644 --- a/flick-core/domain/src/main/java/sigma/domain/account/model/value/HolderId.java +++ b/flick-core/domain/src/main/java/sigma/domain/account/model/value/HolderId.java @@ -1,15 +1,16 @@ package sigma.domain.account.model.value; import sigma.domain.common.value.AbstractId; +import sigma.domain.member.model.value.MemberId; -public final class HolderId extends AbstractId { +public final class HolderId /*extends AbstractId */{ + private final MemberId Id; - public HolderId(final Long id) { - super(id); + public HolderId(final MemberId id) { + this.Id = id; } - public HolderId(final AbstractId id) { - super(id.getId()); + public String getId() { + return Id.getId(); } - } \ No newline at end of file diff --git a/flick-core/domain/src/test/java/sigma/domain/account/model/AccountTest.java b/flick-core/domain/src/test/java/sigma/domain/account/model/AccountTest.java index 8a2ab7d..4dc25c4 100644 --- a/flick-core/domain/src/test/java/sigma/domain/account/model/AccountTest.java +++ b/flick-core/domain/src/test/java/sigma/domain/account/model/AccountTest.java @@ -21,7 +21,7 @@ class AccountTest { @BeforeEach void setUp() { final Balance balance = new Balance(1000L); - holderId = new HolderId(1L); + holderId = new HolderId(new MemberId("244fd654-891d-4cda-ba95-a96396811bc2")); account = Account.builder() .id(new AccountId(1L)) .accountInfo(new AccountInfo(2317L,"최수원의 계좌")) @@ -37,7 +37,7 @@ void setUp() { @Test @DisplayName(value = "Holder 가 아닐 경우 송금 불가") void HOLDER_가_아닐_경우_송금_불가() { - final MemberId memberId = new MemberId(3L); + final MemberId memberId = new MemberId("244fd654-891d-4cda-ba95-a96396811bc2"); assertThrows(NotAccountHolder.class, () -> account.send(500L, memberId)); } @@ -45,13 +45,13 @@ void setUp() { @Test @DisplayName(value = "잔액이 부족할 경우 송금 불가") void 잔액이_부족할_경우_송금_불가() { - assertThrows(InsufficientBalance.class, () -> account.send(9999L, holderId)); + assertThrows(InsufficientBalance.class, () -> account.send(9999L, new MemberId("244fd654-891d-4cda-ba95-a96396811bc2"))); } @Test @DisplayName(value = "송금 성공") void 송금_성공() { - account.send(500L, holderId); + account.send(500L, new MemberId("244fd654-891d-4cda-ba95-a96396811bc2")); assertEquals(500L, account.balance().getValue()); }