Skip to content

Commit

Permalink
[�fix] 포트폴리오 수익 히스토리 생성 메소드에 @transactional 추가 (#12)
Browse files Browse the repository at this point in the history
* #4 fix: 인가 코드 요청 URL 경로 변경

- /api/auth/:provider/url -> /api/auth/:provider/authUrl

* #4 feat: 로그 추가

- 네이버 소셜 로그인 버그를 위한 로그 추가

* #4 fix: 포트폴리오 수익 히스토리 생성 메소드에 @transactional 추가
  • Loading branch information
yonghwankim-dev authored Nov 13, 2023
1 parent ed2eb20 commit 4dcec9e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
Expand All @@ -14,9 +12,6 @@
import codesquad.fineants.domain.portfolio.PortfolioRepository;
import codesquad.fineants.domain.portfolio_gain_history.PortfolioGainHistory;
import codesquad.fineants.domain.portfolio_gain_history.PortfolioGainHistoryRepository;
import codesquad.fineants.domain.portfolio_holding.PortfolioHolding;
import codesquad.fineants.domain.stock.Stock;
import codesquad.fineants.spring.api.kis.KisService;
import codesquad.fineants.spring.api.kis.manager.CurrentPriceManager;
import codesquad.fineants.spring.api.portfolio_gain_history.response.PortfolioGainHistoryCreateResponse;
import lombok.RequiredArgsConstructor;
Expand All @@ -29,9 +24,9 @@
public class PortfolioGainHistoryService {
private final PortfolioGainHistoryRepository repository;
private final PortfolioRepository portfolioRepository;
private final KisService kisService;
private final CurrentPriceManager currentPriceManager;

@Transactional
@Scheduled(cron = "0 0 16 * * ?") // 매일 16시에 실행
public void scheduledPortfolioGainHistory() {
PortfolioGainHistoryCreateResponse response = addPortfolioGainHistory();
Expand All @@ -53,14 +48,4 @@ public PortfolioGainHistoryCreateResponse addPortfolioGainHistory() {

return PortfolioGainHistoryCreateResponse.from(portfolioGainHistories);
}

private static List<String> readTickerSymbols(List<Portfolio> portfolios) {
List<String> tickerSymbols = portfolios.stream()
.map(Portfolio::getPortfolioHoldings)
.flatMap(Collection::stream)
.map(PortfolioHolding::getStock)
.map(Stock::getTickerSymbol)
.collect(Collectors.toList());
return tickerSymbols;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import codesquad.fineants.domain.portfolio.PortfolioRepository;
import codesquad.fineants.spring.api.errors.errorcode.PortfolioErrorCode;
import codesquad.fineants.spring.api.errors.exception.NotFoundResourceException;
import codesquad.fineants.spring.api.kis.KisService;
import codesquad.fineants.spring.api.kis.manager.CurrentPriceManager;
import codesquad.fineants.spring.api.portfolio_notification.request.PortfolioNotificationModifyRequest;
import codesquad.fineants.spring.api.portfolio_notification.response.PortfolioNotificationModifyResponse;
Expand All @@ -28,7 +27,6 @@ public class PortfolioNotificationService {

private final PortfolioRepository portfolioRepository;
private final MailService mailService;
private final KisService kisService;
private final RedisTemplate<String, String> redisTemplate;
private final CurrentPriceManager currentPriceManager;

Expand Down

0 comments on commit 4dcec9e

Please sign in to comment.