Přidání základních statistik
Some checks failed
ci/woodpecker/push/workflow Pipeline failed

This commit is contained in:
2025-02-27 00:22:34 +01:00
parent 0af78e72d9
commit ca400638d1
15 changed files with 637 additions and 26 deletions

View File

@@ -0,0 +1,22 @@
import express, { Request, Response } from "express";
import { getLogin } from "../auth";
import { parseToken } from "../utils";
import { WeeklyStats } from "../../../types";
import { getStats } from "../stats";
const router = express.Router();
router.get("/", async (req: Request<{}, any, undefined>, res: Response<WeeklyStats>) => {
getLogin(parseToken(req));
if (typeof req.query.startDate === 'string' && typeof req.query.endDate === 'string') {
try {
const data = await getStats(req.query.startDate, req.query.endDate);
return res.status(200).json(data);
} catch (e) {
// necháme to zatím spadnout na 400
}
}
res.sendStatus(400);
});
export default router;