Update MyTischtennis functionality to support automatic rating updates. Introduce new autoUpdateRatings field in MyTischtennis model and enhance MyTischtennisController to handle update history retrieval. Integrate node-cron for scheduling daily updates at 6:00 AM. Update frontend components to allow users to enable/disable automatic updates and display last update timestamps.

This commit is contained in:
Torsten Schulz (local)
2025-10-09 00:18:41 +02:00
parent 806cb527d4
commit 993e12d4a5
47 changed files with 1983 additions and 683 deletions

View File

@@ -42,7 +42,7 @@ class MyTischtennisController {
async upsertAccount(req, res, next) {
try {
const userId = req.user.id;
const { email, password, savePassword, userPassword } = req.body;
const { email, password, savePassword, autoUpdateRatings, userPassword } = req.body;
if (!email) {
throw new HttpError(400, 'E-Mail-Adresse erforderlich');
@@ -58,6 +58,7 @@ class MyTischtennisController {
email,
password,
savePassword || false,
autoUpdateRatings || false,
userPassword
);
@@ -127,6 +128,20 @@ class MyTischtennisController {
next(error);
}
}
/**
* GET /api/mytischtennis/update-history
* Get update ratings history
*/
async getUpdateHistory(req, res, next) {
try {
const userId = req.user.id;
const history = await myTischtennisService.getUpdateHistory(userId);
res.status(200).json({ history });
} catch (error) {
next(error);
}
}
}
export default new MyTischtennisController();