Skip to content

Commit

Permalink
#98 #108 Feat : 유저 로그인된 상태일 때만 푸쉬 알림 전송
Browse files Browse the repository at this point in the history
  • Loading branch information
shinhn committed Jan 13, 2023
1 parent 1411fd6 commit 6c250fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.yogit.server.global.dto.ApplicationResponse;
import com.yogit.server.s3.AwsS3Service;
import com.yogit.server.user.entity.User;
import com.yogit.server.user.entity.UserStatus;
import com.yogit.server.user.exception.NotFoundUserException;
import com.yogit.server.user.repository.UserRepository;
import com.yogit.server.user.service.UserService;
Expand Down Expand Up @@ -80,7 +81,7 @@ public ApplicationResponse<BoardUserRes> joinBoardUser(CreateBoardUserReq dto) {
// 호스트에게 참여 APN 푸쉬 알림

try {
apnService.createBoardUserJoinAPN(new CreateBoardUserJoinAPNReq(board.getHost().getDeviceToken(), user.getName(), board.getId(), board.getTitle()));
if(user.getUserStatus().equals(UserStatus.LOGIN)) apnService.createBoardUserJoinAPN(new CreateBoardUserJoinAPNReq(board.getHost().getDeviceToken(), user.getName(), board.getId(), board.getTitle()));
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.yogit.server.board.service.clipboard;

import com.yogit.server.apns.dto.req.CreateBoardUserJoinAPNReq;
import com.yogit.server.apns.dto.req.CreateClipBoardAPNReq;
import com.yogit.server.apns.service.APNService;
import com.yogit.server.block.repository.BlockRepository;
Expand All @@ -22,6 +21,7 @@
import com.yogit.server.global.dto.ApplicationResponse;
import com.yogit.server.s3.AwsS3Service;
import com.yogit.server.user.entity.User;
import com.yogit.server.user.entity.UserStatus;
import com.yogit.server.user.exception.NotFoundUserException;
import com.yogit.server.user.repository.UserRepository;
import com.yogit.server.user.service.UserService;
Expand Down Expand Up @@ -79,7 +79,7 @@ public ApplicationResponse<ClipBoardRes> createClipBoard(CreateClipBoardReq dto)
if(boardUsers!=null){
for(BoardUser bu: boardUsers){
try {
apnService.createClipBoardAPN(new CreateClipBoardAPNReq(bu.getUser().getDeviceToken(), user.getName(), board.getId(), board.getTitle()));
if(user.getUserStatus().equals(UserStatus.LOGIN)) apnService.createClipBoardAPN(new CreateClipBoardAPNReq(bu.getUser().getDeviceToken(), user.getName(), board.getId(), board.getTitle()));
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public ApplicationResponse<UserDeviceTokenRes> addDeviceToken(@ModelAttribute Ad
})
@PostMapping(value = "/log-out")
@ResponseBody
public ApplicationResponse<LogoutRes> logInApple(@ModelAttribute LogoutReq logoutReq) {
public ApplicationResponse<LogoutRes> logOut(@ModelAttribute LogoutReq logoutReq) {

return userService.logout(logoutReq);
}
Expand Down

0 comments on commit 6c250fd

Please sign in to comment.