bg location update db payload issue fixed

This commit is contained in:
Shibi Chakkaravarthy
2026-04-18 14:36:00 +05:30
parent eb84767d44
commit 8c368165c1
+3 -3
View File
@@ -8,14 +8,14 @@ export const createLocationController = async (req, res) => {
try { try {
const { user } = res.locals; const { user } = res.locals;
const { location } = req.body; const { location } = req.body;
console.log("BG LOCATIONREQUEST BODY", req.body, user);
const dbPayload = { const dbPayload = {
battery: location.battery.level, battery: location.battery.level,
coordinatess: location.coords, coordinatess: location.coords,
recorded_at: location.recorded_at, recorded_at: location.recorded_at,
}; };
const uploaded = await createLocation({ ...req.body, user: user?.id }); const uploaded = await createLocation({ ...dbPayload, user: user?.id });
res.status(200).json({ location: "location" }); console.log("BG LOCATION DB DOC", uploaded, user);
res.status(200).json({ result: uploaded });
} catch (error) { } catch (error) {
res.status(500).json({ error: error.message }); res.status(500).json({ error: error.message });
} }