feat(tactics): add functionality for managing tactic plans in official tournaments
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 55s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 55s
- Implemented routes for listing, saving, updating, and deleting tactic plans in officialTournamentRoutes.js. - Created OfficialTournamentTacticPlan model to handle tactic plan data. - Developed OfficialTournamentService methods for tactic plan operations including validation and error handling. - Enhanced OfficialTournaments.vue to include a new tactics tab with UI for managing tactic plans. - Added TacticBoard component for visualizing and editing tactic paths. - Updated server.js to synchronize the new tactic plan model.
This commit is contained in:
@@ -17,6 +17,35 @@ export const updateOfficialTournament = async (req, res) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const listTacticPlans = async (req, res) => {
|
||||
try {
|
||||
const { authcode: userToken } = req.headers; const { clubId, tournamentId } = req.params;
|
||||
await checkAccess(userToken, clubId);
|
||||
const plans = await officialTournamentService.listTacticPlans(clubId, tournamentId);
|
||||
if (!plans) return res.status(404).json({ error: 'not found' });
|
||||
res.status(200).json(plans);
|
||||
} catch (e) { res.status(e.status || 500).json({ error: e.message || 'Failed to list tactic plans' }); }
|
||||
};
|
||||
|
||||
export const saveTacticPlan = async (req, res) => {
|
||||
try {
|
||||
const { authcode: userToken } = req.headers; const { clubId, tournamentId, planId } = req.params;
|
||||
await checkAccess(userToken, clubId);
|
||||
const plan = await officialTournamentService.saveTacticPlan(clubId, tournamentId, planId, req.body);
|
||||
res.status(planId ? 200 : 201).json(plan);
|
||||
} catch (e) { res.status(e.status || 500).json({ error: e.message || 'Failed to save tactic plan' }); }
|
||||
};
|
||||
|
||||
export const deleteTacticPlan = async (req, res) => {
|
||||
try {
|
||||
const { authcode: userToken } = req.headers; const { clubId, tournamentId, planId } = req.params;
|
||||
await checkAccess(userToken, clubId);
|
||||
const deleted = await officialTournamentService.deleteTacticPlan(clubId, tournamentId, planId);
|
||||
if (!deleted) return res.status(404).json({ error: 'not found' });
|
||||
res.status(204).send();
|
||||
} catch (e) { res.status(e.status || 500).json({ error: e.message || 'Failed to delete tactic plan' }); }
|
||||
};
|
||||
|
||||
export const uploadTournamentPdf = async (req, res) => {
|
||||
try {
|
||||
const { authcode: userToken } = req.headers;
|
||||
|
||||
Reference in New Issue
Block a user