Skip to content

Commit

Permalink
Merge pull request #135 from Hanaro-trip-together-bank/feature/dues_paid
Browse files Browse the repository at this point in the history
feat: member login fcmToken추가
  • Loading branch information
ny2060 authored Jun 5, 2024
2 parents 26ce878 + 0dba8b2 commit 6bb506d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public LoginResDto login(@RequestBody LoginReqDto loginReqDto, HttpServletReques
HttpSession session = request.getSession();
session.setAttribute("loginUserIdx",loginReqDto.getMemberIdx());

return memberService.login(memberIdx, memberLoginPw);
return memberService.login(memberIdx, memberLoginPw, loginReqDto.getFcmToken());
}

// 알림설정 (on/off)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ public class Member {
public void updateAlarm(Boolean alarmStatus) {
this.alarmStatus = alarmStatus;
}

public void setFcmToken(String fcmToken) {
this.fcmToken = fcmToken;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
public class LoginReqDto {
private Long memberIdx;
private String memberLoginPw;
private String fcmToken;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public interface MemberService {
// 간편 로그인
LoginResDto login(Long memberIdx, String memberLoginPw);
LoginResDto login(Long memberIdx, String memberLoginPw,String fcmToken);
//멤머 아이디로 멤버 검색
Member findByMemberIdx(Long memberIdx);
// 알림설정 (on/off)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public class MemberServiceImpl implements MemberService {
// 간편 로그인
@Transactional
@Override
public LoginResDto login(Long memberIdx, String memberLoginPw) {
public LoginResDto login(Long memberIdx, String memberLoginPw,String fcmToken) {
Member member = memberRepository.findMemberByMemberIdxAndMemberLoginPw(memberIdx, memberLoginPw);

member.setFcmToken(fcmToken);
if(member == null) {
return LoginResDto.builder()
.message("비밀번호가 맞지 않습니다.")
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/hanaro/triptogether/MemberServiceTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void testLoginSuccess() {
when(memberRepository.findMemberByMemberIdxAndMemberLoginPw(1L, "123456")).thenReturn(member);

// When
LoginResDto result = memberService.login(1L, "123456");
LoginResDto result = memberService.login(1L, "123456","");

// Then
assertEquals("로그인이 완료되었습니다!", result.getMessage());
Expand All @@ -60,7 +60,7 @@ void testLoginIncorrectPw() {
when(memberRepository.findMemberByMemberIdxAndMemberLoginPw(1L, "123456")).thenReturn(member);

// When
LoginResDto result = memberService.login(1L, "456789");
LoginResDto result = memberService.login(1L, "456789","");

// Then
assertEquals("비밀번호가 맞지 않습니다.", result.getMessage());
Expand Down

0 comments on commit 6bb506d

Please sign in to comment.