Browse Source

- Add some extra info into the plan families

pull/1/head
Dan 1 year ago
parent
commit
c95b0dc74d
  1. 23
      src/server.ts

23
src/server.ts

@ -299,6 +299,22 @@ app.post('/api/pokemon/batch/details', async (req, res) => {
} }
}); });
interface GamePlan {
game_name: string;
pokemon: Record<string, PokemonFamilyEntry>;
}
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) => { app.get('/api/plan', authenticateToken, async (req: AuthRequest, res: Response) => {
try { try {
// Read the efficiency plan file // Read the efficiency plan file
@ -306,7 +322,12 @@ app.get('/api/plan', authenticateToken, async (req: AuthRequest, res: Response)
path.join(__dirname, '../plan.json'), path.join(__dirname, '../plan.json'),
'utf-8' '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 // Get the Pokemon database connection
const db = await open({ const db = await open({

Loading…
Cancel
Save