src/tables.ts
Properties |
|
id |
id:
|
Type : string
|
Optional |
isoneway |
isoneway:
|
Type : boolean
|
length |
length:
|
Type : number
|
node_end |
node_end:
|
Type : string
|
node_start |
node_start:
|
Type : string
|
osm_id |
osm_id:
|
Type : string
|
section_geom |
section_geom:
|
Type : T
|
way_name |
way_name:
|
Type : string
|
import { Knex } from 'knex';
import { Geometry, LineString } from 'geojson';
import { ImageType, MeasurementType } from './models';
export interface IImage {
id?: string;
fk_survey_id: string;
distance_survey: number;
image_path: string;
type: ImageType;
fk_way_id: string;
distance_way: number;
timestamp: number;
}
export const Image = (k: Knex) => k.from<IImage>('image');
export interface IMeasurement {
id?: string;
fk_survey_id: string;
distance_survey: number;
type_index: MeasurementType;
value: number;
fk_way_id: string;
distance_way: number;
latitude: number;
longitude: number;
timestamp: Date;
}
export const Measurement = (k: Knex) => k.from<IMeasurement>('measurement');
export interface ISurvey {
id?: string;
section_geom: Geometry;
timestamp: Date;
datasource: string;
/** The Dynatest id of the surveys or null */
survey_id: number;
}
export const Survey = (k: Knex) => k.from<ISurvey>('survey');
export interface IWay<T = LineString> {
id?: string;
way_name: string;
osm_id: string; // This is because bigint is not supported by knex
node_start: string; // See https://stackoverflow.com/questions/39168501/pg-promise-returns-integers-as-strings/39176670#39176670
node_end: string; // Same here
length: number;
section_geom: T; // T should either be LineString or LatLng[]
isoneway: boolean;
}
export const Way = (k: Knex) => k.from<IWay>('way');