feat(tournament): add cleanup logic for orphaned matches
- Implemented a new method to clean up orphaned matches where at least one player no longer exists, enhancing data integrity in tournament management. - Added a corresponding route and frontend functionality to trigger the cleanup process, allowing users to easily remove invalid match records. - Updated localization strings to support the new feature, ensuring clarity in the user interface.
This commit is contained in:
@@ -420,6 +420,19 @@ export const resetMatches = async (req, res) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const cleanupOrphanedMatches = async (req, res) => {
|
||||
const { authcode: token } = req.headers;
|
||||
const { clubId, tournamentId } = req.body;
|
||||
try {
|
||||
const result = await tournamentService.cleanupOrphanedMatches(token, clubId, tournamentId);
|
||||
emitTournamentChanged(clubId, tournamentId);
|
||||
res.status(200).json(result);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.status(500).json({ error: err.message });
|
||||
}
|
||||
};
|
||||
|
||||
export const removeParticipant = async (req, res) => {
|
||||
const { authcode: token } = req.headers;
|
||||
const { clubId, tournamentId, participantId } = req.body;
|
||||
|
||||
Reference in New Issue
Block a user