building_type: string
}
}, string>('/cost/construction', async req => {
+ const account = await accountRepo.validate(req.authInfo.accountId, req.authInfo.token);
+ const city = await cityRepo.getUsersCity(account.id);
+
const amount = parseInt(req.body.amount.trim(), 10);
if(isNaN(amount) || amount < 1) {
time: building.time
};
- return renderCost(cost);
+ return renderCost(cost, city);
});
server.post<{
type: string;
}
}, string>('/cost/training', async req => {
+ const account = await accountRepo.validate(req.authInfo.accountId, req.authInfo.token);
+ const city = await cityRepo.getUsersCity(account.id);
const amount = parseInt(req.body.amount, 10);
if(isNaN(amount) || amount < 1) {
credits: unit.credits * amount,
food: unit.food * amount,
time: unit.time * amount
- });
+ }, city);
});
server.post<{