Skip to content

Commit

Permalink
#9 #23 #108 refactor : 주석 및 불필요한 sout 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
shinhn committed Mar 24, 2023
1 parent be91b3b commit 9a27915
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,4 @@ public class APNController {
public ApplicationResponse<String> createAPN() throws ExecutionException, InterruptedException {
return apnService.createApplePushNotification();
}

// /**
// * apn 참여자 보드 참여 신청 호스트에게 푸쉬 알림
// * @author 토마스
// */
// @ApiOperation(value = "apn 참여자 보드 참여 신청 호스트에게 푸쉬 알림", notes = "apn 푸쉬 알람 생성 요청.")
// @ApiResponses({
// @ApiResponse(code= 201, message = "요청에 성공하였습니다."),
// @ApiResponse(code= 404, message = "존재하지 않는 유저입니다."),
// @ApiResponse(code= 404, message = "존재하지 않는 Board아이디입니다."),
// @ApiResponse(code= 404, message = "요청한 유저가 호스트가 아닙니다."),
// @ApiResponse(code = 4000 , message = "서버 오류입니다.")
// })
// @PostMapping("/boarduser-join")
// public ApplicationResponse<String> createBoardUserJoinAPN(@RequestBody @Validated CreateBoardUserJoinAPNReq dto) throws ExecutionException, InterruptedException {
// return apnService.createBoardUserJoinAPN(dto);
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public ApplicationResponse<String> createApplePushNotification() throws Executio

// 메시지를 동기로 전송
val response = sendNotificationFuture.get();
System.out.println("response는 ==="+ response);
// System.out.println("response는 ==="+ response);

// 메시지를 비동기로 전송
// sendNotificationFuture.addListener { future ->
Expand All @@ -63,12 +63,12 @@ public ApplicationResponse<String> createApplePushNotification() throws Executio
// 성공 응답시 null 반환
// 오류 응답시 BadDeviceToken 등의 오류 코드 문자열 반환
// println(response.rejectionReason);
System.out.println("getRejectionReason는 === :"+response.getRejectionReason());
// System.out.println("getRejectionReason는 === :"+response.getRejectionReason());

// 응답에서 원본 메시지 획득 가능
// {"aps":{"alert":{"body":"test_body","title":"test_title"}},"test_data_3":"def","test_data_1":"abc"}
// println(response.pushNotification.payload);
System.out.println("getPushNotification는 === :"+response.getPushNotification());
// System.out.println("getPushNotification는 === :"+response.getPushNotification());

return ApplicationResponse.ok("애플 푸쉬 알람 성공");
}
Expand All @@ -93,27 +93,11 @@ public ApplicationResponse<String> createBoardUserJoinAPN(CreateBoardUserJoinAPN

// 메시지를 동기로 전송
val response = sendNotificationFuture.get();
System.out.println("response는 ==="+ response);

// 메시지를 비동기로 전송
// sendNotificationFuture.addListener { future ->
// val response = future.now
// println(response);
// }
sendNotificationFuture.addListener(future ->
System.out.println("getNow는 == "+future.getNow()));


// 성공 응답시 null 반환
// 오류 응답시 BadDeviceToken 등의 오류 코드 문자열 반환
// println(response.rejectionReason);
System.out.println("getRejectionReason는 === :"+response.getRejectionReason());

// 응답에서 원본 메시지 획득 가능
// {"aps":{"alert":{"body":"test_body","title":"test_title"}},"test_data_3":"def","test_data_1":"abc"}
// println(response.pushNotification.payload);
System.out.println("getPushNotification는 === :"+response.getPushNotification());

return ApplicationResponse.ok("애플 푸쉬 알람 성공");
}

