Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config for including typings with data inserter #200

Merged
merged 4 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import * as config from '@config';
import * as db from '@util/db';
import { closeDbConnection, createDbConnection, DbConnection } from '@util/db';
import { setupDb } from '@util/setup';
import { randomUUID } from 'crypto';
import {
infrastructureLinks as sourceInfrastructureLinks,
journeyPatterns,
routesAndJourneyPatternsTableData as baseTableConfig,
journeyPatterns,
infrastructureLinks as sourceInfrastructureLinks,
scheduledStopPoints as sourceScheduledStopPoints,
} from 'generic/networkdb/datasets/routesAndJourneyPatterns';
import { GenericNetworkDbTables } from 'generic/networkdb/datasets/schema';
Expand All @@ -19,6 +18,7 @@ import {
VehicleSubmodeOnInfrastructureLink,
} from 'generic/networkdb/datasets/types';
import { DateTime } from 'luxon';
import { v4 as uuidv4 } from 'uuid';

describe('Function service_pattern.get_distances_between_stop_points_in_journey_patterns', () => {
let dbConnection: DbConnection;
Expand Down Expand Up @@ -447,7 +447,7 @@ describe('Function service_pattern.get_distances_between_stop_points_in_journey_
// Set a different location along the associated infrastructure link.
const higherPriorityStopVariant: ScheduledStopPoint = {
...scheduledStopPoints[7],
scheduled_stop_point_id: randomUUID(),
scheduled_stop_point_id: uuidv4(),
priority: newPriority,
measured_location: {
type: 'Point',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { buildLocalizedString } from '@util/dataset';
import * as db from '@util/db';
import { closeDbConnection, createDbConnection, DbConnection } from '@util/db';
import { setupDb } from '@util/setup';
import { randomUUID } from 'crypto';
import { Route, RouteDirection } from 'generic/networkdb/datasets/types';
import { DateTime } from 'luxon';
import { v4 as uuidv4 } from 'uuid';

const dummyLineId = randomUUID();
const dummyLineId = uuidv4();
const defaultRouteLabel = 'route 1';

const defaultCommonRouteProps = {
Expand Down Expand Up @@ -65,8 +65,8 @@ describe('Function maximum_priority_validity_spans should return correct route r
// expected result:
// |---earlier---| |----later----|

const earlierRouteId = randomUUID();
const laterRouteId = randomUUID();
const earlierRouteId = uuidv4();
const laterRouteId = uuidv4();

const earlierRouteValidityStart = DateTime.fromISO('2020-01-04');
const earlierRouteValidityEnd = DateTime.fromISO('2021-04-04');
Expand Down Expand Up @@ -115,8 +115,8 @@ describe('Function maximum_priority_validity_spans should return correct route r
// expected result:
// |---earlier---|----later----|

const earlierRouteId = randomUUID();
const laterRouteId = randomUUID();
const earlierRouteId = uuidv4();
const laterRouteId = uuidv4();

const earlierRouteValidityStart = DateTime.fromISO('2020-01-04');
const earlierRouteValidityEnd = DateTime.fromISO('2021-04-04');
Expand Down Expand Up @@ -163,8 +163,8 @@ describe('Function maximum_priority_validity_spans should return correct route r
// expected result:
// |--low prio--|---high prio---|

const earlierLowerPrioRouteId = randomUUID();
const laterHigherPrioRouteId = randomUUID();
const earlierLowerPrioRouteId = uuidv4();
const laterHigherPrioRouteId = uuidv4();

const earlierLowerPrioRouteValidityStart = DateTime.fromISO('2020-01-04');
const earlierLowerPrioRouteValidityEnd = DateTime.fromISO('2024-04-04');
Expand Down Expand Up @@ -215,8 +215,8 @@ describe('Function maximum_priority_validity_spans should return correct route r
// expected result:
// |--low prio----|

const earlierLowerPrioRouteId = randomUUID();
const laterHigherPrioRouteId = randomUUID();
const earlierLowerPrioRouteId = uuidv4();
const laterHigherPrioRouteId = uuidv4();

const earlierLowerPrioRouteValidityStart = DateTime.fromISO('2020-01-04');
const earlierLowerPrioRouteValidityEnd = DateTime.fromISO('2024-04-04');
Expand Down Expand Up @@ -270,8 +270,8 @@ describe('Function maximum_priority_validity_spans should return correct route r
// |--low prio----|
// | label: A |

const earlierLowerPrioRouteId = randomUUID();
const laterHigherPrioRouteId = randomUUID();
const earlierLowerPrioRouteId = uuidv4();
const laterHigherPrioRouteId = uuidv4();

const earlierLowerPrioRouteValidityStart = DateTime.fromISO('2020-01-04');
const earlierLowerPrioRouteValidityEnd = DateTime.fromISO('2024-04-04');
Expand Down Expand Up @@ -318,8 +318,8 @@ describe('Function maximum_priority_validity_spans should return correct route r
// expected result:
// |--low prio--|---high prio---|--low prio---|

const lowerPrioRouteId = randomUUID();
const higherPrioRouteId = randomUUID();
const lowerPrioRouteId = uuidv4();
const higherPrioRouteId = uuidv4();

const lowerPrioRouteValidityStart = DateTime.fromISO('2020-01-04');
const lowerPrioRouteValidityEnd = DateTime.fromISO('2025-04-04');
Expand Down Expand Up @@ -375,8 +375,8 @@ describe('Function maximum_priority_validity_spans should return correct route r
// expected result:
// |----------------high prio-----------------|

const lowerPrioRouteId = randomUUID();
const higherPrioRouteId = randomUUID();
const lowerPrioRouteId = uuidv4();
const higherPrioRouteId = uuidv4();

const lowerPrioRouteValidityStart = DateTime.fromISO('2022-01-04');
const lowerPrioRouteValidityEnd = DateTime.fromISO('2024-04-04');
Expand Down Expand Up @@ -422,8 +422,8 @@ describe('Function maximum_priority_validity_spans should return correct route r
// expected result for priority < 20:
// |---prio: 10----|

const lowerPrioRouteId = randomUUID();
const higherPrioRouteId = randomUUID();
const lowerPrioRouteId = uuidv4();
const higherPrioRouteId = uuidv4();

const lowerPrioRouteValidityStart = DateTime.fromISO('2022-01-04');
const lowerPrioRouteValidityEnd = DateTime.fromISO('2024-04-04');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
singleQuery,
} from '@util/db';
import { setupDb } from '@util/setup';
import { randomUUID } from 'crypto';
import {
InfrastructureLink,
JourneyPattern,
Expand All @@ -17,10 +16,11 @@ import {
ScheduledStopPoint,
} from 'generic/networkdb/datasets/types';
import { DateTime } from 'luxon';
import { v4 as uuidv4 } from 'uuid';

const defaultRouteLabel = 'route 2';
const stopLabel = 'stop A';
const infraLinkId = randomUUID();
const infraLinkId = uuidv4();

const defaultCommonStopProps: Partial<ScheduledStopPoint> = {
located_on_infrastructure_link_id: infraLinkId,
Expand All @@ -38,8 +38,8 @@ const defaultCommonStopProps: Partial<ScheduledStopPoint> = {
};

const route: Partial<Route> = {
route_id: randomUUID(),
on_line_id: randomUUID(),
route_id: uuidv4(),
on_line_id: uuidv4(),
label: defaultRouteLabel,
direction: RouteDirection.Outbound,
priority: 10,
Expand All @@ -49,7 +49,7 @@ const route: Partial<Route> = {
};

const journeyPattern: Partial<JourneyPattern> = {
journey_pattern_id: randomUUID(),
journey_pattern_id: uuidv4(),
on_route_id: route.route_id,
};

Expand Down Expand Up @@ -147,8 +147,8 @@ describe('Function maximum_priority_validity_spans should return correct schedul
// expected result:
// |---earlier---| |----later----|

const earlierStopId = randomUUID();
const laterStopId = randomUUID();
const earlierStopId = uuidv4();
const laterStopId = uuidv4();

const earlierStopValidityStart = DateTime.fromISO('2020-01-04');
const earlierStopValidityEnd = DateTime.fromISO('2021-04-05');
Expand Down Expand Up @@ -197,8 +197,8 @@ describe('Function maximum_priority_validity_spans should return correct schedul
// expected result:
// |---earlier---|----later----|

const earlierStopId = randomUUID();
const laterStopId = randomUUID();
const earlierStopId = uuidv4();
const laterStopId = uuidv4();

const earlierStopValidityStart = DateTime.fromISO('2020-01-04');
const earlierStopValidityEnd = DateTime.fromISO('2021-04-05');
Expand Down Expand Up @@ -245,8 +245,8 @@ describe('Function maximum_priority_validity_spans should return correct schedul
// expected result:
// |--low prio--|---high prio---|

const earlierLowerPrioStopId = randomUUID();
const laterHigherPrioStopId = randomUUID();
const earlierLowerPrioStopId = uuidv4();
const laterHigherPrioStopId = uuidv4();

const earlierLowerPrioStopValidityStart = DateTime.fromISO('2020-01-04');
const earlierLowerPrioStopValidityEnd = DateTime.fromISO('2024-04-05');
Expand Down Expand Up @@ -297,8 +297,8 @@ describe('Function maximum_priority_validity_spans should return correct schedul
// expected result:
// |--low prio----|

const earlierLowerPrioStopId = randomUUID();
const laterHigherPrioStopId = randomUUID();
const earlierLowerPrioStopId = uuidv4();
const laterHigherPrioStopId = uuidv4();

const earlierLowerPrioStopValidityStart = DateTime.fromISO('2020-01-04');
const earlierLowerPrioStopValidityEnd = DateTime.fromISO('2024-04-05');
Expand Down Expand Up @@ -351,8 +351,8 @@ describe('Function maximum_priority_validity_spans should return correct schedul
// expected result for label B:
// (empty)

const earlierLowerPrioStopId = randomUUID();
const laterHigherPrioStopId = randomUUID();
const earlierLowerPrioStopId = uuidv4();
const laterHigherPrioStopId = uuidv4();

const earlierLowerPrioStopValidityStart = DateTime.fromISO('2020-01-04');
const earlierLowerPrioStopValidityEnd = DateTime.fromISO('2024-04-05');
Expand Down Expand Up @@ -393,8 +393,8 @@ describe('Function maximum_priority_validity_spans should return correct schedul
// expected result:
// |--low prio--|---high prio---|--low prio---|

const lowerPrioStopId = randomUUID();
const higherPrioStopId = randomUUID();
const lowerPrioStopId = uuidv4();
const higherPrioStopId = uuidv4();

const lowerPrioStopValidityStart = DateTime.fromISO('2020-01-04');
const lowerPrioStopValidityEnd = DateTime.fromISO('2025-04-05');
Expand Down Expand Up @@ -450,8 +450,8 @@ describe('Function maximum_priority_validity_spans should return correct schedul
// expected result:
// |----------------high prio-----------------|

const lowerPrioStopId = randomUUID();
const higherPrioStopId = randomUUID();
const lowerPrioStopId = uuidv4();
const higherPrioStopId = uuidv4();

const lowerPrioStopValidityStart = DateTime.fromISO('2022-01-04');
const lowerPrioStopValidityEnd = DateTime.fromISO('2024-04-05');
Expand Down Expand Up @@ -497,8 +497,8 @@ describe('Function maximum_priority_validity_spans should return correct schedul
// expected result for priority < 20:
// |---prio: 10----|

const lowerPrioStopId = randomUUID();
const higherPrioStopId = randomUUID();
const lowerPrioStopId = uuidv4();
const higherPrioStopId = uuidv4();

const lowerPrioStopValidityStart = DateTime.fromISO('2022-01-04');
const lowerPrioStopValidityEnd = DateTime.fromISO('2024-04-05');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './day-types';
export * from './journey-pattern-refs';
export * from './passing-times';
export * from './stop-points';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DateTime } from 'luxon';
import { defaultDayTypeIds } from '../day-types';
import { defaultDayTypeIds } from '../../../../../timetables-data-inserter/day-types';

export const summer2023VehicleScheduleFrame = {
validity_start: DateTime.fromISO('2023-06-01'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DateTime, Duration } from 'luxon';
import { defaultDayTypeIds } from '../day-types';
import { defaultDayTypeIds } from '../../../../../timetables-data-inserter/day-types';

export const winter2022VehicleScheduleFrame = {
validity_start: DateTime.fromISO('2022-07-01'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defaultDayTypeIds } from '../../../../timetables-data-inserter/day-types';
import { VehicleService } from '../types';
import { defaultDayTypeIds } from './day-types';
import { vehicleScheduleFramesByName } from './vehicle-schedules-frames';

export const vehicleServicesByName = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
import { addMutationWrapper, postQuery } from '@util/graphql';
import { expectErrorResponse, expectNoErrorResponse } from '@util/response';
import { getPartialTableData, insertTableData, setupDb } from '@util/setup';
import { defaultDayTypeIds } from 'generic/timetablesdb/datasets/defaultSetup';
import { defaultTimetablesDataset } from 'generic/timetablesdb/datasets/defaultSetup/default-timetables-dataset';
import { GenericTimetablesDbTables } from 'generic/timetablesdb/datasets/schema';
import { TimetablePriority } from 'generic/timetablesdb/datasets/types';
Expand All @@ -24,6 +23,7 @@ import { DateTime } from 'luxon';
import {
buildGenericTimetablesDataset,
createGenericTableData,
defaultDayTypeIds,
GenericTimetablesDatasetInput,
genericVehicleScheduleFrameToDbFormat,
timetabledPassingTimeToDbFormat,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
defaultDayTypeIds,
journeyPatternRefsByName,
} from 'generic/timetablesdb/datasets/defaultSetup';
import { journeyPatternRefsByName } from 'generic/timetablesdb/datasets/defaultSetup';
import { TimetablePriority } from 'generic/timetablesdb/datasets/types';
import { DateTime } from 'luxon';
import { defaultDayTypeIds } from '../../../../../timetables-data-inserter/day-types';
import { buildHslVehicleScheduleFrame } from '../../factories';
import { HslTimetablesDbTables } from '../../schema';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
defaultDayTypeIds,
journeyPatternRefsByName,
} from 'generic/timetablesdb/datasets/defaultSetup';
import { journeyPatternRefsByName } from 'generic/timetablesdb/datasets/defaultSetup';
import { TimetablePriority } from 'generic/timetablesdb/datasets/types';
import { DateTime } from 'luxon';
import { defaultDayTypeIds } from '../../../../../timetables-data-inserter/day-types';
import { buildHslVehicleScheduleFrame } from '../../factories';
import { HslTimetablesDbTables } from '../../schema';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
defaultDayTypeIds,
journeyPatternRefsByName,
} from 'generic/timetablesdb/datasets/defaultSetup';
import { journeyPatternRefsByName } from 'generic/timetablesdb/datasets/defaultSetup';
import { TimetablePriority } from 'generic/timetablesdb/datasets/types';
import { DateTime } from 'luxon';
import { defaultDayTypeIds } from '../../../../../timetables-data-inserter/day-types';
import { buildHslVehicleScheduleFrame } from '../../factories';
import { HslTimetablesDbTables } from '../../schema';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
defaultDayTypeIds,
journeyPatternRefsByName,
} from 'generic/timetablesdb/datasets/defaultSetup';
import { journeyPatternRefsByName } from 'generic/timetablesdb/datasets/defaultSetup';
import { TimetablePriority } from 'generic/timetablesdb/datasets/types';
import { DateTime } from 'luxon';
import { defaultDayTypeIds } from '../../../../../timetables-data-inserter/day-types';
import { buildHslVehicleScheduleFrame } from '../../factories';
import { HslTimetablesDbTables } from '../../schema';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
defaultDayTypeIds,
journeyPatternRefsByName,
} from 'generic/timetablesdb/datasets/defaultSetup';
import { journeyPatternRefsByName } from 'generic/timetablesdb/datasets/defaultSetup';
import { TimetablePriority } from 'generic/timetablesdb/datasets/types';
import { DateTime } from 'luxon';
import { defaultDayTypeIds } from '../../../../../timetables-data-inserter/day-types';
import { buildHslVehicleScheduleFrame } from '../../factories';
import { HslTimetablesDbTables } from '../../schema';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { defaultDayTypeIds } from 'generic/timetablesdb/datasets/defaultSetup';
import { defaultTimetablesDataset as defaultGenericTimetablesDataset } from 'generic/timetablesdb/datasets/defaultSetup/default-timetables-dataset';
import {
TimetablePriority,
TypeOfLine,
} from 'generic/timetablesdb/datasets/types';
import { DateTime } from 'luxon';
import { mergeTimetablesDatasets } from 'timetables-data-inserter';
import { defaultDayTypeIds } from '../../../../timetables-data-inserter/day-types';
import { DayOfWeek } from '../types';

const defaultTimetablesDatasetHslAdditions = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {
defaultDayTypeIds,
vehicleServices,
} from 'generic/timetablesdb/datasets/defaultSetup';
import { vehicleServices } from 'generic/timetablesdb/datasets/defaultSetup';
import { VehicleService } from 'generic/timetablesdb/datasets/types';
import { defaultDayTypeIds } from '../../../../timetables-data-inserter/day-types';
import { hslVehicleScheduleFramesByName } from './vehicle-schedule-frames';

export const hslVehicleServicesByName = {
Expand Down
Loading
Loading