Skip to content

Commit

Permalink
Merge pull request #192 from YogitTeam/feat/report
Browse files Browse the repository at this point in the history
#108 #98 feat : Apn payloadBuilder - time, isOpen 컬럼 추가
  • Loading branch information
shinhn authored Apr 22, 2023
2 parents 5a25d08 + 325b749 commit 5b72487
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ public class CreateBoardUserJoinAPNReq {
private String joinUserName;
private Long boardId;
private String boardName;
private String time;
boolean isOpened;

@Builder
public CreateBoardUserJoinAPNReq(String destinationDeviceToken, String joinUserName, Long boardId, String boardName, String time) {
public CreateBoardUserJoinAPNReq(String destinationDeviceToken, String joinUserName, Long boardId, String boardName) {
this.destinationDeviceToken = destinationDeviceToken;
this.joinUserName = joinUserName;
this.boardId = boardId;
this.boardName = boardName;
this.time = time;
this.isOpened = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ public class CreateClipBoardAPNReq {
private String userName;
private Long boardId;
private String boardName;
private String time;
boolean isOpened;

@Builder
public CreateClipBoardAPNReq(String destinationDeviceToken, String userName, Long boardId, String boardName, String time) {
public CreateClipBoardAPNReq(String destinationDeviceToken, String userName, Long boardId, String boardName) {
this.destinationDeviceToken = destinationDeviceToken;
this.userName = userName;
this.boardId = boardId;
this.boardName = boardName;
this.time = time;
this.isOpened = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ public class DelBoardUserJoinAPNReq {
private String delUserName;
private Long boardId;
private String boardName;
private String time;
boolean isOpened;

@Builder
public DelBoardUserJoinAPNReq(String destinationDeviceToken, String delUserName, Long boardId, String boardName, String time) {
public DelBoardUserJoinAPNReq(String destinationDeviceToken, String delUserName, Long boardId, String boardName) {
this.destinationDeviceToken = destinationDeviceToken;
this.delUserName = delUserName;
this.boardId = boardId;
this.boardName = boardName;
this.time = time;
this.isOpened = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.ExecutionException;

@Service
Expand Down Expand Up @@ -85,6 +87,8 @@ public ApplicationResponse<String> createBoardUserJoinAPN(CreateBoardUserJoinAPN

payloadBuilder.addCustomProperty("boardId", dto.getBoardId());
payloadBuilder.addCustomProperty("pushType", PushType.JOINAPPLY.toString());
payloadBuilder.addCustomProperty("time", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
payloadBuilder.addCustomProperty("isOpened", false);

val payload = payloadBuilder.buildWithDefaultMaximumLength();
val token = TokenUtil.sanitizeTokenString(dto.getDestinationDeviceToken());
Expand Down Expand Up @@ -112,6 +116,8 @@ public ApplicationResponse<String> delBoardUserJoinAPN(DelBoardUserJoinAPNReq dt

payloadBuilder.addCustomProperty("boardId", dto.getBoardId());
payloadBuilder.addCustomProperty("pushType", PushType.DELAPPLY.toString());
payloadBuilder.addCustomProperty("time", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
payloadBuilder.addCustomProperty("isOpened", false);

val payload = payloadBuilder.buildWithDefaultMaximumLength();
val token = TokenUtil.sanitizeTokenString(dto.getDestinationDeviceToken());
Expand Down Expand Up @@ -139,6 +145,8 @@ public ApplicationResponse<String> createClipBoardAPN(CreateClipBoardAPNReq dto)

payloadBuilder.addCustomProperty("boardId", dto.getBoardId());
payloadBuilder.addCustomProperty("pushType", PushType.CREATE_CLIPBOARD.toString());
payloadBuilder.addCustomProperty("time", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
payloadBuilder.addCustomProperty("isOpened", false);

val payload = payloadBuilder.buildWithDefaultMaximumLength();
val token = TokenUtil.sanitizeTokenString(dto.getDestinationDeviceToken());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public ApplicationResponse<BoardUserRes> joinBoardUser(CreateBoardUserReq dto) {

// 호스트에게 멤버 참여 APN 푸쉬 알림
try {
if(user.getUserStatus().equals(UserStatus.LOGIN) && board.getHost().getDeviceToken() != null) apnService.createBoardUserJoinAPN(new CreateBoardUserJoinAPNReq(board.getHost().getDeviceToken(), user.getName(), board.getId(), board.getTitle(), LocalDateTime.now().toString()));
if(user.getUserStatus().equals(UserStatus.LOGIN) && board.getHost().getDeviceToken() != null) apnService.createBoardUserJoinAPN(new CreateBoardUserJoinAPNReq(board.getHost().getDeviceToken(), user.getName(), board.getId(), board.getTitle()));
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
Expand Down Expand Up @@ -155,7 +155,7 @@ public ApplicationResponse<Void> delBoardUser(CreateBoardUserReq dto){

// 호스트에게 멤버 참여 취소 APN 푸쉬 알림
try {
if(user.getUserStatus().equals(UserStatus.LOGIN) && board.getHost().getDeviceToken() != null) apnService.delBoardUserJoinAPN(new DelBoardUserJoinAPNReq(board.getHost().getDeviceToken(), user.getName(), board.getId(), board.getTitle(), LocalDateTime.now().toString()));
if(user.getUserStatus().equals(UserStatus.LOGIN) && board.getHost().getDeviceToken() != null) apnService.delBoardUserJoinAPN(new DelBoardUserJoinAPNReq(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
Expand Up @@ -83,7 +83,7 @@ public ApplicationResponse<ClipBoardRes> createClipBoard(CreateClipBoardReq dto)
if(boardUsers!=null){
for(BoardUser bu: boardUsers){
try {
if(user.getUserStatus().equals(UserStatus.LOGIN) && !user.equals(bu.getUser()) && bu.getUser().getDeviceToken() != null) apnService.createClipBoardAPN(new CreateClipBoardAPNReq(bu.getUser().getDeviceToken(), user.getName(), board.getId(), board.getTitle(), LocalDateTime.now().toString()));
if(user.getUserStatus().equals(UserStatus.LOGIN) && !user.equals(bu.getUser()) && bu.getUser().getDeviceToken() != null) apnService.createClipBoardAPN(new CreateClipBoardAPNReq(bu.getUser().getDeviceToken(), user.getName(), board.getId(), board.getTitle()));
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
Expand Down

0 comments on commit 5b72487

Please sign in to comment.