diff --git a/package.json b/package.json index b33dfba..9a9bfa6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "overture-maps-api", - "version": "0.1.6", + "version": "0.1.7", "description": "", "author": "", "private": true, diff --git a/src/buildings/buildings.controller.ts b/src/buildings/buildings.controller.ts index ab53a5d..144305d 100644 --- a/src/buildings/buildings.controller.ts +++ b/src/buildings/buildings.controller.ts @@ -8,8 +8,11 @@ import { GetBuildingsQuery } from './dto/requests/get-buildings-query.dto'; import { BuildingDto, toBuildingDto } from './dto/responses/building-response.dto'; import { wrapAsGeoJSON } from '../utils/geojson'; import { Format } from '../common/dto/requests/get-by-location.dto'; +import { ApiSecurity, ApiTags } from '@nestjs/swagger'; +@ApiTags('Buildings') +@ApiSecurity('API_KEY') // Applies the API key security scheme defined in Swagger @Controller('buildings') export class BuildingsController { diff --git a/src/main.ts b/src/main.ts index 9d3e0fc..6fd62d9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -50,7 +50,7 @@ async function bootstrap() { const customOptions: SwaggerCustomOptions = { customfavIcon: 'https://overturemaps.org/wp-content/uploads/sites/16/2022/12/cropped-Favicon-150x150.png', customCss: '.swagger-ui .topbar { display: none }', // Hide the top bar of Swagger UI - jsonDocumentUrl: '/api-docs-json', swaggerUrl: '/api-docs-ui', + jsonDocumentUrl: '/api-docs.json', swaggerUrl: '/api-docs-ui', customSiteTitle: 'Overture Maps API Documentation', }; diff --git a/src/places/places.controller.ts b/src/places/places.controller.ts index 621bce5..6252193 100644 --- a/src/places/places.controller.ts +++ b/src/places/places.controller.ts @@ -21,7 +21,7 @@ import { Feature, GeoJsonObject, Geometry } from 'geojson'; import { GetPlacesWithBuildingsDto } from './dto/requests/get-places-with-buildings'; import { CountHeader } from '../decorators/count-header.decorator'; -@ApiTags('places') +@ApiTags('Places') @ApiSecurity('API_KEY') // Applies the API key security scheme defined in Swagger @Controller('places') @UseGuards(IsAuthenticatedGuard) @@ -36,11 +36,11 @@ export class PlacesController { ) {} @Get() - @CountHeader() - @ValidateLatLngUser() @ApiOperation({ summary: 'Get Places using Query params as filters' }) @ApiQuery({type:GetPlacesDto}) @ApiResponse({ status: 200, description: 'Return Places.' , type: PlaceResponseDto, isArray: true}) + @CountHeader() + @ValidateLatLngUser() async getPlaces(@Query() query: GetPlacesDto, @AuthedUser() user: User) { @@ -55,11 +55,11 @@ export class PlacesController { } @Get('buildings') - @CountHeader() - @ValidateLatLngUser() @ApiOperation({ summary: 'Get Places with their Building shapes using Query params as filters' }) @ApiQuery({type:GetPlacesWithBuildingsDto}) @ApiResponse({ status: 200, description: 'Return Places with Buildings.' , type: PlaceResponseDto, isArray: true}) + @CountHeader() + @ValidateLatLngUser() async getPlacesWithBuildings(@Query() query: GetPlacesWithBuildingsDto, @AuthedUser() user: User) { if(query.match_nearest_building!==true) { @@ -81,11 +81,11 @@ export class PlacesController { @Get('brands') - @CountHeader() - @ValidateLatLngUser() @ApiOperation({ summary: 'Get all Brands from Places using Query params as filters' }) @ApiResponse({ status: 200, description: 'Return all Brands, along with a count of all Places for each.' , type: BrandDto, isArray: true}) @ApiQuery({type:GetBrandsDto}) + @CountHeader() + @ValidateLatLngUser() async getBrands(@Query() query: GetBrandsDto, @AuthedUser() user: User) { return await this.placesService.getBrands(query); @@ -93,10 +93,10 @@ export class PlacesController { } @Get('countries') - @CountHeader() - @ValidateLatLngUser() @ApiOperation({ summary: 'Get all Countries from Places using Query params as filters' }) @ApiResponse({ status: 200, description: 'Return all Countries, as well as a count of all the Places and Brands in each.', type:CountryResponseDto, isArray: true}) + @CountHeader() + @ValidateLatLngUser() async getCountries() { return await this.placesService.getCountries(); @@ -104,11 +104,11 @@ export class PlacesController { } @Get('categories') - @CountHeader() - @ValidateLatLngUser() @ApiOperation({ summary: 'Get all Categories from Places using Query params as filters' }) @ApiResponse({ status: 200, description: 'Return all Categories, along with a count of all Brands and Places for each' , type: CategoryResponseDto, isArray: true}) @ApiQuery({type:GetCategoriesDto}) + @CountHeader() + @ValidateLatLngUser() async getCategories(@Query() query: GetCategoriesDto, @AuthedUser() user: User):Promise { return await this.placesService.getCategories(query);