From c95b0dc74dc0b633a5192a958528729e62747d91 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 20 Nov 2024 14:53:29 +0000 Subject: [PATCH] - Add some extra info into the plan families --- src/server.ts | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/server.ts b/src/server.ts index 8eb3ee1..91068c6 100644 --- a/src/server.ts +++ b/src/server.ts @@ -299,6 +299,22 @@ app.post('/api/pokemon/batch/details', async (req, res) => { } }); +interface GamePlan { + game_name: string; + pokemon: Record; +} + +interface PokemonFamilyEntry { + family_pfic?: string; + representative: string; + catch_count: number; + evolve_to: string[]; + breed_for: string[]; + Any?: number; + Male?: number; + Female?: number; +} + app.get('/api/plan', authenticateToken, async (req: AuthRequest, res: Response) => { try { // Read the efficiency plan file @@ -306,7 +322,12 @@ app.get('/api/plan', authenticateToken, async (req: AuthRequest, res: Response) path.join(__dirname, '../plan.json'), 'utf-8' ); - const efficiencyPlan = JSON.parse(planData); + const efficiencyPlan: GamePlan[] = JSON.parse(planData); + efficiencyPlan.forEach((game_plan) => { + for (const key in game_plan["pokemon"]) { + game_plan["pokemon"][key]["family_pfic"] = key; + } + }); // Get the Pokemon database connection const db = await open({