[박수환] sprint11#35
Open
soohwanpak wants to merge 1 commit intocodeit-sprint-fullstack:express-박수환from
Hidden character warning
The head ref may contain hidden characters: "express-\ubc15\uc218\ud658"
Open
Conversation
kimjong95
approved these changes
Feb 12, 2025
Collaborator
kimjong95
left a comment
There was a problem hiding this comment.
전체적으로 도메인모델에 대한 정의와 Requset, Response에 대한 타입정의가 이루어지지 않은것 같아요.
타입스크립트를 사용하는 이유는 프로젝트의 안정성을 높히는것 뿐만아니라 코드자체로도 어느정도의 문서화의 역할을 해주기 때문입니다. 잘 정의되어있는 타입들은 개발의 유지보수성도 향상시켜줍니다.
백엔드에서는 이러한 타입시스템을통해서 런타임에 발생할 수 있는 에러를 컴파일타임에 인지하고 해결할수 있게 도와줍니다. 다양한 유틸타입들도 활용하면 좋겠지만 현재는 말씀드린것처럼 모델, request, respnose들의 타입들을 지정해주시고, 공통으로 사용되는 타입들이있다면 묶어서 관리해보면 좋을 것 같습니다.
| "skipLibCheck": true, | ||
| "strictNullChecks": true, | ||
| "forceConsistentCasingInFileNames": true, | ||
| "noImplicitAny": false, |
Collaborator
There was a problem hiding this comment.
any타입에대한 경고를 띄울수있게 해당 옵션은 true로 두면 좋을것 같습니다!
| }); | ||
| } | ||
|
|
||
| async createProduct(userId: string, data: any) { |
Collaborator
There was a problem hiding this comment.
data의 타입을 dto형태로 정의해서 사용해주세요!
또한 이렇게 dto타입으로 정했다면 class-validator 와같은 라이브러리로 validation처리도 추가할수 있습니다.
export �class CreateProductDto {
name: string;
description: string;
price: number;
like: number;
imageUrl: string;
userId: string
tags: string[];
}| @Query('search') search?: string, | ||
| @Query('pageSize') pageSize: string = '6', | ||
| ) { | ||
| return this.articleService.getAllArticles(sort, search, Number(pageSize)); |
Collaborator
There was a problem hiding this comment.
pageSize를 string으로 받고, number로 캐스팅 하는 이유가 있을까요?
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
요구사항
기본
백엔드
멘토에게