From fa8d358e4f389105764a7e61005179f7565804b7 Mon Sep 17 00:00:00 2001 From: Johannes Brandenburger <79154528+johannesbrandenburger@users.noreply.github.com> Date: Sat, 20 Jan 2024 21:27:57 +0100 Subject: [PATCH] analytics tenants --- services/analytics-service/index.js | 9 +++++---- services/analytics-service/version.txt | 2 +- services/pin-service/index.js | 2 +- services/pin-service/version.txt | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/services/analytics-service/index.js b/services/analytics-service/index.js index 16c7621..6b12784 100644 --- a/services/analytics-service/index.js +++ b/services/analytics-service/index.js @@ -24,13 +24,14 @@ const app = express(); const port = 3004; app.use(express.json()); app.use(cookieParser()); -app.use(auth); +// app.use(auth); // define routes -app.get("/", async (req, res) => { +app.get("/:tenant", async (req, res) => { + const tenant = req.params.tenant; // get the analytics state - const analyticsState = await analyticsStateCollection.find({}).sort({ timestamp: -1 }).limit(1).next(); + const analyticsState = await analyticsStateCollection.find({ tenant: tenant }).sort({ timestamp: -1 }).limit(1).next(); if (!analyticsState) { res.status(400).send("No analytics state found"); return; @@ -42,5 +43,5 @@ app.get("/", async (req, res) => { // start the server app.listen(port, () => { - console.log(`Heatmap service listening at http://localhost:${port}`); + console.log(`Analytics service listening at http://localhost:${port}`); }); \ No newline at end of file diff --git a/services/analytics-service/version.txt b/services/analytics-service/version.txt index 6a2b0ac..b482243 100644 --- a/services/analytics-service/version.txt +++ b/services/analytics-service/version.txt @@ -1 +1 @@ -v1.0.1 \ No newline at end of file +v1.0.2 \ No newline at end of file diff --git a/services/pin-service/index.js b/services/pin-service/index.js index 2207f58..885964f 100644 --- a/services/pin-service/index.js +++ b/services/pin-service/index.js @@ -34,7 +34,7 @@ app.post("/", async (req, res) => { description: req.body.description, latitude: req.body.latitude, longitude: req.body.longitude, - date: req.body.date, + date: req.body.date || new Date().toISOString(), companions: req.body.companions, duration: req.body.duration, rating: req.body.rating, diff --git a/services/pin-service/version.txt b/services/pin-service/version.txt index 6df8b11..ef6a92d 100644 --- a/services/pin-service/version.txt +++ b/services/pin-service/version.txt @@ -1 +1 @@ -v1.0.6 \ No newline at end of file +v1.0.7 \ No newline at end of file