});
-server.get<{}, string>('/city', async req => {
- const account = await accountRepo.validate(req.authInfo.accountId, req.authInfo.token);
- const city = await cityRepo.FindOne({ owner: account.id });
-
-
- const buildQueues = await cityRepo.getBuildQueues(account.id);
- const unitTrainingQueues = await cityRepo.getUnitTrainingQueues(account.id);
-
- const buildings = await cityRepo.buildingRepository.list();
- const units = await cityRepo.unitRepository.list();
-
- let html = `
- <h2>Kingom Overview</h2>
- ${renderKingomOverview(city, account)}
- <hr>
- <h2>Land Development</h2>
- ${renderLandDevelopment(city, buildings, buildQueues)}
- <h2>Unit Training</h2>
- ${renderUnitTraining(city, units, unitTrainingQueues)},
- <h2>Map</h2>
- ${renderOverworldMap(await cityRepo.FindAll(), city)}
- <h2>Mail</h2>
- ${renderMailroom(await mailRepo.listReceivedMessages(account.id))}
- `;
- return html;
-});
-
server.post<{body: {
soldiers: number,
attackers: number,
return renderKingomOverview(city, account);
});
-server.get<{}, string>('/queue/construction', async req => {
+server.get<{}, string>('/poll/construction', async req => {
const account = await accountRepo.validate(req.authInfo.accountId, req.authInfo.token);
const city = await cityRepo.FindOne({ owner: account.id });
const buildings = await cityRepo.buildingRepository.list();
return renderLandDevelopment(city, buildings, buildQueues);
});
-server.get<{}, string>('/queue/units', async req => {
+server.get<{}, string>('/poll/unit-training', async req => {
const account = await accountRepo.validate(req.authInfo.accountId, req.authInfo.token);
const city = await cityRepo.FindOne({ owner: account.id });
return renderUnitTraining(city, units, unitTrainingQueues);
});
+server.get<{}, string>('/poll/map', async req => {
+ const account = await accountRepo.validate(req.authInfo.accountId, req.authInfo.token);
+ const city = await cityRepo.FindOne({ owner: account.id });
+
+ return renderOverworldMap(await cityRepo.FindAll(), city);
+});
+
+server.get<{}, string>('/poll/mailroom', async req => {
+ const account = await accountRepo.validate(req.authInfo.accountId, req.authInfo.token);
+
+ return renderMailroom(await mailRepo.listReceivedMessages(account.id));
+});
+
server.post<{
body: {