import { Repository } from "./base";
import { v4 as uuid } from 'uuid';
-import { City } from "./city";
+import { CityWithLocation } from "./city";
export type Army = {
soldiers: number;
super('army_queue');
}
- async create(owner: string, city: City, attacked_city: City, army: Army, distance: number): Promise<ArmyQueue> {
+ async create(owner: string, city: CityWithLocation, attacked_city: CityWithLocation, army: Army, distance: number): Promise<ArmyQueue> {
// figure out the distance to the attacked city
const info: ArmyQueue = {
async listOutgoing(city_id: string): Promise<ArmyQueueWithAttackedOwner[]> {
return await (this.db.raw(`select
- aq.*, o.username as attacked_account, c.location_x, c.location_y
+ aq.*, o.username as attacked_account, l.location_x, l.location_y, l.sector_id
from army_queue aq
join cities c on c.id = aq.attacked_city
+ join locations l on l.city_id = aq.attacked_city
join accounts o on o.id = c.owner
order by due asc`)) as ArmyQueueWithAttackedOwner[];
}