-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(api): scenario cost surfaces shell
- Loading branch information
Showing
5 changed files
with
99 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
api/src/modules/scenarios/cost-surface/cost-surface.facade.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { Request, Response } from 'express'; | ||
import { AdjustCostSurface } from '../../analysis/entry-points/adjust-cost-surface'; | ||
import { ProxyService } from '../../proxy/proxy.service'; | ||
|
||
@Injectable() | ||
export class CostSurfaceFacade { | ||
constructor( | ||
private readonly adjustCostSurfaceService: AdjustCostSurface, | ||
private readonly proxyService: ProxyService, | ||
) {} | ||
|
||
/** | ||
* non blocking - will do job in "background" | ||
* | ||
* @param scenarioId | ||
* @param request | ||
*/ | ||
convert(scenarioId: string, request: Request) { | ||
// TODO #0 Generate & Dispatch Api Event (some wrapping service for /dummy/"terminating" if already running) | ||
|
||
// TODO #1 Call Proxy Service to get GeoJSON | ||
// this.proxyService.... - modify this to send back data, not act on Response | ||
|
||
// TODO #2 Call Analysis-module with scenario id & GeoJson from above | ||
this.adjustCostSurfaceService | ||
.update(scenarioId, { | ||
geo: { | ||
features: [], | ||
type: 'FeatureCollection', | ||
}, | ||
}) | ||
.then(() => { | ||
// dispatch ApiEvent - Done | ||
}) | ||
.catch(() => { | ||
// dispatch ApiEvent - Failed | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters