Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
test-graph-view | backend now fetches data for graph with this query …
Browse files Browse the repository at this point in the history
…/way2?dbId=12e920a5-368c-4484-a0a3-e8a626ec49fe&type=KPI
  • Loading branch information
marcosantiagomuro committed Oct 5, 2023
1 parent fea2c2c commit cf937cb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
8 changes: 8 additions & 0 deletions backend/src/conditions/rc.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ export class RCController {
return this.service.getWayRoadConditions(wayId, type);
}

@Get('way2')
getWay2Conditions(
@Query() query: { dbId: string; type: string },
): Promise<Condition[]> {
const { dbId, type } = query;
return this.service.getWay2RoadConditions(dbId, type);
}

@Get('')
getConditions(
@Query()
Expand Down
18 changes: 17 additions & 1 deletion backend/src/conditions/rc.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import { Injectable } from '@nestjs/common';
import { InjectConnection, Knex } from 'nestjs-knex';
import { Condition, LatLngDist, WayId, WaysConditions } from 'src/models';
import groupBy from '../util';
import { RoadConditions, Ways, ZoomConditions, Conditions2 } from '../tables';
import {
RoadConditions,
Ways,
ZoomConditions,
Conditions2,
Conditions,
} from '../tables';

import knexPostgis = require('knex-postgis');

Expand Down Expand Up @@ -54,6 +60,16 @@ export class RCService {
.orderBy('way_dist');
}

async getWay2RoadConditions(
dbId: string,
type: string,
): Promise<Condition[]> {
return Conditions(this.knex_liramap)
.select('fk_way_id', 'type', 'value', 'compute_time')
.where({ type: type, fk_way_id: dbId })
.orderBy('compute_time');
}

async getZoomConditions(
type: string,
zoom: string,
Expand Down
1 change: 1 addition & 0 deletions backend/src/tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const ZoomConditions = (k: Knex) =>
// [email protected]: This is for PostGIS in the LiRAMap (LiraVis) database
export interface Condition_Coverage {
id: string;
fk_way_id: string;
type: string;
value: number;
section_geom: Geometry;
Expand Down

0 comments on commit cf937cb

Please sign in to comment.