|
|
|
@ -351,7 +351,7 @@ app.get('/api/plan', authenticateToken, async (req: AuthRequest, res: Response) |
|
|
|
pokemonFamily.family_pfic = key; |
|
|
|
|
|
|
|
// Merge evolve_to into pfics array
|
|
|
|
const pfics: string[] = pokemonFamily.evolve_to.concat(pokemonFamily.evolve_to); |
|
|
|
const pfics: string[] = pokemonFamily.evolve_to; |
|
|
|
|
|
|
|
// Loop through pfics to get details from the database
|
|
|
|
for (let j = 0; j < pfics.length; j++) { |
|
|
|
@ -389,6 +389,44 @@ app.get('/api/plan', authenticateToken, async (req: AuthRequest, res: Response) |
|
|
|
console.error(`Error fetching details for PFIC ${pkmn}:`, err); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const breed_pfics: string[] = pokemonFamily.breed_for |
|
|
|
|
|
|
|
for (let j = 0; j < breed_pfics.length; j++) { |
|
|
|
const pkmn: string = breed_pfics[j]; |
|
|
|
|
|
|
|
try { |
|
|
|
const details = await db.get<{ PFIC: string; data: string }>( |
|
|
|
`SELECT * FROM pokemon_forms WHERE PFIC = ?`, |
|
|
|
pkmn |
|
|
|
); |
|
|
|
|
|
|
|
if (!details) { |
|
|
|
console.log("Details not found for PFIC:", pkmn); |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
const data = JSON.parse(details.data); |
|
|
|
const pokemon = { |
|
|
|
pfic: details.PFIC, |
|
|
|
data: data, |
|
|
|
}; |
|
|
|
|
|
|
|
if (!pokemonFamily.breed_for_augmented) { |
|
|
|
pokemonFamily.breed_for_augmented = []; |
|
|
|
} |
|
|
|
|
|
|
|
const entry = { |
|
|
|
pfic: key, |
|
|
|
name: pokemon.data.name, |
|
|
|
}; |
|
|
|
|
|
|
|
pokemonFamily.breed_for_augmented.push(entry); |
|
|
|
|
|
|
|
} catch (err) { |
|
|
|
console.error(`Error fetching details for PFIC ${pkmn}:`, err); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|