-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added lat,lng,radius to places/categories request
- Loading branch information
1 parent
379f227
commit 6ab2688
Showing
10 changed files
with
148 additions
and
27 deletions.
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,17 @@ | ||
[{ | ||
"city": "New York", | ||
"lat": 40.7128, | ||
"lng": -74.0060 | ||
},{ | ||
"city":"London", | ||
"lat": 51.5074, | ||
"lng": -0.1278 | ||
},{ | ||
"city":"Paris", | ||
"lat": 48.8566, | ||
"lng": 2.3522 | ||
},{ | ||
"city":"Bondi Beach", | ||
"lat": -33.8910, | ||
"lng": 151.2769 | ||
}] |
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,6 @@ | ||
import { UseInterceptors, applyDecorators } from '@nestjs/common'; | ||
import { CountHeaderInterceptor } from '../interceptors/count-header.interceptor'; | ||
|
||
export function CountHeader() { | ||
return applyDecorators(UseInterceptors(CountHeaderInterceptor)); | ||
} |
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,21 @@ | ||
import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common'; | ||
import { Observable } from 'rxjs'; | ||
import { map } from 'rxjs/operators'; | ||
import { Response } from 'express'; | ||
|
||
@Injectable() | ||
export class CountHeaderInterceptor implements NestInterceptor { | ||
intercept(context: ExecutionContext, next: CallHandler): Observable<any> { | ||
const response = context.switchToHttp().getResponse<Response>(); | ||
|
||
return next.handle().pipe( | ||
map((data) => { | ||
if (Array.isArray(data)) { | ||
console.log('applyHeader', data.length); | ||
response.set('X-Total-Count', data.length.toString()); | ||
} | ||
return data; | ||
}), | ||
); | ||
} | ||
} |
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