mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
update method signatures to not include system id
This commit is contained in:
@@ -4,18 +4,17 @@ import { IEta, IOrderedStop, IRoute, IShuttle, IStop } from "../entities/entitie
|
||||
* Shuttle getter repository to be linked to a system.
|
||||
*/
|
||||
export interface ShuttleGetterRepository {
|
||||
// TODO: Remove system ID argument from all getters
|
||||
getStops(systemId: string): Promise<IStop[]>;
|
||||
getStops(): Promise<IStop[]>;
|
||||
getStopById(stopId: string): Promise<IStop | null>;
|
||||
|
||||
getRoutes(systemId: string): Promise<IRoute[]>;
|
||||
getRoutes(): Promise<IRoute[]>;
|
||||
getRouteById(routeId: string): Promise<IRoute | null>;
|
||||
|
||||
getShuttles(systemId: string): Promise<IShuttle[]>;
|
||||
getShuttles(): Promise<IShuttle[]>;
|
||||
getShuttleById(shuttleId: string): Promise<IShuttle | null>;
|
||||
getShuttlesByRouteId(routeId: string): Promise<IShuttle[]>;
|
||||
|
||||
getEtas(shuttleId: string): Promise<IEta[]>;
|
||||
getEtasForShuttleId(shuttleId: string): Promise<IEta[]>;
|
||||
getEtasForStopId(stopId: string): Promise<IEta[]>;
|
||||
getEtaForShuttleAndStopId(shuttleId: string, stopId: string): Promise<IEta | null>;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export class UnoptimizedInMemoryShuttleRepository implements ShuttleGetterSetter
|
||||
|
||||
private subscribers: ((eta: IEta) => void)[] = [];
|
||||
|
||||
public async getStops(systemId: string) {
|
||||
public async getStops(): Promise<IStop[]> {
|
||||
return this.stops.filter(stop => stop.systemId === systemId);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export class UnoptimizedInMemoryShuttleRepository implements ShuttleGetterSetter
|
||||
return this.findEntityById(stopId, this.stops);
|
||||
}
|
||||
|
||||
public async getRoutes(systemId: string) {
|
||||
public async getRoutes(): Promise<IRoute[]> {
|
||||
return this.routes.filter(route => route.systemId === systemId);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export class UnoptimizedInMemoryShuttleRepository implements ShuttleGetterSetter
|
||||
return this.findEntityById(routeId, this.routes);
|
||||
}
|
||||
|
||||
public async getShuttles(systemId: string) {
|
||||
public async getShuttles(): Promise<IShuttle[]> {
|
||||
return this.shuttles.filter(shuttle => shuttle.systemId === systemId);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export class UnoptimizedInMemoryShuttleRepository implements ShuttleGetterSetter
|
||||
return this.findEntityById(shuttleId, this.shuttles);
|
||||
}
|
||||
|
||||
public async getEtas(shuttleId: string) {
|
||||
public async getEtasForShuttleId(shuttleId: string): Promise<IEta[]> {
|
||||
return this.etas.filter(eta => eta.shuttleId === shuttleId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user