Add getRecentEntry databaseHelperFunction

This commit is contained in:
baz 2024-03-18 20:39:17 +00:00
parent 80e0eb9c69
commit e98a572b4a
1 changed files with 12 additions and 0 deletions

View File

@ -280,6 +280,17 @@ async function getRecentGameEntry(userId, status) {
return false; return false;
} }
async function getRecentEntry(userId) {
const beatenGameEntry = await LoggedGames.findOne({ where: { userId: userId }, order: [ [ 'updatedAt', 'DESC' ]] })
.catch((err) => {
console.log(err);
});
if (!beatenGameEntry) return false;
return beatenGameEntry;
}
async function getPlanningGames(id) { async function getPlanningGames(id) {
return await getGames(id, 'planning'); return await getGames(id, 'planning');
} }
@ -350,6 +361,7 @@ module.exports = {
getRecentPlayingGameEntry, getRecentPlayingGameEntry,
getRecentBeatenGameEntry, getRecentBeatenGameEntry,
getRecentGameEntry, getRecentGameEntry,
getRecentEntry,
getPlanningGames, getPlanningGames,
getPlayingGames, getPlayingGames,
getBeatenGames, getBeatenGames,