v1.8.0: warehouse module (16 commits), docházka mzda model, leave_type=holiday removal, api.ts race fix
Highlights: - Warehouse module: receipts, issues, reservations, inventory, reports, dashboard, master data (categories, suppliers, locations), FIFO service, integration tests - Docházka: mzda PDF counting model (Odpracováno / Vč. svátků / Přesčas / Svátek / So/Ne / Noc) with Czech weekday names and decimal hours - AttendanceAdmin/AttendanceHistory KPI cards unified to mzda formula with fund bar colored by delta, badges for Práce/Dov/Nem/Sv/Nep - Remove leave_type=holiday entirely (auto-computed from Czech public holidays) - Allow multiple work shifts per day (overlap detection only) - Pre-flight refresh in api.ts eliminates spurious 401s on fresh page loads - Prisma: company_settings gets 6 nullable columns for warehouse numbering (PRI/VYD/INV prefixes, default patterns); migration seeds defaults
This commit is contained in:
@@ -6,6 +6,7 @@ import rateLimit from "@fastify/rate-limit";
|
||||
import path from "path";
|
||||
import { config } from "./config/env";
|
||||
import { securityHeaders } from "./middleware/security";
|
||||
import prisma from "./config/database";
|
||||
|
||||
import authRoutes from "./routes/admin/auth";
|
||||
import usersRoutes from "./routes/admin/users";
|
||||
@@ -64,10 +65,26 @@ async function start() {
|
||||
await app.register(cookie);
|
||||
|
||||
// --- Health check (before rate-limit so monitoring isn't throttled) ---
|
||||
app.get("/api/health", async () => ({
|
||||
status: "ok",
|
||||
timestamp: new Date().toISOString(),
|
||||
}));
|
||||
// Pings the database so load balancers / PM2 can detect a broken instance.
|
||||
// Returns 503 with { status: "unhealthy", ... } if the DB is unreachable.
|
||||
app.get("/api/health", async (_request, reply) => {
|
||||
try {
|
||||
await prisma.$queryRaw`SELECT 1`;
|
||||
} catch (err) {
|
||||
reply.status(503);
|
||||
return {
|
||||
status: "unhealthy",
|
||||
database: "unreachable",
|
||||
error: err instanceof Error ? err.message : "unknown",
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
}
|
||||
return {
|
||||
status: "ok",
|
||||
database: "reachable",
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
});
|
||||
|
||||
await app.register(rateLimit, {
|
||||
max: config.rateLimit.max,
|
||||
|
||||
Reference in New Issue
Block a user