adding Error Logger and enhancements to locationUpdate Controller

This commit is contained in:
Shibi Chakkaravarthy
2026-04-18 14:38:16 +05:30
parent 8c368165c1
commit 86285e341f
2 changed files with 6 additions and 1 deletions
+2 -1
View File
@@ -11,12 +11,13 @@ export const createLocationController = async (req, res) => {
const dbPayload = { const dbPayload = {
battery: location.battery.level, battery: location.battery.level,
coordinatess: location.coords, coordinatess: location.coords,
recorded_at: location.recorded_at, createdOn: location.recorded_at,
}; };
const uploaded = await createLocation({ ...dbPayload, user: user?.id }); const uploaded = await createLocation({ ...dbPayload, user: user?.id });
console.log("BG LOCATION DB DOC", uploaded, user); console.log("BG LOCATION DB DOC", uploaded, user);
res.status(200).json({ result: uploaded }); res.status(200).json({ result: uploaded });
} catch (error) { } catch (error) {
console.log("createLocationController Error", error);
res.status(500).json({ error: error.message }); res.status(500).json({ error: error.message });
} }
}; };
+4
View File
@@ -12,6 +12,10 @@ const schema = new Schema({
type: Date, type: Date,
required: true, required: true,
}, },
battery: {
type: Number,
required: true,
},
venue: { venue: {
type: Types.ObjectId, type: Types.ObjectId,
required: false, required: false,