feat: nový způsob zobrazování novinek
Some checks failed
ci/woodpecker/push/workflow Pipeline failed
Some checks failed
ci/woodpecker/push/workflow Pipeline failed
This commit is contained in:
4
server/changelogs/2025-01-07.json
Normal file
4
server/changelogs/2025-01-07.json
Normal file
@@ -0,0 +1,4 @@
|
||||
[
|
||||
"Zimní atmosféra",
|
||||
"Skrytí podniku U Motlíků"
|
||||
]
|
||||
3
server/changelogs/2025-01-15.json
Normal file
3
server/changelogs/2025-01-15.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Přidání restaurace Zastávka u Michala"
|
||||
]
|
||||
3
server/changelogs/2025-01-29.json
Normal file
3
server/changelogs/2025-01-29.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Přidání restaurace Pivovarský šenk Šeříková"
|
||||
]
|
||||
3
server/changelogs/2025-02-19.json
Normal file
3
server/changelogs/2025-02-19.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Možnost výběru podniku/jídla kliknutím"
|
||||
]
|
||||
3
server/changelogs/2025-02-27.json
Normal file
3
server/changelogs/2025-02-27.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Stránka se statistikami nejoblíbenějších voleb"
|
||||
]
|
||||
3
server/changelogs/2025-03-05.json
Normal file
3
server/changelogs/2025-03-05.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Zobrazení počtu osob u každé volby"
|
||||
]
|
||||
3
server/changelogs/2025-03-20.json
Normal file
3
server/changelogs/2025-03-20.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Migrace na generované OpenApi"
|
||||
]
|
||||
3
server/changelogs/2025-03-21.json
Normal file
3
server/changelogs/2025-03-21.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Odebrání zimní atmosféry"
|
||||
]
|
||||
3
server/changelogs/2025-08-01.json
Normal file
3
server/changelogs/2025-08-01.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Možnost ručního přenačtení menu"
|
||||
]
|
||||
3
server/changelogs/2025-10-06.json
Normal file
3
server/changelogs/2025-10-06.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Parsování a zobrazení alergenů"
|
||||
]
|
||||
4
server/changelogs/2025-10-11.json
Normal file
4
server/changelogs/2025-10-11.json
Normal file
@@ -0,0 +1,4 @@
|
||||
[
|
||||
"Oddělení přenačtení menu do vlastního dialogu",
|
||||
"Podzimní atmosféra"
|
||||
]
|
||||
3
server/changelogs/2025-11-03.json
Normal file
3
server/changelogs/2025-11-03.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Možnost převzetí poznámky ostatních uživatelů"
|
||||
]
|
||||
3
server/changelogs/2026-01-09.json
Normal file
3
server/changelogs/2026-01-09.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Zimní atmosféra"
|
||||
]
|
||||
3
server/changelogs/2026-01-13.json
Normal file
3
server/changelogs/2026-01-13.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Možnost označit se jako objednávající u volby \"Budu objednávat\""
|
||||
]
|
||||
3
server/changelogs/2026-01-30.json
Normal file
3
server/changelogs/2026-01-30.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Podpora dark mode"
|
||||
]
|
||||
7
server/changelogs/2026-02-04.json
Normal file
7
server/changelogs/2026-02-04.json
Normal file
@@ -0,0 +1,7 @@
|
||||
[
|
||||
"Redesign aplikace pomocí Claude Code",
|
||||
"Zobrazení uplynulého týdne i o víkendu",
|
||||
"Podpora Discord, ntfy a Teams notifikací (v Nastavení)",
|
||||
"Trvalé zobrazení QR kódů do ručního zavření",
|
||||
"Zobrazení nejvíce požadovaných funkcí (na stránce Statistiky)"
|
||||
]
|
||||
3
server/changelogs/2026-02-10.json
Normal file
3
server/changelogs/2026-02-10.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Zobrazení sekce Pizza day pouze při volbě \"Pizza day\""
|
||||
]
|
||||
3
server/changelogs/2026-02-20.json
Normal file
3
server/changelogs/2026-02-20.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Možnost generování obecných QR kódů pro platby i mimo Pizza day (v uživatelském menu)"
|
||||
]
|
||||
3
server/changelogs/2026-03-04.json
Normal file
3
server/changelogs/2026-03-04.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Podpora push notifikací pro připomenutí výběru oběda (v nastavení)"
|
||||
]
|
||||
3
server/changelogs/2026-03-05.json
Normal file
3
server/changelogs/2026-03-05.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Oprava detekce zastaralého menu"
|
||||
]
|
||||
3
server/changelogs/2026-03-08.json
Normal file
3
server/changelogs/2026-03-08.json
Normal file
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"Automatické zobrazení dialogu s dosud nezobrazenými novinkami"
|
||||
]
|
||||
@@ -18,6 +18,7 @@ import statsRoutes from "./routes/statsRoutes";
|
||||
import notificationRoutes from "./routes/notificationRoutes";
|
||||
import qrRoutes from "./routes/qrRoutes";
|
||||
import devRoutes from "./routes/devRoutes";
|
||||
import changelogRoutes from "./routes/changelogRoutes";
|
||||
|
||||
const ENVIRONMENT = process.env.NODE_ENV ?? 'production';
|
||||
dotenv.config({ path: path.resolve(__dirname, `../.env.${ENVIRONMENT}`) });
|
||||
@@ -165,6 +166,7 @@ app.use("/api/stats", statsRoutes);
|
||||
app.use("/api/notifications", notificationRoutes);
|
||||
app.use("/api/qr", qrRoutes);
|
||||
app.use("/api/dev", devRoutes);
|
||||
app.use("/api/changelogs", changelogRoutes);
|
||||
|
||||
app.use('/stats', express.static('public'));
|
||||
app.use(express.static('public'));
|
||||
|
||||
50
server/src/routes/changelogRoutes.ts
Normal file
50
server/src/routes/changelogRoutes.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import express, { Request, Response } from "express";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
const CHANGELOGS_DIR = path.resolve(__dirname, "../../changelogs");
|
||||
|
||||
// In-memory cache: datum → seznam změn
|
||||
const cache: Record<string, string[]> = {};
|
||||
|
||||
function loadAllChangelogs(): Record<string, string[]> {
|
||||
let files: string[];
|
||||
try {
|
||||
files = fs.readdirSync(CHANGELOGS_DIR).filter(f => f.endsWith(".json"));
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
|
||||
for (const file of files) {
|
||||
const date = file.replace(".json", "");
|
||||
if (!cache[date]) {
|
||||
const content = fs.readFileSync(path.join(CHANGELOGS_DIR, file), "utf-8");
|
||||
cache[date] = JSON.parse(content);
|
||||
}
|
||||
}
|
||||
|
||||
return cache;
|
||||
}
|
||||
|
||||
router.get("/", (req: Request, res: Response) => {
|
||||
const all = loadAllChangelogs();
|
||||
const since = typeof req.query.since === "string" ? req.query.since : undefined;
|
||||
|
||||
// Seřazení od nejnovějšího po nejstarší
|
||||
const sortedDates = Object.keys(all).sort((a, b) => b.localeCompare(a));
|
||||
|
||||
const filteredDates = since
|
||||
? sortedDates.filter(date => date > since)
|
||||
: sortedDates;
|
||||
|
||||
const result: Record<string, string[]> = {};
|
||||
for (const date of filteredDates) {
|
||||
result[date] = all[date];
|
||||
}
|
||||
|
||||
res.status(200).json(result);
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user