Update Client Location
Route: PATCH /api/clients/:id/location
Functionality:
Updates the client’s location and propagates changes to gas readings.
Service Layer (
services/clientService.js):
// javascript
export async function updateClientLocation(clientId, latitude, longitude) {
await db.client.update({
where: { id: clientId },
data: { latitude, longitude },
});
return await db.gasReading.updateMany({
where: { client_id: clientId },
data: { location: { lat: latitude, lng: longitude } },
});
}
Last updated