Generate random readBy values for each message

This commit is contained in:
Mikołaj Pich 2021-08-29 14:19:38 +02:00
parent d89080db68
commit 98c2d70cae

View file

@ -39,12 +39,12 @@ router.get("/-endpoints", (req, res) => {
}); });
router.get("/Wiadomosc.mvc/GetInboxMessages", (req, res) => { router.get("/Wiadomosc.mvc/GetInboxMessages", (req, res) => {
const recipientsNumber = getRandomInt(60, 100);
const readBy = getRandomInt(20, 60);
const unreadBy = recipientsNumber - readBy;
res.json({ res.json({
"success": true, "success": true,
"data": require("../../data/api/messages/WiadomosciOdebrane").map(item => { "data": require("../../data/api/messages/WiadomosciOdebrane").map(item => {
const recipientsNumber = getRandomInt(60, 100);
const readBy = getRandomInt(20, 60);
const unreadBy = recipientsNumber - readBy;
return { return {
"Id": item.WiadomoscId * 2, "Id": item.WiadomoscId * 2,
"Nieprzeczytana": !item.GodzinaPrzeczytania, "Nieprzeczytana": !item.GodzinaPrzeczytania,