22 lines
471 B
TypeScript
22 lines
471 B
TypeScript
import { Router } from "express";
|
|
import { pubClient } from "modules/redis";
|
|
|
|
const router = Router();
|
|
|
|
router.get("/", async (req, res) => {
|
|
const keys = await pubClient.keys("Dispatcher:*");
|
|
const user = await Promise.all(
|
|
keys.map(async (key) => {
|
|
const data = await pubClient.json.get(key);
|
|
return {
|
|
...(typeof data === "object" && data !== null ? data : {}),
|
|
userId: key.split(":")[1],
|
|
};
|
|
}),
|
|
);
|
|
|
|
res.json(user);
|
|
});
|
|
|
|
export default router;
|