This commit is contained in:
Louis Mazin 2025-12-09 19:48:12 +01:00
parent b1962da1ec
commit 863cffe55e

View File

@ -216,19 +216,12 @@ const cleanExpiredCodes = async () => {
); );
}; };
const updateLastConnection = async (userId) => { const updateLastConnection = async (steamId) => {
const connection = getConnection(); const connection = getConnection();
await connection.execute(
// Le userId est au format gdk_STEAMID, on extrait le Steam ID
const steamIdMatch = userId.match(/gdk_(\d+)/);
const steamId = steamIdMatch ? steamIdMatch[1] : userId;
const [result] = await connection.execute(
'UPDATE user_links SET lastConnection = NOW() WHERE steam_id = ?', 'UPDATE user_links SET lastConnection = NOW() WHERE steam_id = ?',
[steamId] [steamId]
); );
return { success: true, changes: result.affectedRows };
}; };
module.exports = { module.exports = {