location updates saved to db and base endpoints for other modules started
This commit is contained in:
@@ -7,8 +7,14 @@ import {
|
||||
export const createLocationController = async (req, res) => {
|
||||
try {
|
||||
const { user } = res.locals;
|
||||
const { location } = req.body;
|
||||
console.log("BG LOCATIONREQUEST BODY", req.body, user);
|
||||
// const location = await createLocation({ ...req.body, user: user?.id });
|
||||
const dbPayload = {
|
||||
battery: location.battery.level,
|
||||
coordinatess: location.coords,
|
||||
recorded_at: location.recorded_at,
|
||||
};
|
||||
const uploaded = await createLocation({ ...req.body, user: user?.id });
|
||||
res.status(200).json({ location: "location" });
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
|
||||
Reference in New Issue
Block a user