From 6294a4d3ef258f2725966318190017d7ee2f5d08 Mon Sep 17 00:00:00 2001 From: kimminsu Date: Wed, 27 Nov 2024 16:52:20 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=90=9B=20fix:=20console=20log=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/chat/chat.service.ts | 1 - packages/backend/src/user/user.service.ts | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/backend/src/chat/chat.service.ts b/packages/backend/src/chat/chat.service.ts index 03bdaa17..a0a0df68 100644 --- a/packages/backend/src/chat/chat.service.ts +++ b/packages/backend/src/chat/chat.service.ts @@ -120,7 +120,6 @@ export class ChatService { size: number, userId?: number, ) { - console.log('stockId', stockId); return this.dataSource .createQueryBuilder(Chat, 'chat') .leftJoinAndSelect('chat.likes', 'like', 'like.user_id = :userId', { diff --git a/packages/backend/src/user/user.service.ts b/packages/backend/src/user/user.service.ts index a132262d..48093a04 100644 --- a/packages/backend/src/user/user.service.ts +++ b/packages/backend/src/user/user.service.ts @@ -41,7 +41,6 @@ export class UserService { async createSubName(nickname: string) { return this.dataSource.transaction(async (manager) => { - console.log(await this.existsUserByNickname(nickname, manager)); if (!(await this.existsUserByNickname(nickname, manager))) { return '0001'; } @@ -51,7 +50,7 @@ export class UserService { .select('MAX(user.subName)', 'max') .where('user.nickname = :nickname', { nickname }) .getRawOne(); - console.log(maxSubName); + return (parseInt(maxSubName.max, 10) + 1).toString().padStart(4, '0'); }); } From 01b3a77b5304df496a2d2d79cdb804d31a0fb913 Mon Sep 17 00:00:00 2001 From: kimminsu Date: Wed, 27 Nov 2024 16:54:09 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=A8=20feat:=20=EB=B3=80=EB=8F=99?= =?UTF-8?q?=EB=A5=A0=20=EB=9D=BC=EC=9D=B4=EB=B8=8C=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=88=98=EC=A7=91=20=EC=8A=A4=EC=BC=80=EC=A4=84?= =?UTF-8?q?=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/scraper/openapi/api/openapiFluctuationData.api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/scraper/openapi/api/openapiFluctuationData.api.ts b/packages/backend/src/scraper/openapi/api/openapiFluctuationData.api.ts index 804b558a..bce63ddb 100644 --- a/packages/backend/src/scraper/openapi/api/openapiFluctuationData.api.ts +++ b/packages/backend/src/scraper/openapi/api/openapiFluctuationData.api.ts @@ -10,8 +10,8 @@ import { import { TR_IDS } from '@/scraper/openapi/type/openapiUtil.type'; import { getOpenApi } from '@/scraper/openapi/util/openapiUtil.api'; import { FluctuationRankStock } from '@/stock/domain/FluctuationRankStock.entity'; -import { StockLiveData } from '@/stock/domain/stockLiveData.entity'; import { Stock } from '@/stock/domain/stock.entity'; +import { StockLiveData } from '@/stock/domain/stockLiveData.entity'; @Injectable() export class OpenapiFluctuationData { @@ -26,7 +26,7 @@ export class OpenapiFluctuationData { setTimeout(() => this.getFluctuationRankStocks(), 1000); } - @Cron('*/1 9-16 * * 1-5') + @Cron('*/1 9-15 * * 1-5') async getFluctuationRankStocks() { await this.getDecreaseRankStocks(); await this.getIncreaseRankStocks(); From cfaafad53b1b021a80a6ce99e89608d591b166c0 Mon Sep 17 00:00:00 2001 From: kimminsu Date: Wed, 27 Nov 2024 17:58:01 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=EB=B0=B0=ED=8F=AC=20?= =?UTF-8?q?=ED=99=98=EA=B2=BD=EC=97=90=EC=84=9C=20=EB=B0=9C=EC=83=9D?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EC=B9=BC=EB=9F=BC=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/src/stock/dto/stock.response.ts | 5 +++-- packages/backend/src/stock/stock.service.ts | 17 +++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/backend/src/stock/dto/stock.response.ts b/packages/backend/src/stock/dto/stock.response.ts index 0d00104e..ffd7f4f8 100644 --- a/packages/backend/src/stock/dto/stock.response.ts +++ b/packages/backend/src/stock/dto/stock.response.ts @@ -153,14 +153,15 @@ export class StockRankResponses { result: StockRankResponse[]; constructor(stocks: Record[]) { + console.log(stocks); this.result = stocks.map((stock) => ({ id: stock.id, name: stock.name, currentPrice: parseFloat(stock.currentPrice), volume: parseInt(stock.volume), marketCap: stock.marketCap, - changeRate: parseFloat(stock.fluctuationRate), - rank: parseInt(stock.stockRank), + changeRate: parseFloat(stock.rank_fluctuation_rate), + rank: parseInt(stock.rank_rank), })); } } diff --git a/packages/backend/src/stock/stock.service.ts b/packages/backend/src/stock/stock.service.ts index a8952496..dfc7682e 100644 --- a/packages/backend/src/stock/stock.service.ts +++ b/packages/backend/src/stock/stock.service.ts @@ -10,13 +10,19 @@ import { } from './dto/stock.response'; import { UserStock } from '@/stock/domain/userStock.entity'; import { UserStocksResponse } from '@/stock/dto/userStock.response'; +import { FluctuationRankStock } from '@/stock/domain/FluctuationRankStock.entity'; @Injectable() export class StockService { constructor( private readonly datasource: DataSource, @Inject('winston') private readonly logger: Logger, - ) {} + ) { + const repository = datasource.getRepository(FluctuationRankStock); + const metadata = repository.metadata; + const columns = metadata.columns.map((column) => column.propertyName); + console.log(columns); + } async increaseView(stockId: string) { await this.datasource.transaction(async (manager) => { @@ -193,12 +199,7 @@ export class StockService { private getStockRankQuery(isRising: boolean) { return this.getStocksQuery() - .innerJoinAndSelect('stock.fluctuationRankStocks', 'FluctuationRankStock') - .addSelect([ - 'fluctuationRankStock.rank AS stockRank', - 'fluctuationRankStock.isRising AS isRising', - 'fluctuationRankStock.fluctuation_rate AS fluctuationRate', - ]) - .where('FluctuationRankStock.isRising = :isRising', { isRising }); + .innerJoinAndSelect('stock.fluctuationRankStocks', 'rank') + .where('rank.isRising = :isRising', { isRising }); } }