mirror of
https://gitlab.com/mobicoop/v3/service/matcher.git
synced 2026-01-01 08:22:41 +00:00
rename CarpoolRoute
This commit is contained in:
@@ -15,16 +15,11 @@ export class RouteEntity extends AggregateRoot<RouteProps> {
|
||||
protected readonly _id: AggregateID;
|
||||
|
||||
static create = async (create: CreateRouteProps): Promise<RouteEntity> => {
|
||||
let routes: Route[];
|
||||
try {
|
||||
routes = await create.georouter.routes(
|
||||
this.getPaths(create.roles, create.waypoints),
|
||||
create.georouterSettings,
|
||||
);
|
||||
if (!routes || routes.length == 0) throw new RouteNotFoundException();
|
||||
} catch (e: any) {
|
||||
throw e;
|
||||
}
|
||||
const routes: Route[] = await create.georouter.routes(
|
||||
this.getPaths(create.roles, create.waypoints),
|
||||
create.georouterSettings,
|
||||
);
|
||||
if (!routes || routes.length == 0) throw new RouteNotFoundException();
|
||||
let baseRoute: Route;
|
||||
let driverRoute: Route | undefined;
|
||||
let passengerRoute: Route | undefined;
|
||||
|
||||
@@ -39,16 +39,16 @@ export class GraphhopperGeorouter implements GeorouterPort {
|
||||
paths: Path[],
|
||||
settings: GeorouterSettings,
|
||||
): Promise<Route[]> => {
|
||||
this.setDefaultUrlArgs();
|
||||
this.setSettings(settings);
|
||||
return this.getRoutes(paths);
|
||||
this._setDefaultUrlArgs();
|
||||
this._setSettings(settings);
|
||||
return this._getRoutes(paths);
|
||||
};
|
||||
|
||||
private setDefaultUrlArgs = (): void => {
|
||||
private _setDefaultUrlArgs = (): void => {
|
||||
this.urlArgs = ['vehicle=car', 'weighting=fastest', 'points_encoded=false'];
|
||||
};
|
||||
|
||||
private setSettings = (settings: GeorouterSettings): void => {
|
||||
private _setSettings = (settings: GeorouterSettings): void => {
|
||||
if (settings.detailedDuration) {
|
||||
this.urlArgs.push('details=time');
|
||||
}
|
||||
@@ -62,7 +62,7 @@ export class GraphhopperGeorouter implements GeorouterPort {
|
||||
}
|
||||
};
|
||||
|
||||
private getRoutes = async (paths: Path[]): Promise<Route[]> => {
|
||||
private _getRoutes = async (paths: Path[]): Promise<Route[]> => {
|
||||
const routes = Promise.all(
|
||||
paths.map(async (path) => {
|
||||
const url: string = [
|
||||
|
||||
Reference in New Issue
Block a user