-
Notifications
You must be signed in to change notification settings - Fork 1
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
[BE] 6.02 각 주식 정보 가져오기 API 구현 #54 #107
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 앗 이거도 저희 컨벤션 맞춰야겠네요...! 저는 클래스 이름은 Stock 이런식으로 하구
@Entity('stocks')
이렇게 옵션 추가해서 올렸었거든요그리고 저희 BaseEntity는 쓰는걸로 결정났었나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 아뇨, BaseEntity 쓰는 거로 결정은 안났고.. 제가 필요한 코드랑 진명님이 작성하신 코드(stock-list 엔티티와 레포지토리 부분)랑 완전 똑같아서 여쭤보니까 상위 폴더에 만들어서 같이 쓰는게 낫겠다는 결론이 나왔어요. 그래서 나중에 합치기 쉽게 복사붙여넣기 해서 가져왔어요..ㅎㅎ
클래스 이름이랑 BaseEntity 사용 여부와 같은 경우에는 이야기 나눠봐야겠네요!