Expand All @@ -138,10 +122,6 @@ public ApplicationResponse<String> delBoardUserJoinAPN(DelBoardUserJoinAPNReq dt
val response = sendNotificationFuture.get();

// 메시지를 비동기로 전송
// sendNotificationFuture.addListener { future ->
// val response = future.now
// println(response);
// }
sendNotificationFuture.addListener(future ->
System.out.println("getNow는 == "+future.getNow()));

Expand All @@ -167,26 +147,11 @@ public ApplicationResponse<String> createClipBoardAPN(CreateClipBoardAPNReq dto)

// 메시지를 동기로 전송
val response = sendNotificationFuture.get();
System.out.println("response는 ==="+ response);

// 메시지를 비동기로 전송
// sendNotificationFuture.addListener { future ->
// val response = future.now
// println(response);
// }
sendNotificationFuture.addListener(future ->
System.out.println("getNow는 == "+future.getNow()));

// 성공 응답시 null 반환
// 오류 응답시 BadDeviceToken 등의 오류 코드 문자열 반환
// println(response.rejectionReason);
System.out.println("getRejectionReason는 === :"+response.getRejectionReason());

// 응답에서 원본 메시지 획득 가능
// {"aps":{"alert":{"body":"test_body","title":"test_title"}},"test_data_3":"def","test_data_1":"abc"}
// println(response.pushNotification.payload);
System.out.println("getPushNotification는 === :"+response.getPushNotification());

return ApplicationResponse.ok("애플 푸쉬 알람 성공");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ public TokenResponse requestCodeValidations(ServicesResponse serviceResponse, St
// 이메일 추출
String email = user.getAsString("email");

// 이름 추출
// Map<String, String> name = (Map<String, String>) user.get("name");
// String lastName = name.get("lastName");
// String firstName = name.get("firstName");
// String fullName = lastName + firstName;

// 만약 처음 인증하는 유저여서 refresh 토큰 없으면 client_secret, authorization_code로 검증
if (client_secret != null && code != null && refresh_token == null) {
tokenResponse = appleUtils.validateAuthorizationGrantCode(client_secret, code);
Expand All @@ -88,6 +82,7 @@ public TokenResponse requestCodeValidations(ServicesResponse serviceResponse, St
CreateUserAppleReq createUserAppleReq = new CreateUserAppleReq(email, tokenResponse.getRefresh_token(), null, UserType.APPLE, tokenResponse.getAccess_token(), tokenResponse.getExpires_in());
saveduser = userService.createUserApple(createUserAppleReq);
}

// 이미 refresh 토큰 있는 유저면 client_secret, refresh_token로 검증
else if (client_secret != null && code == null && refresh_token != null) {
tokenResponse = appleUtils.validateAnExistingRefreshToken(client_secret, refresh_token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,13 @@ public ApplicationResponse<BoardUserRes> approveBoardUser(CreateBoardUserReq dto

boardUser.changeApplyStatus(); // 참여 승인으로 상태 업데이트
board.addCurrentMember();// 보드 현재 인원 +1
//board.addBoardUser(boardUser); // 보드에 멤버 추가

List<User> participants = board.getBoardUsers().stream()
//.filter(bu -> !bu.getUser().equals(board.getHost()))
.filter(bu -> bu.getApplyStatus().equals(1)) // 참여 승인된 사람만 조회
.map(bu -> bu.getUser())
.collect(Collectors.toList());

List<String> participantsImageUUIds = board.getBoardUsers().stream()
//.filter(bu -> !bu.getUser().equals(board.getHost()))
.filter(bu -> bu.getApplyStatus().equals(1)) // 참여 승인된 사람만 조회
.map(bu -> bu.getUser().getProfileImg())
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public ApplicationResponse<ClipBoardRes> createClipBoard(CreateClipBoardReq dto)
List<BoardUser> boardUsers = board.getBoardUsers().stream()
.filter(boardUser -> boardUser.getUser().getStatus().equals(BaseStatus.ACTIVE))
.collect(Collectors.toList());

if(boardUsers!=null){
for(BoardUser bu: boardUsers){
try {
Expand All @@ -104,9 +105,6 @@ public ApplicationResponse<GetClipBoardRes> findClipBoard(GetClipBoardReq dto){
User user = userRepository.findByUserId(dto.getUserId())
.orElseThrow(() -> new NotFoundUserException());

Board board = boardRepository.findBoardById(dto.getBoardId())
.orElseThrow(() -> new NotFoundBoardException());

ClipBoard clipBoard = clipBoardRepository.findClipBoardById(dto.getClipBoardId())
.orElseThrow(() -> new NotFoundClipBoardException());

Expand All @@ -121,37 +119,6 @@ public ApplicationResponse<GetClipBoardRes> findClipBoard(GetClipBoardReq dto){
return ApplicationResponse.ok(getClipBoardRes);
}


// @Transactional(readOnly = true)
// @Override
// public ApplicationResponse<List<GetClipBoardRes>> findAllClipBoards(GetAllClipBoardsReq dto){
//
// userService.validateRefreshToken(dto.getUserId(), dto.getRefreshToken());
//
// User user = userRepository.findByUserId(dto.getUserId())
// .orElseThrow(() -> new NotFoundUserException());
//
// Board board = boardRepository.findBoardById(dto.getBoardId())
// .orElseThrow(() -> new NotFoundBoardException());
//
// List<User> blockedUsers = blockRepository.findBlocksByBlockingUserId(dto.getUserId()).stream()
// .map(block -> block.getBlockedUser())
// .collect(Collectors.toList());
//
// // 클립보드 res안에 해당하는 코멘트 리스트까지 조회 및 포함
// // 유저 profileImgUrl 또한 img uuid -> s3 url로 변환
// List<GetClipBoardRes> getClipBoardResList = clipBoardRepository.findAllByBoardId(dto.getBoardId()).stream()
// .filter(clipBoard -> !blockedUsers.contains(clipBoard.getUser())) // 차단당한 유저의 데이터 제외
// .map(clipBoard -> GetClipBoardRes.toDto(clipBoard, commentRepository.findAllCommentsByClipBoardId(clipBoard.getId()).stream()
// .filter(comment -> !blockedUsers.contains(comment.getUser()))
// .map(comment -> CommentRes.toDto(comment))
// .collect(Collectors.toList()),
// awsS3Service.makeUrlOfFilename(clipBoard.getUser().getProfileImg())))
// .collect(Collectors.toList());
//
// return ApplicationResponse.ok(getClipBoardResList);
// }

@Transactional(readOnly = true)
@Override
public ApplicationResponse<GetClipBoardsRes> findAllClipBoards(GetAllClipBoardsReq dto){
Expand Down

0 comments on commit 9a27915

Please sign in to comment.