fix(listings): extract PostGIS coordinates in read queries instead of returning 0,0

findByIdWithProperty and searchListings used Prisma include which cannot
extract PostGIS geometry(Point,4326) columns. Added raw SQL with ST_Y/ST_X
to return actual lat/lng. Search uses batch extraction via ANY() for efficiency.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-16 02:32:30 +07:00
parent cc584239b0
commit ce781df76d
3 changed files with 76 additions and 29 deletions

View File

@@ -23,6 +23,8 @@ export interface ListingDetailData {
ward: string;
district: string;
city: string;
latitude: number;
longitude: number;
areaM2: number;
bedrooms: number | null;
bathrooms: number | null;
@@ -70,6 +72,8 @@ export interface ListingSearchItem {
address: string;
district: string;
city: string;
latitude: number;
longitude: number;
areaM2: number;
bedrooms: number | null;
bathrooms: number | null;