-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge PR(#28) from feature/login-#26 휴면 회원 관련 기능
- Loading branch information
Showing
7 changed files
with
95 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/com/t3t/authenticationapi/member/exception/MemberNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.t3t.authenticationapi.member.exception; | ||
|
||
/** | ||
* 존재하지 않는 회원에 대한 조회를 시도할 때 발생하는 예외 | ||
* | ||
* @author woody35545 | ||
*/ | ||
public class MemberNotFoundException extends RuntimeException { | ||
|
||
public MemberNotFoundException() { | ||
super("존재하지 않는 회원 입니다."); | ||
} | ||
|
||
public MemberNotFoundException(String message) { | ||
super(message); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/t3t/authenticationapi/member/service/MemberService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.t3t.authenticationapi.member.service; | ||
|
||
import com.t3t.authenticationapi.member.exception.MemberNotFoundException; | ||
import com.t3t.authenticationapi.member.repository.MemberRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@Transactional | ||
@RequiredArgsConstructor | ||
public class MemberService { | ||
|
||
private final MemberRepository memberRepository; | ||
|
||
/** | ||
* 인증 성공시 로그인 시간을 업데이트한다. | ||
* @param memberId 로그인 시간을 업데이트 할 회원 식별자 | ||
* @author woody35545(구건모) | ||
*/ | ||
public void updateMemberLoginAt(Long memberId) { | ||
memberRepository.findById(memberId) | ||
.orElseThrow(() -> new MemberNotFoundException()) | ||
.updateLastLogin(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ | |
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; | ||
|
||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
|
||
@DataJpaTest | ||
class AccountRepositoryTest { | ||
@Autowired | ||
|
@@ -18,7 +20,7 @@ class AccountRepositoryTest { | |
private AccountRepository accountRepository; | ||
|
||
@Test | ||
public void testLoadUserEntity(){ | ||
public void testLoadUserEntity() { | ||
Member member = Member.builder() | ||
.id(3l) | ||
.name("foo") | ||
|
@@ -28,7 +30,7 @@ public void testLoadUserEntity(){ | |
.email("[email protected]") | ||
.birthdate(LocalDate.now()) | ||
.status("ACTIVE") | ||
.latestLogin(LocalDate.now()) | ||
.latestLogin(LocalDateTime.of(2024, 1, 1, 0, 0)) | ||
.gradeId(1) | ||
.build(); | ||
|
||
|