rename methods in getter repository

This commit is contained in:
2025-04-07 19:06:03 -07:00
parent 495a946e78
commit 0076d987ca
7 changed files with 49 additions and 46 deletions

View File

@@ -1,18 +1,21 @@
import { IEta, IOrderedStop, IRoute, IShuttle, IStop } from "../entities/entities";
/**
* Shuttle getter repository to be linked to a system.
*/
export interface ShuttleGetterRepository {
// TODO: Remove system ID argument from all getters
getStopsBySystemId(systemId: string): Promise<IStop[]>;
getStops(systemId: string): Promise<IStop[]>;
getStopById(stopId: string): Promise<IStop | null>;
getRoutesBySystemId(systemId: string): Promise<IRoute[]>;
getRoutes(systemId: string): Promise<IRoute[]>;
getRouteById(routeId: string): Promise<IRoute | null>;
getShuttlesBySystemId(systemId: string): Promise<IShuttle[]>;
getShuttles(systemId: string): Promise<IShuttle[]>;
getShuttleById(shuttleId: string): Promise<IShuttle | null>;
getShuttlesByRouteId(routeId: string): Promise<IShuttle[]>;
getEtasForShuttleId(shuttleId: string): Promise<IEta[]>;
getEtas(shuttleId: string): Promise<IEta[]>;
getEtasForStopId(stopId: string): Promise<IEta[]>;
getEtaForShuttleAndStopId(shuttleId: string, stopId: string): Promise<IEta | null>;

View File

@@ -15,7 +15,7 @@ export class UnoptimizedInMemoryShuttleRepository implements ShuttleGetterSetter
private subscribers: ((eta: IEta) => void)[] = [];
public async getStopsBySystemId(systemId: string) {
public async getStops(systemId: string) {
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 getRoutesBySystemId(systemId: string) {
public async getRoutes(systemId: string) {
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 getShuttlesBySystemId(systemId: string) {
public async getShuttles(systemId: string) {
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 getEtasForShuttleId(shuttleId: string) {
public async getEtas(shuttleId: string) {
return this.etas.filter(eta => eta.shuttleId === shuttleId);
}