move entities to separate file

This commit is contained in:
2025-01-06 20:52:48 -08:00
parent 9a5bceedc1
commit 413a943c28
2 changed files with 49 additions and 48 deletions

47
src/entities/entities.ts Normal file
View File

@@ -0,0 +1,47 @@
export interface IEntityWithId {
id: string;
}
export interface ISystem extends IEntityWithId {
name: string;
}
export interface ICoordinates {
latitude: number;
longitude: number;
}
export interface IRoute extends IEntityWithId {
name: string;
color: string;
polylineCoordinates: ICoordinates[];
systemId: string;
}
export interface IStop extends IEntityWithId {
name: string;
systemId: string;
coordinates: ICoordinates;
}
export interface IShuttle extends IEntityWithId {
coordinates: ICoordinates;
name: string;
routeId: string;
systemId: string;
}
export interface IEta {
secondsRemaining: number;
shuttleId: string;
stopId: string;
}
export interface IOrderedStop {
nextStop?: IOrderedStop;
previousStop?: IOrderedStop;
routeId: string;
stopId: string;
position: number;
}

View File

@@ -2,53 +2,7 @@
// to convert from data repo to GraphQL schema // to convert from data repo to GraphQL schema
import { GetterRepository } from "./GetterRepository"; import { GetterRepository } from "./GetterRepository";
import { IEta, IOrderedStop, IRoute, IShuttle, IStop, ISystem } from "../entities/entities";
export interface IEntityWithId {
id: string;
}
export interface ISystem extends IEntityWithId {
name: string;
}
export interface ICoordinates {
latitude: number;
longitude: number;
}
export interface IRoute extends IEntityWithId {
name: string;
color: string;
polylineCoordinates: ICoordinates[];
systemId: string;
}
export interface IStop extends IEntityWithId {
name: string;
systemId: string;
coordinates: ICoordinates;
}
export interface IShuttle extends IEntityWithId {
coordinates: ICoordinates;
name: string;
routeId: string;
systemId: string;
}
export interface IEta {
secondsRemaining: number;
shuttleId: string;
stopId: string;
}
export interface IOrderedStop {
nextStop?: IOrderedStop;
previousStop?: IOrderedStop;
routeId: string;
stopId: string;
position: number;
}
/** /**
* GetterRepository interface for data derived from Passio API. * GetterRepository interface for data derived from Passio API.
@@ -64,4 +18,4 @@ export interface GetterSetterRepository extends GetterRepository {
addOrUpdateStop(stop: IStop): Promise<void>; addOrUpdateStop(stop: IStop): Promise<void>;
addOrUpdateOrderedStop(orderedStop: IOrderedStop): Promise<void>; addOrUpdateOrderedStop(orderedStop: IOrderedStop): Promise<void>;
addOrUpdateEta(eta: IEta): Promise<void>; addOrUpdateEta(eta: IEta): Promise<void>;
} }