2022-04-06 21:14:46 +03:00
|
|
|
const { UserModel, ThreadModel, MessageModel } = require("../models")
|
2022-03-21 23:53:22 +03:00
|
|
|
const { Router } = require("express");
|
|
|
|
const app = Router();
|
|
|
|
|
2022-04-06 21:14:46 +03:00
|
|
|
app.get("/", async (req, res) => {
|
2022-08-26 16:27:29 +03:00
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
const
|
|
|
|
mem = process.memoryUsage().heapUsed / Math.pow(2, 20),
|
2022-09-04 22:19:19 +03:00
|
|
|
users = await UserModel.count({ deleted: false }),
|
2022-09-23 23:20:00 +03:00
|
|
|
threads = await ThreadModel.count({ state: "OPEN" }),
|
2022-09-04 22:19:19 +03:00
|
|
|
messages = await MessageModel.count({ deleted: false });
|
2022-03-21 23:53:22 +03:00
|
|
|
|
2023-05-25 16:15:50 +03:00
|
|
|
res.reply("index", { mem, users, threads, messages });
|
2022-03-21 23:53:22 +03:00
|
|
|
|
2023-05-25 16:15:50 +03:00
|
|
|
});
|
2022-09-23 23:10:13 +03:00
|
|
|
|
2022-03-21 23:53:22 +03:00
|
|
|
module.exports = app;
|