addet training info
This commit is contained in:
@@ -623,6 +623,19 @@ def get_trainings():
|
||||
except Exception as error:
|
||||
return jsonify({'message': 'Failed to fetch trainings', 'error': str(error)}), 500
|
||||
|
||||
@api_bp.route('/trainings/<int:id>', methods=['GET'])
|
||||
def get_training(id):
|
||||
"""Get a single training by id"""
|
||||
try:
|
||||
training = Training.query.get(id)
|
||||
if training:
|
||||
return jsonify(training.to_dict())
|
||||
else:
|
||||
return jsonify({'message': 'Training not found'}), 404
|
||||
|
||||
except Exception as error:
|
||||
return jsonify({'message': 'Failed to fetch training', 'error': str(error)}), 500
|
||||
|
||||
@api_bp.route('/trainings/<int:id>', methods=['DELETE'])
|
||||
def delete_training(id):
|
||||
"""Delete a training by id"""
|
||||
|
||||
Reference in New Issue
Block a user