Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Kernel360/f1-Orury-Backend
Browse files Browse the repository at this point in the history
… into refactor/#400_Refactor_ImageAsyncStore
  • Loading branch information
GBGreenBravo committed Mar 25, 2024
2 parents 8936028 + 585a277 commit f0aa342
Show file tree
Hide file tree
Showing 14 changed files with 726 additions and 58 deletions.
Original file line number Diff line number Diff line change
@@ -1,43 +1,33 @@
package org.orury.client.notification.interfaces;

import static org.orury.client.notification.interfaces.message.NotificationMessage.NOTIFICATIONS_READ;
import static org.orury.client.notification.interfaces.message.NotificationMessage.NOTIFICATION_STATUS_READ;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.orury.client.notification.application.NotificationFacade;
import org.orury.client.notification.application.NotificationService;
import org.orury.domain.base.converter.ApiResponse;
import org.orury.domain.notification.infrastructure.EmitterRepositoryImpl;
import org.orury.domain.notification.infrastructure.EmitterRepository;
import org.orury.domain.user.domain.dto.UserPrincipal;
import org.springframework.http.MediaType;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

import java.util.Map;

import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import static org.orury.client.notification.interfaces.message.NotificationMessage.NOTIFICATIONS_READ;
import static org.orury.client.notification.interfaces.message.NotificationMessage.NOTIFICATION_STATUS_READ;

@Slf4j
@RequiredArgsConstructor
@RequestMapping("/notification")
@RestController
public class NotificationController {
private final NotificationService notificationService;
private final NotificationFacade notificationFacade;

// 서버 메모리에 저장된 emitter, event cache를 파악하기 위해 임시로 추가했습니다.
private final EmitterRepositoryImpl emitterRepository;
private final EmitterRepository emitterRepository;
private final ObjectMapper objectMapper = new ObjectMapper();

@Operation(summary = "SSE 연결", description = "SSE 연결을 위해 호출한다.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.time.LocalDateTime;
import java.util.List;

import static org.orury.common.util.S3Folder.POST;
Expand Down Expand Up @@ -58,11 +57,8 @@ public List<PostDto> getPostDtosByUserId(Long userId, Long cursor, Pageable page
@Override
@Transactional(readOnly = true)
public Page<PostDto> getHotPostDtos(Pageable pageable) {
return postReader.findByLikeCountGreaterThanEqualAndCreatedAtGreaterThanEqualOrderByLikeCountDescCreatedAtDesc(
NumberConstants.HOT_POSTS_BOUNDARY,
LocalDateTime.now().minusMonths(1L),
pageable
).map(this::postDtoConverter);
return postReader.findByLikeCountGreaterDescAndCreatedAtDesc(pageable)
.map(this::postDtoConverter);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
import org.orury.client.auth.application.AuthService;
import org.orury.client.auth.application.jwt.JwtTokenService;
import org.orury.client.auth.application.oauth.OAuthServiceManager;
import org.orury.client.auth.application.AuthFacade;
import org.orury.client.auth.interfaces.AuthController;
import org.orury.client.comment.application.CommentService;
import org.orury.client.comment.application.CommentFacade;
import org.orury.client.comment.interfaces.CommentController;
import org.orury.client.gym.application.GymService;
import org.orury.client.crew.application.CrewFacade;
import org.orury.client.crew.interfaces.CrewController;
import org.orury.client.gym.application.GymFacade;
import org.orury.client.gym.interfaces.GymController;
import org.orury.client.post.application.PostService;
import org.orury.client.meeting.application.MeetingFacade;
import org.orury.client.meeting.interfaces.MeetingController;
import org.orury.client.notification.application.NotificationFacade;
import org.orury.client.notification.interfaces.NotificationController;
import org.orury.client.post.application.PostFacade;
import org.orury.client.post.interfaces.PostController;
import org.orury.client.review.application.ReviewService;
import org.orury.client.review.application.ReviewFacade;
import org.orury.client.review.interfaces.ReviewController;
import org.orury.client.user.application.UserService;
import org.orury.client.user.application.UserFacade;
import org.orury.client.user.interfaces.UserController;
import org.orury.common.config.SlackMessage;
import org.orury.domain.post.domain.PostLikeService;
import org.orury.domain.notification.infrastructure.EmitterRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
Expand All @@ -31,7 +35,10 @@
@WebMvcTest({
AuthController.class,
CommentController.class,
CrewController.class,
GymController.class,
MeetingController.class,
NotificationController.class,
PostController.class,
ReviewController.class,
UserController.class
Expand All @@ -45,32 +52,35 @@ public abstract class ControllerTest {
protected ObjectMapper mapper;

@MockBean
protected AuthService authService;
protected AuthFacade authFacade;

@MockBean
protected CommentService commentService;
protected CommentFacade commentFacade;

@MockBean
protected GymService gymService;
protected CrewFacade crewFacade;

@MockBean
protected JwtTokenService jwtTokenService;
protected GymFacade gymFacade;

@MockBean
protected OAuthServiceManager OAuthServiceManager;
protected MeetingFacade meetingFacade;

@MockBean
protected PostService postService;
protected NotificationFacade notificationFacade;

@MockBean
protected PostLikeService postLikeService;
protected PostFacade postFacade;

@MockBean
protected ReviewService reviewService;
protected ReviewFacade reviewFacade;

@MockBean
protected UserService userService;
protected UserFacade userFacade;

@MockBean
protected SlackMessage slackMessage;

@MockBean
protected EmitterRepository emitterRepository;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.orury.client.meeting.application.MeetingFacade;
import org.orury.client.meeting.application.MeetingService;
import org.orury.client.notification.application.NotificationService;
import org.orury.client.post.application.PostFacade;
import org.orury.client.post.application.PostService;
import org.orury.client.review.application.ReviewFacade;
import org.orury.client.review.application.ReviewService;
Expand Down Expand Up @@ -42,6 +43,7 @@ public abstract class FacadeTest {
protected MeetingService meetingService;
protected MeetingFacade meetingFacade;
protected NotificationService notificationService;
protected PostFacade postFacade;

@BeforeEach
void setUp() {
Expand All @@ -64,5 +66,6 @@ void setUp() {
authFacade = new AuthFacade(authService);
reviewFacade = new ReviewFacade(reviewService, userService, gymService);
meetingFacade = new MeetingFacade(meetingService, crewService, userService, gymService);
postFacade = new PostFacade(postService, userService);
}
}
Loading

0 comments on commit f0aa342

Please sign in to comment.