mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
rename ISystem to IPassioSystem
This commit is contained in:
@@ -6,7 +6,7 @@ export interface IEntityWithId {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface ISystem extends IEntityWithId, IEntityWithOptionalTimestamp {
|
||||
export interface IPassioSystem extends IEntityWithId, IEntityWithOptionalTimestamp {
|
||||
name: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ShuttleGetterSetterRepository } from "../repositories/ShuttleGetterSetterRepository";
|
||||
import { IEntityWithId, IEta, IRoute, IShuttle, IStop, ISystem } from "../entities/entities";
|
||||
import { IEntityWithId, IEta, IRoute, IShuttle, IStop, IPassioSystem } from "../entities/entities";
|
||||
import { ShuttleRepositoryLoader } from "./ShuttleRepositoryLoader";
|
||||
|
||||
export class ApiResponseError extends Error {
|
||||
@@ -52,7 +52,7 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader
|
||||
// filter down to supported systems
|
||||
const filteredSystem = json.all.find((jsonSystem: any) => jsonSystem.id === this.systemId);
|
||||
if (filteredSystem !== undefined) {
|
||||
const constructedSystem: ISystem = {
|
||||
const constructedSystem: IPassioSystem = {
|
||||
id: filteredSystem.id,
|
||||
name: filteredSystem.fullname,
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Mock data
|
||||
import { IEta, IOrderedStop, IRoute, IShuttle, IStop, ISystem } from "../entities/entities";
|
||||
import { IEta, IOrderedStop, IRoute, IShuttle, IStop, IPassioSystem } from "../entities/entities";
|
||||
import { ShuttleGetterSetterRepository } from "../repositories/ShuttleGetterSetterRepository";
|
||||
|
||||
const systems: ISystem[] = [
|
||||
const systems: IPassioSystem[] = [
|
||||
{
|
||||
id: "1",
|
||||
name: "Chapman University",
|
||||
@@ -4455,9 +4455,6 @@ const etas: IEta[] = [
|
||||
];
|
||||
|
||||
export async function loadShuttleTestData(repository: ShuttleGetterSetterRepository) {
|
||||
await Promise.all(systems.map(async (system) => {
|
||||
await repository.updateSystem(system);
|
||||
}));
|
||||
await Promise.all(routes.map(async (route) => {
|
||||
await repository.addOrUpdateRoute(route);
|
||||
}));
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { IEta, IOrderedStop, IRoute, IShuttle, IStop, ISystem } from "../entities/entities";
|
||||
import { IEta, IOrderedStop, IRoute, IShuttle, IStop } from "../entities/entities";
|
||||
|
||||
export interface ShuttleGetterRepository {
|
||||
getSystemIfExists(): Promise<ISystem | null>;
|
||||
|
||||
getStopsBySystemId(systemId: string): Promise<IStop[]>;
|
||||
getStopById(stopId: string): Promise<IStop | null>;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// to convert from data repo to GraphQL schema
|
||||
|
||||
import { ShuttleGetterRepository } from "./ShuttleGetterRepository";
|
||||
import { IEta, IOrderedStop, IRoute, IShuttle, IStop, ISystem } from "../entities/entities";
|
||||
import { IEta, IOrderedStop, IRoute, IShuttle, IStop } from "../entities/entities";
|
||||
|
||||
/**
|
||||
* ShuttleGetterRepository interface for data derived from Passio API.
|
||||
@@ -12,7 +12,6 @@ import { IEta, IOrderedStop, IRoute, IShuttle, IStop, ISystem } from "../entitie
|
||||
*/
|
||||
export interface ShuttleGetterSetterRepository extends ShuttleGetterRepository {
|
||||
// Setter methods
|
||||
updateSystem(system: ISystem): Promise<void>;
|
||||
addOrUpdateRoute(route: IRoute): Promise<void>;
|
||||
addOrUpdateShuttle(shuttle: IShuttle): Promise<void>;
|
||||
addOrUpdateStop(stop: IStop): Promise<void>;
|
||||
@@ -25,7 +24,6 @@ export interface ShuttleGetterSetterRepository extends ShuttleGetterRepository {
|
||||
removeOrderedStopIfExists(stopId: string, routeId: string): Promise<IOrderedStop | null>;
|
||||
removeEtaIfExists(shuttleId: string, stopId: string): Promise<IEta | null>;
|
||||
|
||||
clearSystemData(): Promise<void>;
|
||||
clearRouteData(): Promise<void>;
|
||||
clearShuttleData(): Promise<void>;
|
||||
clearStopData(): Promise<void>;
|
||||
|
||||
Reference in New Issue
Block a user