Collabsable automations
This commit is contained in:
@@ -113,6 +113,29 @@ function registerVerwaltungRoutes(app) {
|
||||
});
|
||||
});
|
||||
|
||||
// API: Krankheitstage für einen User im aktuellen Jahr abrufen
|
||||
app.get('/api/verwaltung/user/:id/sick-days', requireVerwaltung, (req, res) => {
|
||||
const userId = req.params.id;
|
||||
const currentYear = new Date().getFullYear();
|
||||
const yearStart = `${currentYear}-01-01`;
|
||||
const yearEnd = `${currentYear}-12-31`;
|
||||
|
||||
db.all(`SELECT DISTINCT date
|
||||
FROM timesheet_entries
|
||||
WHERE user_id = ? AND date >= ? AND date <= ? AND sick_status = 1
|
||||
ORDER BY date`,
|
||||
[userId, yearStart, yearEnd],
|
||||
(err, entries) => {
|
||||
if (err) {
|
||||
return res.status(500).json({ error: 'Fehler beim Abrufen der Krankheitstage' });
|
||||
}
|
||||
|
||||
const sickDays = entries ? entries.length : 0;
|
||||
res.json({ sickDays: sickDays, year: currentYear });
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// API: Überstunden- und Urlaubsstatistiken für einen User abrufen
|
||||
app.get('/api/verwaltung/user/:id/stats', requireVerwaltung, (req, res) => {
|
||||
const userId = req.params.id;
|
||||
|
||||
Reference in New Issue
Block a user