From 81dd5250250e5aadbc11417c9a938262a25fb8b1 Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 9 Jun 2024 23:02:12 +0200 Subject: [PATCH] fix deprecated endpoints --- producer/src/deprecated.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/producer/src/deprecated.ts b/producer/src/deprecated.ts index 60821b3..42c8e5b 100644 --- a/producer/src/deprecated.ts +++ b/producer/src/deprecated.ts @@ -30,15 +30,23 @@ router.post('/metrics/push', json(jsonOptions), async (req, res) => { try { const ip = getIPFromRequest(req); const sessionHash = createSessionHash(req.body.website, ip, req.body.userAgent); - + const { type } = req.body; if (type === 0) { - await RedisStreamService.addToStream(streamName, { ...req.body, _type: 'visit', sessionHash, ip }); + await RedisStreamService.addToStream(streamName, { + ...req.body, _type: 'visit', sessionHash, ip, + screenWidth: '0', + screenHeight: '0', + type: req.body.type.toString() + }); } else { - await RedisStreamService.addToStream(streamName, { ...req.body, _type: 'event', sessionHash, ip }); + await RedisStreamService.addToStream(streamName, { + ...req.body, _type: 'event', sessionHash, ip, + type: req.body.type.toString() + }); } - + return res.sendStatus(200); } catch (ex: any) { return res.status(500).json({ error: ex.message });