Add address to blakus endpoint
Some checks failed
CI / main (push) Failing after 4m8s

This commit is contained in:
Broks Randolfs Gailītis 2025-03-15 17:25:13 +02:00
parent 6e76293a94
commit d721f2876e

View File

@ -19,6 +19,18 @@ export default async function (fastify: FastifyInstance) {
id: { type: 'string' }, id: { type: 'string' },
title: { type: 'string' }, title: { type: 'string' },
amenity: { type: 'string' }, amenity: { type: 'string' },
address: {
type: 'object',
properties: {
country: { type: 'string' },
county: { type: 'string' },
district: { type: 'string' },
city: { type: 'string' },
street: { type: 'string' },
house: { type: 'string' },
postalCode: { type: 'string' },
}
},
coords: { coords: {
type: 'object', type: 'object',
properties: { properties: {
@ -43,6 +55,13 @@ export default async function (fastify: FastifyInstance) {
'id', 'id',
'name', 'name',
'externalId', 'externalId',
'country',
'county',
'district',
'city',
'street',
'house',
'postalCode',
db.raw('ST_Y(coordinates::geometry) AS lat'), db.raw('ST_Y(coordinates::geometry) AS lat'),
db.raw('ST_X(coordinates::geometry) AS lon') db.raw('ST_X(coordinates::geometry) AS lon')
).whereRaw( ).whereRaw(
@ -79,6 +98,15 @@ export default async function (fastify: FastifyInstance) {
id: place.id, id: place.id,
title: place.name, title: place.name,
amenity: 'pub', amenity: 'pub',
address: {
country: place.country,
county: place.county,
district: place.district,
city: place.city,
street: place.street,
house: place.house,
postalCode: place.postalCode,
},
coords: { coords: {
lat: place.lat, lat: place.lat,
lon: place.lon, lon: place.lon,