location updates saved to db and base endpoints for other modules started

This commit is contained in:
Shibi Chakkaravarthy
2026-04-18 04:15:23 +05:30
parent 92769cfd38
commit eb84767d44
12 changed files with 167 additions and 44 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ export const createLocation = async (data) => {
return await Model.create({
...data,
coordinates: geoJson,
createdOn: dayjs().toISOString(),
createdOn: data?.recorded_at,
});
};
@@ -18,7 +18,7 @@ export const getLocationById = async (id) => {
// Read (Get by Query)
export const getLocationByQuery = async (query) => {
return await Model.findOne(query);
return await Model.findOne(query).sort({ createdOn: -1 });
};
// Read (Get by Radius)