diff --git a/src/repositories/GetterRepository.ts b/src/repositories/GetterRepository.ts new file mode 100644 index 0000000..5d62dbd --- /dev/null +++ b/src/repositories/GetterRepository.ts @@ -0,0 +1,37 @@ +import { IEta, IOrderedStop, IRoute, IShuttle, IStop, ISystem } from "./GetterSetterRepository"; + +export interface GetterRepository { + getSystems(): Promise; + getSystemById(systemId: string): Promise; + + getStopsBySystemId(systemId: string): Promise; + getStopById(stopId: string): Promise; + + getRoutesBySystemId(systemId: string): Promise; + getRouteById(routeId: string): Promise; + + getShuttlesBySystemId(systemId: string): Promise; + getShuttleById(shuttleId: string): Promise; + getShuttlesByRouteId(routeId: string): Promise; + + getEtasForShuttleId(shuttleId: string): Promise; + getEtasForStopId(stopId: string): Promise; + + getEtaForShuttleAndStopId(shuttleId: string, stopId: string): Promise; + + getOrderedStopByRouteAndStopId(routeId: string, stopId: string): Promise; + + /** + * Get ordered stops with the given stop ID. + * Returns an empty array if no ordered stops found. + * @param stopId + */ + getOrderedStopsByStopId(stopId: string): Promise; + + /** + * Get ordered stops with the given route ID. + * Returns an empty array if no ordered stops found. + * @param routeId + */ + getOrderedStopsByRouteId(routeId: string): Promise; +} \ No newline at end of file diff --git a/src/repositories/GetterSetterRepository.ts b/src/repositories/GetterSetterRepository.ts index 226bf64..e2d51a1 100644 --- a/src/repositories/GetterSetterRepository.ts +++ b/src/repositories/GetterSetterRepository.ts @@ -1,6 +1,8 @@ // If types match closely, we can use TypeScript "casting" // to convert from data repo to GraphQL schema +import { GetterRepository } from "./GetterRepository"; + export interface IEntityWithId { id: string; } @@ -54,43 +56,7 @@ export interface IOrderedStop { * Objects passed from/to the repository should be treated * as disposable. */ -export interface GetterSetterRepository { - // Getter methods - - getSystems(): Promise; - getSystemById(systemId: string): Promise; - - getStopsBySystemId(systemId: string): Promise; - getStopById(stopId: string): Promise; - - getRoutesBySystemId(systemId: string): Promise; - getRouteById(routeId: string): Promise; - - getShuttlesBySystemId(systemId: string): Promise; - getShuttleById(shuttleId: string): Promise; - getShuttlesByRouteId(routeId: string): Promise; - - getEtasForShuttleId(shuttleId: string): Promise; - getEtasForStopId(stopId: string): Promise; - - getEtaForShuttleAndStopId(shuttleId: string, stopId: string): Promise; - - getOrderedStopByRouteAndStopId(routeId: string, stopId: string): Promise; - - /** - * Get ordered stops with the given stop ID. - * Returns an empty array if no ordered stops found. - * @param stopId - */ - getOrderedStopsByStopId(stopId: string): Promise; - - /** - * Get ordered stops with the given route ID. - * Returns an empty array if no ordered stops found. - * @param routeId - */ - getOrderedStopsByRouteId(routeId: string): Promise; - +export interface GetterSetterRepository extends GetterRepository { // Setter methods addOrUpdateSystem(system: ISystem): Promise; addOrUpdateRoute(route: IRoute): Promise;