-
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
[BE/#90] Post /posts API 구현 #98
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6b5f164
[BE] Deps : 모듈 설치
koomin1227 6024226
[BE] Feat : createPost dto 작성
koomin1227 a653e44
[BE] Feat : json을 파싱해오는 데코레이터 작성
koomin1227 72a11f3
[BE] Feat : 게시글 등록 controller 구현
koomin1227 0425326
[BE] Feat : post.entity.ts 의 status, is_request 자료형 수정
koomin1227 dd117f8
[BE] Feat : 전역 파이프 적용
koomin1227 5ac2286
[BE] Feat : 게시글 등록 service 로직 구현
koomin1227 f8e7d01
[BE] Feat : post 의존성 추가
koomin1227 c45f32f
[BE] Feat : validation provider 추가
koomin1227 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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,22 @@ | ||
import { IsBoolean, IsNumber, IsString, ValidateIf } from 'class-validator'; | ||
|
||
export class CreatePostDto { | ||
@IsString() | ||
title: string; | ||
|
||
@IsString() | ||
contents: string; | ||
|
||
@IsNumber() | ||
@ValidateIf((object) => object.is_request === false) | ||
price: number; | ||
|
||
@IsBoolean() | ||
is_request: boolean; | ||
|
||
@IsString() | ||
start_date: string; | ||
|
||
@IsString() | ||
end_date: 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
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
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
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,10 @@ | ||
import { createParamDecorator, ExecutionContext } from '@nestjs/common'; | ||
|
||
export const MultiPartBody = createParamDecorator( | ||
(data: string, ctx: ExecutionContext) => { | ||
const request: Request = ctx.switchToHttp().getRequest(); | ||
const body = request.body; | ||
|
||
return data ? JSON.parse(body?.[data]) : body; | ||
}, | ||
); | ||
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.
커스텀 데코레이터를 사용해서 request.body 를 파싱한 과정이 좋네요~