Skip to content

Commit

Permalink
Merge pull request #24 from 1223v/test
Browse files Browse the repository at this point in the history
Fix: 당일 주문 수만 확인 가능하도록 수정
  • Loading branch information
1223v authored Dec 3, 2023
2 parents a1e342f + 684a105 commit 930ffa2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
public interface OrderRepository extends JpaRepository<Order, Long> {
List<Order> findAllById(Long id);

List<Order> findAllByProgressAndStoreId(Progress progress, Long storeId);
List<Order> findAllByProgressAndStoreIdAndCreatedAtBetween(
Progress progress, Long storeId, LocalDateTime startDateTime, LocalDateTime endDateTime);

Optional<Order> findByOrderId(String orderId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ public class OAuth2LoginSuccessHandler implements AuthenticationSuccessHandler {
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws
IOException, ServletException {
log.info("OAuth2 Login 성공!");

try {
CustomOAuth2User oAuth2User = (CustomOAuth2User)authentication.getPrincipal();

loginSuccess(response, oAuth2User); // 로그인에 성공한 경우 access, refresh 토큰 생성
log.info("OAuth2 Login 성공! - 로그인 성공 후 리다이렉트");
response.sendRedirect(jwtService.getFrontendUrl());
} catch (Exception e) {
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

import com.readyvery.readyverydemo.domain.CeoInfo;
import com.readyvery.readyverydemo.domain.SocialType;
import com.readyvery.readyverydemo.domain.UserInfo;
import com.readyvery.readyverydemo.domain.repository.CeoRepository;
import com.readyvery.readyverydemo.domain.repository.UserRepository;
import com.readyvery.readyverydemo.security.oauth2.CustomOAuth2User;
import com.readyvery.readyverydemo.security.oauth2.OAuthAttributes;

Expand All @@ -27,14 +25,12 @@
@RequiredArgsConstructor
public class CustomOAuth2UserService implements OAuth2UserService<OAuth2UserRequest, OAuth2User> {


private final CeoRepository ceoRepository;

private static final String KAKAO = "kakao";

@Override
public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException {
log.info("CustomOAuth2UserService.loadUser() 실행 - OAuth2 로그인 요청 진입");

/**
* DefaultOAuth2UserService 객체를 생성하여, loadUser(userRequest)를 통해 DefaultOAuth2User 객체를 생성 후 반환
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.readyvery.readyverydemo.src.order;

import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Base64;
import java.util.Collections;
Expand Down Expand Up @@ -56,8 +58,10 @@ public OrderRegisterRes getOrders(Long id, Progress progress) {
if (progress == null) {
throw new BusinessLogicException(ExceptionCode.NOT_PROGRESS_ORDER);
}

List<Order> orders = orderRepository.findAllByProgressAndStoreId(progress, ceoInfo.getStore().getId());
LocalDateTime startOfDay = LocalDate.now().atStartOfDay();
LocalDateTime endOfDay = startOfDay.plusDays(1).minusNanos(1);
List<Order> orders = orderRepository.findAllByProgressAndStoreIdAndCreatedAtBetween(
progress, ceoInfo.getStore().getId(), startOfDay, endOfDay);

if (orders.isEmpty()) {
return OrderRegisterRes.builder()
Expand Down

0 comments on commit 930ffa2

Please sign in to comment.