-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from boostcampwm-2024/feature/api/stockDetail…
…-#54 [BE] 6.02 각 주식 정보 가져오기 API 구현 #54
- Loading branch information
Showing
4 changed files
with
55 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { BaseEntity, Column, Entity, PrimaryColumn } from 'typeorm'; | ||
|
||
@Entity() | ||
export class Stocks extends BaseEntity { | ||
@PrimaryColumn() | ||
code: string; | ||
|
||
@Column() | ||
name: string; | ||
|
||
@Column() | ||
market: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
import { KoreaInvestmentModule } from '../../koreaInvestment/korea-investment.module'; | ||
import { StockDetailController } from './stock-detail.controller'; | ||
import { StockDetailService } from './stock-detail.service'; | ||
import { StockDetailRepository } from './stock-detail.repository'; | ||
import { Stocks } from './stock-detail.entity'; | ||
|
||
@Module({ | ||
imports: [KoreaInvestmentModule], | ||
imports: [KoreaInvestmentModule, TypeOrmModule.forFeature([Stocks])], | ||
controllers: [StockDetailController], | ||
providers: [StockDetailService], | ||
providers: [StockDetailService, StockDetailRepository], | ||
}) | ||
export class StockDetailModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { InjectDataSource } from '@nestjs/typeorm'; | ||
import { Injectable } from '@nestjs/common'; | ||
import { DataSource, Repository } from 'typeorm'; | ||
import { Stocks } from './stock-detail.entity'; | ||
|
||
@Injectable() | ||
export class StockDetailRepository extends Repository<Stocks> { | ||
constructor(@InjectDataSource() dataSource: DataSource) { | ||
super(Stocks, dataSource.createEntityManager()); | ||
} | ||
|
||
async findOneByCode(code: string) { | ||
return this.findOne({ where: { code } }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters