Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back/main #232

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions BE/src/news/news.service.ts
Original file line number Diff line number Diff line change
@@ -49,9 +49,17 @@ export class NewsService {
@Cron('*/1 8-16 * * 1-5')
async cronNewsData() {
await this.newsRepository.delete({ query: In(['증권', '주식']) });
await this.getNewsDataByQuery('주식');
await this.getNewsDataByQuery('증권');
const stockNews = await this.getNewsDataByQuery('주식');
const securityNews = await this.getNewsDataByQuery('증권');

const allNews = [...stockNews, ...securityNews];
const uniqueNews = allNews.filter(
(news, index) =>
allNews.findIndex((i) => i.originallink === news.originallink) ===
index,
);

await this.newsRepository.save(uniqueNews);
await this.newsRepository.update(
{},
{
@@ -67,13 +75,16 @@ export class NewsService {

const response =
await this.naverApiDomainService.requestApi<NewsApiResponse>(queryParams);
const formattedData = this.formatNewsData(value, response.items);

return this.newsRepository.save(formattedData);
return this.newsRepository.save(this.formatNewsData(value, response.items));
}

private formatNewsData(query: string, items: NewsDataOutputDto[]) {
return items.slice(0, 10).map((item) => {
const uniqueItems = items.filter(
(item, index) =>
items.findIndex((i) => i.originallink === item.originallink) === index,
);

return uniqueItems.slice(0, 10).map((item) => {
const result = new NewsItemDataDto();

result.title = this.htmlEncode(item.title);

Unchanged files with check annotations Beta

if (data && data.length > 0 && debounceValue && !isLoading) {
addSearchHistory(formatNoSpecialChar(debounceValue));
}
}, [data, debounceValue]);

Check warning on line 39 in FE/src/components/Search/index.tsx

GitHub Actions / FE-test-and-build

React Hook useEffect has missing dependencies: 'addSearchHistory' and 'isLoading'. Either include them or remove the dependency array
if (!isOpen) return null;
);
}
},
[

Check warning on line 291 in FE/src/components/StocksDetail/Chart.tsx

GitHub Actions / FE-test-and-build

React Hook useCallback has unnecessary dependencies: 'drawBarChart', 'drawCandleChart', 'drawChartGrid', 'drawLineChart', 'drawLowerYAxis', 'drawUpperYAxis', 'drawXAxis', and 'padding'. Either exclude them or remove the dependency array. Outer scope values like 'padding' aren't valid dependencies because mutating them doesn't re-render the component
padding,
upperLabelNum,
lowerLabelNum,
},
);
},
[id, buttonFlag],

Check warning on line 34 in FE/src/components/StocksDetail/PriceSection.tsx

GitHub Actions / FE-test-and-build

React Hook useCallback has a missing dependency: 'queryClient'. Either include it or remove the dependency array
);
useEffect(() => {