Merge remote-tracking branch 'origin/main'

This commit is contained in:
Sascha Kühl 2025-06-16 16:50:26 +02:00
commit bd164bff25
2 changed files with 30 additions and 0 deletions

View File

@ -83,3 +83,29 @@ exports.findOne = (req, res) => {
});
});
}
exports.summaryForPlayer = (req, res) => {
const { user } = req.query;
const condition = user ? { pitcherId: { [Op.eq]: parseInt(user, 10) } } : null;
BullpenSession.findAll({
where: condition,
include: {
model: Pitch,
as: 'pitches'
}
}).then(data => {
const summary = {
pitchCount: 0,
precisionRate: 0,
strikeRate: 0,
ballRate: 0,
since: new Date()
};
}).catch(err => {
res.status(500).send({
message: `Error retrieving bullpens for user with id=${user}: ${err.message}`
});
});
}

View File

@ -22,4 +22,8 @@ module.exports = function(app) {
"/api/bullpen_session/:id",
[authJwt.verifyToken],
controller.findOne);
app.get(
"/api/bullpen_session/summary",
[authJwt.verifyToken],
controller.summaryForPlayer);
};