From 86285e341f05df431ff1ab9092977ad04876a3fd Mon Sep 17 00:00:00 2001 From: Shibi Chakkaravarthy Date: Sat, 18 Apr 2026 14:38:16 +0530 Subject: [PATCH] adding Error Logger and enhancements to locationUpdate Controller --- controllers/location.controller.js | 3 ++- models/Location/model.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/controllers/location.controller.js b/controllers/location.controller.js index d9b4220..33da9f5 100644 --- a/controllers/location.controller.js +++ b/controllers/location.controller.js @@ -11,12 +11,13 @@ export const createLocationController = async (req, res) => { const dbPayload = { battery: location.battery.level, coordinatess: location.coords, - recorded_at: location.recorded_at, + createdOn: location.recorded_at, }; const uploaded = await createLocation({ ...dbPayload, user: user?.id }); console.log("BG LOCATION DB DOC", uploaded, user); res.status(200).json({ result: uploaded }); } catch (error) { + console.log("createLocationController Error", error); res.status(500).json({ error: error.message }); } }; diff --git a/models/Location/model.js b/models/Location/model.js index 75eb94f..d960c4e 100644 --- a/models/Location/model.js +++ b/models/Location/model.js @@ -12,6 +12,10 @@ const schema = new Schema({ type: Date, required: true, }, + battery: { + type: Number, + required: true, + }, venue: { type: Types.ObjectId, required: false,