mirror of
https://github.com/FoggedLens/deflock.git
synced 2026-06-03 12:58:06 +02:00
zip code fix (#112)
This commit is contained in:
@@ -81,6 +81,7 @@ const start = async () => {
|
||||
},
|
||||
response: {
|
||||
200: NominatimResultSchema,
|
||||
404: { type: 'object', properties: { error: { type: 'string' } } },
|
||||
500: { type: 'object', properties: { error: { type: 'string' } } },
|
||||
},
|
||||
},
|
||||
@@ -88,6 +89,9 @@ const start = async () => {
|
||||
const { query } = request.query as { query: string };
|
||||
reply.header('Cache-Control', 'public, max-age=86400, s-maxage=86400');
|
||||
const result = await nominatim.geocodeSingleResult(query);
|
||||
if (!result) {
|
||||
return reply.status(404).send({ error: 'No results found' });
|
||||
}
|
||||
return result;
|
||||
});
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ export const NominatimResultSchema = Type.Object({
|
||||
licence: Type.String(),
|
||||
lon: Type.String(),
|
||||
name: Type.String(),
|
||||
osm_id: Type.Number(),
|
||||
osm_type: Type.String(),
|
||||
place_id: Type.Number(),
|
||||
osm_id: Type.Optional(Type.Number()),
|
||||
osm_type: Type.Optional(Type.String()),
|
||||
place_id: Type.Optional(Type.Number()),
|
||||
place_rank: Type.Number(),
|
||||
type: Type.String(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user