Skip to content

Commit

Permalink
Feature/#273 - 배포환경 칼럼 에러 문제 해결 (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
xjfcnfw3 authored Nov 27, 2024
2 parents df12230 + cfaafad commit 466bd72
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
1 change: 0 additions & 1 deletion packages/backend/src/chat/chat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions packages/backend/src/stock/dto/stock.response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,15 @@ export class StockRankResponses {
result: StockRankResponse[];

constructor(stocks: Record<string, string>[]) {
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),
}));
}
}
17 changes: 9 additions & 8 deletions packages/backend/src/stock/stock.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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 });
}
}
3 changes: 1 addition & 2 deletions packages/backend/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand All @@ -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');
});
}
Expand Down

0 comments on commit 466bd72

Please sign in to comment.