Skip to content

Commit

Permalink
fix autogen open-api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AdenForshaw committed Nov 12, 2024
1 parent 27491c1 commit d75ed9f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "overture-maps-api",
"version": "0.1.6",
"version": "0.1.7",
"description": "",
"author": "",
"private": true,
Expand Down
3 changes: 3 additions & 0 deletions src/buildings/buildings.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};

Expand Down
22 changes: 11 additions & 11 deletions src/places/places.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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) {


Expand All @@ -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) {
Expand All @@ -81,34 +81,34 @@ 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);

}

@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();

}

@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<CategoryResponseDto[]> {

return await this.placesService.getCategories(query);
Expand Down

0 comments on commit d75ed9f

Please sign in to comment.