Add getRecentEntry databaseHelperFunction
This commit is contained in:
parent
80e0eb9c69
commit
e98a572b4a
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue