mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
Move repositories into folders.
This commit is contained in:
54
src/repositories/shuttle/ShuttleGetterRepository.ts
Normal file
54
src/repositories/shuttle/ShuttleGetterRepository.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { IEta, IOrderedStop, IRoute, IShuttle, IStop } from "../../entities/ShuttleRepositoryEntities";
|
||||
|
||||
/**
|
||||
* Shuttle getter repository to be linked to a system.
|
||||
*/
|
||||
export interface ShuttleGetterRepository {
|
||||
getStops(): Promise<IStop[]>;
|
||||
getStopById(stopId: string): Promise<IStop | null>;
|
||||
|
||||
getRoutes(): Promise<IRoute[]>;
|
||||
getRouteById(routeId: string): Promise<IRoute | null>;
|
||||
|
||||
getShuttles(): Promise<IShuttle[]>;
|
||||
getShuttleById(shuttleId: string): Promise<IShuttle | null>;
|
||||
getShuttlesByRouteId(routeId: string): Promise<IShuttle[]>;
|
||||
|
||||
getEtasForShuttleId(shuttleId: string): Promise<IEta[]>;
|
||||
getEtasForStopId(stopId: string): Promise<IEta[]>;
|
||||
getEtaForShuttleAndStopId(shuttleId: string, stopId: string): Promise<IEta | null>;
|
||||
|
||||
/**
|
||||
* Subscribe to all updates in ETA data.
|
||||
* The subscriber persists even if the ETA data does not
|
||||
* exist within the repository, and may fire again
|
||||
* if ETA data is restored.
|
||||
* @param listener
|
||||
*/
|
||||
subscribeToEtaUpdates(
|
||||
listener: (eta: IEta) => void,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Unsubscribe from all ETA updates for the given callback.
|
||||
* Callback must be passed by reference.
|
||||
* @param listener
|
||||
*/
|
||||
unsubscribeFromEtaUpdates(listener: (eta: IEta) => void): void;
|
||||
|
||||
getOrderedStopByRouteAndStopId(routeId: string, stopId: string): Promise<IOrderedStop | null>;
|
||||
|
||||
/**
|
||||
* Get ordered stops with the given stop ID.
|
||||
* Returns an empty array if no ordered stops found.
|
||||
* @param stopId
|
||||
*/
|
||||
getOrderedStopsByStopId(stopId: string): Promise<IOrderedStop[]>;
|
||||
|
||||
/**
|
||||
* Get ordered stops with the given route ID.
|
||||
* Returns an empty array if no ordered stops found.
|
||||
* @param routeId
|
||||
*/
|
||||
getOrderedStopsByRouteId(routeId: string): Promise<IOrderedStop[]>;
|
||||
}
|
||||
Reference in New Issue
Block a user