Files
TREK/server/src/nest/ski-routing/ski-routing.module.ts
T
Maurice 6e43490ba0 feat(assistant): plan and save every tour type, bike tours, runs, paddle and ski tours included
The assistant can now plan and save every type the Tours tab plans. A bike
tour or a run is proposed and created through the hike's own plan and save
(propose_tour, create_tour), routed on the server with the costing of its
profile, now kept once in shared and read by the planner as well. A paddle
or ski tour planned with plan_paddle_route or plan_ski_route is saved with
create_paddle_tour or create_ski_tour, and "Plan this" takes those plans,
bike tours and runs too. Every create has its card and its way back.
2026-10-23 21:01:13 +02:00

45 lines
1.9 KiB
TypeScript

import { AddonsModule } from '../addons/addons.module';
import { TrekPlacesWinterService } from '../maps/trek-places-winter.service';
import { PermissionsModule } from '../permissions/permissions.module';
import { SchedulingModule } from '../scheduling/scheduling.module';
import { TripMembershipModule } from '../trip-membership/trip-membership.module';
import { SkiAreasJob } from './ski-areas.job';
import { SkiAreasService } from './ski-areas.service';
import { InlineSkiRouterRunner, SKI_ROUTER_RUNNER } from './ski-router-runner';
import { SkiRoutingController } from './ski-routing.controller';
import { SkiRoutingMcp } from './ski-routing.mcp';
import { SkiRoutingService } from './ski-routing.service';
import { WorkerSkiRouterRunner } from './worker-router-runner';
import { Module } from '@nestjs/common';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
/** The router's own thread where the build ships its script; on the calling thread under the TypeScript sources (the tests). */
function routerRunner() {
const entry = join(__dirname, 'ski-router.worker.js');
return existsSync(entry) ? new WorkerSkiRouterRunner(entry) : new InlineSkiRouterRunner();
}
/**
* The piste router (spec 7): ski and winter tours planned on the ski areas
* the TREK Places host builds from OpenStreetMap. The areas are downloaded by
* id and kept in the data folder (SkiAreasService), searched in a worker
* thread, and checked against the host's new builds once a day (SkiAreasJob).
*/
@Module({
imports: [AddonsModule, PermissionsModule, TripMembershipModule, SchedulingModule],
controllers: [SkiRoutingController],
providers: [
SkiRoutingService,
SkiRoutingMcp,
SkiAreasService,
SkiAreasJob,
TrekPlacesWinterService,
{ provide: SKI_ROUTER_RUNNER, useFactory: routerRunner },
],
// A ski tour the assistant planned is planned again when it is saved (ToursModule).
exports: [SkiRoutingService],
})
export class SkiRoutingModule {}