-
Notifications
You must be signed in to change notification settings - Fork 3
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
페이징 적용, 장소 카테고리 추가 #74
Changes from all commits
20dd7f9
69c9258
543f032
72e23ac
3792fa5
3f71979
29b6fc6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,3 +58,5 @@ pids | |
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
**.csv |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ import { | |
IsNumber, | ||
IsString, | ||
ValidateNested, | ||
Min, | ||
Max, | ||
IsUrl, | ||
} from 'class-validator'; | ||
import { Place } from '../entity/place.entity'; | ||
|
||
|
@@ -15,10 +18,12 @@ export class CreatePlaceRequest { | |
@IsNotEmpty() | ||
name: string; | ||
|
||
@IsString() | ||
@IsUrl() | ||
thumbnailUrl?: string; | ||
|
||
@IsNumber() | ||
@Min(0) | ||
@Max(5) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. p2.5: 별점같은 경우는 DB에서 5점만점이라도 소수점을 지원할 경우, 0부터 10의 정수로 저장하는 경우를 봤었는데요! gpt는 정수형 저장이 평균계산 등에서 성능적으로 좋다고는 하는데, 확인해보셔도 좋을 것 같네요 😀 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 해당 필드는 구글에서 가져온 말씀하신 부분이 성능상의 유의미한 차이를 만들게 된다면, 정확도가 중요하지 않다고 판단되었을 때, 4.33 이면 9로 저장한다던지?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아하 ! 제가 착각했네요 하하 |
||
rating?: number; | ||
|
||
@ValidateNested() | ||
|
@@ -32,9 +37,12 @@ export class CreatePlaceRequest { | |
formattedAddress?: string; | ||
|
||
@IsString() | ||
description?: string; | ||
category?: string; | ||
|
||
@IsString() | ||
description?: string; | ||
|
||
@IsUrl() | ||
detailPageUrl?: string; | ||
|
||
toEntity() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Place } from '../entity/place.entity'; | ||
|
||
export class PlaceSearchResponse { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. q: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 변경 전에 장소나 코스의 리스트로 담아 보내는 검색 API 에서는이 DTO 대신 엔티티 자체가 응답되고 있었어요! 장소 특성상 문제가 생기지 않았지만, 서로 다른 API 에서 같은 DTO 를 사용하다 보면, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
헉 그러네요 제 실수..
좋습니다! |
||
constructor( | ||
readonly id: number, | ||
readonly name: string, | ||
readonly location: { | ||
readonly lat: number; | ||
readonly lng: number; | ||
}, | ||
readonly google_place_id: string, | ||
readonly category?: string, | ||
readonly description?: string, | ||
readonly detail_page_url?: string, | ||
readonly thumbnail_url?: string, | ||
readonly rating?: number, | ||
readonly formed_address?: string, | ||
) {} | ||
|
||
static from(place: Place): PlaceSearchResponse { | ||
return new PlaceSearchResponse( | ||
place.id, | ||
place.name, | ||
{ | ||
lat: place.latitude, | ||
lng: place.longitude, | ||
}, | ||
place.googlePlaceId, | ||
place.detailPageUrl, | ||
place.thumbnailUrl, | ||
place.category, | ||
place.description, | ||
place.rating, | ||
place.formattedAddress, | ||
); | ||
} | ||
} |
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.
q: 아래와 같은 방법으로는 안 걸러질까요?
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.
??
키워드가undefined
,null
을 처리해주는데,number
타입인 페이지와 리미트 인자가 들어오지 않았을 때NaN
으로 매핑되더라구요..저도 이 부분 마음에 들지 않아 Todo 로 남겨두었습니다 ㅎㅎ;;
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.
p2:
page
를 적어두지 않았으면 보통 1페이지일테니page: number = 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.
재밌는걸 찾았는데, 따끈따끈한 이슈인가봐요!
ValidationPipe
의 transform 옵션이 문제를 일으키고 있다고 해요.nestjs/nest#12864 ( 기본값 두었을 때 문제 )
nestjs/nest#10246
이건 개발 일지에 남겨도 좋겠네요