-
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 ./places/builings endpoint for testing
- Loading branch information
1 parent
71c451e
commit 2844c5f
Showing
24 changed files
with
2,816 additions
and
266 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; | ||
import { Transform } from 'class-transformer'; | ||
import { IsNumber, IsOptional, IsString, MaxLength, Min, MinLength, ValidateIf } from 'class-validator'; | ||
import { GetByLocationDto } from '../../../common/dto/requests/get-by-location.dto'; | ||
|
||
export class GetBuildingsQuery extends GetByLocationDto { | ||
|
||
|
||
} |
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,60 @@ | ||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; | ||
import { GeometryDto } from '../../../common/dto/responses/geometry.dto'; | ||
import { Building } from '../../interfaces/building.interface'; | ||
import { GetByLocationDto } from 'src/common/dto/requests/get-by-location.dto'; | ||
import { Geometry } from 'geojson'; | ||
|
||
export class BuildingPropertiesDto { | ||
|
||
} | ||
|
||
export class BuildingDto { | ||
@ApiProperty({ description: 'Unique identifier of the place.', example: '12345' }) | ||
id: string; | ||
|
||
@ApiProperty({ description: 'Type of place or feature.', example: 'Point of Interest' }) | ||
type: string; | ||
|
||
@ApiProperty({ | ||
description: 'Geometric representation of the place.', | ||
type: () => GeometryDto, | ||
}) | ||
geometry: Geometry; | ||
|
||
@ApiProperty({ | ||
description: 'Properties and additional details.', | ||
type: () => BuildingPropertiesDto, | ||
}) | ||
properties: BuildingPropertiesDto; | ||
|
||
constructor(data: Building) { | ||
this.id = data.id; | ||
this.geometry = data.geometry; | ||
if(!this.properties) this.properties = new BuildingPropertiesDto(); | ||
//Object.assign(this, data); | ||
} | ||
} | ||
|
||
export const toBuildingDto = (data , requestQuery:GetByLocationDto) => { | ||
|
||
const excludeFieldsFromProperties = ['properties','geometry','ext_distance','bbox']; | ||
const properties = {...data}; | ||
excludeFieldsFromProperties.forEach(field => delete properties[field]); | ||
|
||
const rPlace = new BuildingDto(data) | ||
rPlace.properties = properties; | ||
rPlace.geometry = data.geometry; | ||
|
||
//remove any fields that are not requested | ||
if(requestQuery.includes && requestQuery.includes.length > 0) { | ||
const filteredProperties = {}; | ||
requestQuery.includes.forEach((field) => { | ||
|
||
if(rPlace.properties[field]) { | ||
filteredProperties[field] = rPlace.properties[field]; | ||
} | ||
}); | ||
rPlace.properties = filteredProperties; | ||
} | ||
return rPlace | ||
} |
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 |
---|---|---|
@@ -1,5 +1,35 @@ | ||
import { Source } from "../../places/interfaces/place.interface"; | ||
import { Bbox } from "../../common/interfaces/geometry.interface"; | ||
import { Geometry, Polygon } from "geojson"; | ||
|
||
|
||
export interface Building { | ||
|
||
id: string; | ||
geometry: Polygon; | ||
bbox?: Bbox; | ||
version: string; | ||
sources: Source[]; | ||
subtype: string; | ||
class: string; | ||
names: string; | ||
level: string; | ||
has_parts: boolean; | ||
height: number; | ||
is_underground: boolean; | ||
num_floors: number; | ||
num_floors_underground: number; | ||
min_height: number; | ||
min_floor: number; | ||
facade_color: string; | ||
facade_material: string; | ||
roof_material: string; | ||
roof_shape: string; | ||
roof_direction: string; | ||
roof_orientation: string; | ||
roof_color: string; | ||
roof_height: number; | ||
ext_distance: number; | ||
theme: string; | ||
type: string; | ||
} |
Oops, something went wrong.