Password Policy/App rename/PM Scheduling Improvements

This commit is contained in:
2026-06-06 02:32:47 -05:00
parent dfd999b6a9
commit f024286b5e
59 changed files with 3814 additions and 299 deletions

View File

@@ -12,6 +12,8 @@ const {
getSettings,
listCompletions,
listPlans,
logReading,
recomputeAllSchedules,
saveSettings,
updateAssetPm,
updatePlan
@@ -56,6 +58,11 @@ router.put('/pm-settings', planEditor, (req, res) => {
res.json({ settings: saveSettings(req.body, req.user.id) });
});
// Manually run the schedule recompute now ("Run now" in PM settings).
router.post('/pm-recompute', planEditor, (req, res) => {
res.json({ result: recomputeAllSchedules(req.user.id), settings: getSettings() });
});
// Completed PM forms
router.get('/pm-completions', (req, res) => {
res.json({ completions: listCompletions(req.query) });
@@ -93,4 +100,15 @@ router.post('/assets/:id/pm/:apId/complete', assetPm, (req, res) => {
return res.json({ pm });
});
// Log a standalone usage meter reading (quick-log / inspection) and recompute the schedule.
router.post('/assets/:id/pm/:apId/readings', assetPm, (req, res, next) => {
try {
const pm = logReading(req.params.id, req.params.apId, req.body, req.user.id);
if (!pm) return res.status(404).json({ error: 'PM schedule not found' });
return res.json({ pm });
} catch (error) {
return next(error);
}
});
module.exports = router;