-
Notifications
You must be signed in to change notification settings - Fork 0
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
[마켓] 주문창 gRPC 통신 및 매수, 매도 주문 등록 #89
base: develop
Are you sure you want to change the base?
Conversation
Co-authored-by: Jeongwisdom <[email protected]>
Co-authored-by: Jeongwisdom [email protected]
- port# : 5001 Co-authored-by: Jeongwisdom [email protected]
Co-authored-by: Jeongwisdom <[email protected]>
- number -> string 정상화
- OrderLimitRequestDto: 지정가 매수, 매도 요청 - coin_code -> coinCode - order.proto 필드명 변경 - orderId -> historyId
- AuthenticatedGuard import문 경로 변경
- 기존 비어있는 테스트 파일 삭제 - 매수 매도 주문 - 주문 성공 - 잔액 부족시 BadRequestException - 트랜잭션 오류시InternalServerErrorException
@TaeRaeKim |
리뷰 후에 머지하면서 issue close 하도록 하겠습니다! |
|
@GrpcMethod('OrderService', 'makeBuyOrder') | ||
async makeBuyOrder(buyOrderRequest: OrderRequestDto): Promise<OrderResponseDto> { | ||
return await this.balanceService.makeBuyOrder(buyOrderRequest); | ||
} |
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.
Grpc 전용 메소드들이 controller에 생성된 이유가 있을까요?
제 생각에는 service에 위치하는게 좋아 보입니다.
Router (Controller)는 사용자와 서버간에 상호작용하는 어플리케이션 계층에 속하는데, 비지니스 계층(TransactionService)에서 어플리케이션 계층(Balance Controller)를 호출하는 것이 적절치 않아보입니다.
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.
동의합니다. 서비스 게층 간의 상호작용으로 보는게 더 적절하겠네요. 내용 반영하여 수정하겠습니다.
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.
고생하셨습니다!!
options: { | ||
package: 'order', | ||
protoPath: '@app/grpc/order.proto', | ||
url: 'localhost:5001', |
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.
localhost 보다는 실제로 필요한 데이터를 환경변수 형태로 넣어주세요!
ex) ${BALANCE_SERVICE_HOST}:${GRPC_PORT}
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.
환경변수는 docker build 시에 주입해주고 있나요? 환경변수를 어디에 정의해야 적절할지요?
@@ -60,6 +60,17 @@ | |||
"compilerOptions": { | |||
"tsConfigPath": "libs/session/tsconfig.lib.json" | |||
} | |||
}, | |||
"grpc": { |
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.
요기는 궁금한 내용인데 직접 작성해주신건가요? 아니면 nest-cli로 generate하면서 자동생성된 코드인가요?
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.
배포 시, order.proto 파일을 카피하기 위해 직접 넣어준 코드입니다.
@@ -105,7 +105,8 @@ | |||
"^@app/common(|/.*)$": "<rootDir>/libs/common/src/$1", | |||
"^@app/prisma(|/.*)$": "<rootDir>/libs/prisma/src/$1", | |||
"^@app/session(|/.*)$": "<rootDir>/libs/session/src/$1", | |||
"^@app/redis(|/.*)$": "<rootDir>/libs/redis/src/$1" | |||
"^@app/redis(|/.*)$": "<rootDir>/libs/redis/src/$1", |
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.
레디스모듈은 잘못추가된거같네요~
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.
"^@app/redis(|/.*)$": "<rootDir>/libs/redis/src/$1",
그럼 요 라인은 필요 없고 삭제하면 될까요?
import { PrismaModule } from '@app/prisma'; | ||
import { ClientsModule, Transport } from '@nestjs/microservices'; | ||
import { TransactionGrcpService } from './transaction.grcp.service'; | ||
import { SessionModule } from '@app/session'; | ||
|
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.
오 여기서는 고쳐졌군여 ㅎㅎ 앞에서 리뷰를 달았는데 머쓱하네요
|
앗 좋은 지적 감사합니다 |
📚 이슈 번호
✅ 작업 내용
🔥 트러블 슈팅
0. gRPC IDL 인터페이스와 DTO 간 필드명 불일치
order.proto을 DTO와 일치하도록 수정해 해결
1. Prisma가 MongoDB replica set 환경에서 primary 노드에 제대로 연결되지 않음
Prisma가 dockerId을 읽어들이지 못해서 생긴 문제로, replica set config을 localhost로 설정해 해결
2. prisma schema database url
공통 모듈인 �Prisma Service 내에서 database의 url을 DATABASE_URL로 처리하고 있어 해당 환경변수를 불어오지 않아 생긴 문제였습니다.
🖋️ 학습 자료
🐝 비고