diff --git a/backend/src/gameservice.ts b/backend/src/gameservice.ts index 745632e..6e3fdc8 100644 --- a/backend/src/gameservice.ts +++ b/backend/src/gameservice.ts @@ -50,7 +50,9 @@ export function addGameApis(app, jsonParser) { app.post('/api/game/:gameId/apps', async (req, res) => { try { - const apps = await App.findAll({ where: { gameId: req.params['gameId'] } }) + const apps = await App.findAll({ + include: { model: Character, as: "appliedCharacter"}, + where: { gameId: req.params['gameId'] } }) if (!apps) { res.status(404).send('Apps not found.') } else { @@ -63,7 +65,9 @@ export function addGameApis(app, jsonParser) { app.post('/api/game/:gameId/picks', async (req, res) => { try { - const picks = await Pick.findAll({ where: { gameId: req.params['gameId'] } }) + const picks = await Pick.findAll({ + include: { model: Character, as: "pickedCharacter"}, + where: { gameId: req.params['gameId'] } }) if (!picks) { res.status(404).send('Picks not found') } else { diff --git a/frontend/src/vues/CharacterDetails.vue b/frontend/src/vues/CharacterDetails.vue index 6c8dc38..243c6ae 100644 --- a/frontend/src/vues/CharacterDetails.vue +++ b/frontend/src/vues/CharacterDetails.vue @@ -11,11 +11,11 @@
Last Game: {{ lastPlayedPostDate }}
-

{{ games.played.length }} Games Played

+

{{ (games.played || []).length }} Games Played

-

{{ games.applied.length }} Games Applied

+

{{ (games.applied || []).length }} Games Applied

@@ -48,7 +48,7 @@ const earnedIP = ref(0) const gamesPlayedCount = ref(0) const gamesAppliedCount = ref(0) const pickRate = ref(0) -const lastPlayedPostDate = ref({}) +const lastPlayedPostDate = ref({ played: [], applied: [] }) async function loadCharacterDetails() { const characterResponse = await axios.get(`/api/character/${characterId.value}`) diff --git a/frontend/src/vues/GameDetails.vue b/frontend/src/vues/GameDetails.vue index b4427d6..006275d 100644 --- a/frontend/src/vues/GameDetails.vue +++ b/frontend/src/vues/GameDetails.vue @@ -112,6 +112,7 @@ watch( async function loadGameDetails() { const response = await axios.get(`/api/game/${gameId.value}`) + console.log(response) game.value = response.data loadPicks() loadApps() @@ -119,12 +120,13 @@ async function loadGameDetails() { async function loadPicks() { const response = await axios.post(`/api/game/${gameId.value}/picks`) + console.log(response) picks.value = response.data } async function loadApps() { const response = await axios.post(`/api/game/${gameId.value}/apps`) + console.log(response) apps.value = response.data - console.log(apps.value) }