Enhance official tournament listing and upload functionality

This commit updates the `listOfficialTournaments` function to ensure it returns an empty array if no tournaments are found, improving data handling. Additionally, the frontend `OfficialTournaments.vue` is enhanced with a file upload feature for PDF documents, along with improved error handling in the tournament list loading process. These changes enhance user experience by providing clearer feedback and functionality for managing official tournaments.
This commit is contained in:
Torsten Schulz (local)
2025-11-15 21:25:03 +01:00
parent 54ce09e9a9
commit f1321b18bb
4 changed files with 209 additions and 9 deletions

View File

@@ -233,9 +233,11 @@ export const listOfficialTournaments = async (req, res) => {
const { clubId } = req.params;
await checkAccess(userToken, clubId);
const list = await OfficialTournament.findAll({ where: { clubId } });
res.status(200).json(list);
res.status(200).json(Array.isArray(list) ? list : []);
} catch (e) {
res.status(500).json({ error: 'Failed to list tournaments' });
console.error('[listOfficialTournaments] Error:', e);
const errorMessage = e.message || 'Failed to list tournaments';
res.status(e.statusCode || 500).json({ error: errorMessage });
}
};