Skip to content
Snippets Groups Projects
Commit ff91305e authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

chore(photon): add type safety

parent 3b046c8f
No related branches found
No related tags found
1 merge request!294V2.3.0
export interface PhotonPoints {
geometry: {
coordinates: number[];
type: string;
};
type: string;
properties: {
osm_id: number;
osm_type: string;
extent?: number[];
country: string;
osm_key: string;
osm_value: string;
name?: string;
state: string;
city?: string;
postcode?: string;
};
}
......@@ -37,6 +37,7 @@ import { depRegex } from './common/regex';
import { CreateStructureDto } from './dto/create-structure.dto';
import { QueryStructure } from './dto/query-structure.dto';
import { UpdateStructureDto } from './dto/update-structure.dto';
import { PhotonPoints } from './interfaces/photon-response.interface';
import { Structure, StructureDocument } from './schemas/structure.schema';
import { StructuresService } from './services/structures.service';
......@@ -67,7 +68,7 @@ export class StructuresController {
.then(async (res) => res.data.features)
.then((data) =>
data.filter(
(cityPoint) =>
(cityPoint: PhotonPoints) =>
/* check if query sting = postcode
OR query string = city (without hyphens and diacritics)
OR query string = name (in 2 cases, Charly et Rochetaillée-sur-saône, the city name is in the name field and the city field is missing) */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment