zip code fix (#112)

This commit is contained in:
Will Freeman
2026-04-21 11:49:46 -06:00
committed by GitHub
parent c298a3f5d4
commit 7c27235400
2 changed files with 7 additions and 3 deletions
+4
View File
@@ -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;
});
+3 -3
View File
@@ -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(),
});