This commit is contained in:
Christopher Cookman 2026-01-25 15:14:41 -07:00
parent fbc6b79830
commit 59e7bdee77

View file

@ -3,13 +3,13 @@ const router = express.Router();
const db = global.db;
router.post('/', global.auth, async (req, res) => {
const { serverId, totalPlayers, allPlayers, duration } = req.body;
if (!serverId || totalPlayers === undefined || allPlayers === undefined || duration === undefined) {
const { serverId, totalPlayers, duration } = req.body;
if (!serverId || totalPlayers === undefined || duration === undefined) {
return res.status(400).json({ error: 'Missing required fields' });
}
db.run(
'UPDATE analytics SET serverDuration = ?, allPlayers = ? WHERE id = ?',
[duration, JSON.stringify(allPlayers), serverId],
[duration, JSON.stringify(totalPlayers), serverId],
function(err) {
if (err) {
console.error('Failed to record heartbeat data', err);