location updates saved to db and base endpoints for other modules started
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user