Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: member login fcmToken추가 #135

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading