improve geocoding

This commit is contained in:
orangecoding
2026-01-28 15:55:23 +01:00
parent 472169693f
commit 0b2b42fc75
10 changed files with 55 additions and 50 deletions

View File

@@ -592,3 +592,23 @@ export const getListingById = (id, userId = null, isAdmin = false) => {
)[0] || null
);
};
/**
* Resets geocoordinates and distance for all listings related to a user.
*
* @param {string} userId
* @returns {void}
*/
export const resetGeocoordinatesAndDistanceForUser = (userId) => {
SqliteConnection.execute(
`UPDATE listings
SET latitude = NULL,
longitude = NULL,
distance_to_destination = NULL
WHERE job_id IN (
SELECT id FROM jobs j
WHERE j.user_id = @userId
)`,
{ userId },
);
};