|
|
@ -176,7 +176,6 @@ export class LendingStationAPI extends DataSource {
|
|
|
|
.where('timeframe."cargoBikeId" = :id', { id: timeFrame.cargoBikeId })
|
|
|
|
.where('timeframe."cargoBikeId" = :id', { id: timeFrame.cargoBikeId })
|
|
|
|
.andWhere('timeframe."dateRange" && :tr', { tr: timeFrame.dateRange })
|
|
|
|
.andWhere('timeframe."dateRange" && :tr', { tr: timeFrame.dateRange })
|
|
|
|
.getMany();
|
|
|
|
.getMany();
|
|
|
|
console.log(overlapping);
|
|
|
|
|
|
|
|
if (overlapping.length !== 0) {
|
|
|
|
if (overlapping.length !== 0) {
|
|
|
|
throw new UserInputError('TimeFrames with ids: ' + overlapping.map((e) => { return e.id + ', '; }) + 'are overlapping');
|
|
|
|
throw new UserInputError('TimeFrames with ids: ' + overlapping.map((e) => { return e.id + ', '; }) + 'are overlapping');
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -198,7 +197,6 @@ export class LendingStationAPI extends DataSource {
|
|
|
|
.set(timeFrame.lendingStationId);
|
|
|
|
.set(timeFrame.lendingStationId);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
|
|
|
|
if (e instanceof UserInputError) {
|
|
|
|
if (e instanceof UserInputError) {
|
|
|
|
return e;
|
|
|
|
return e;
|
|
|
|
} else if (e instanceof QueryFailedError) {
|
|
|
|
} else if (e instanceof QueryFailedError) {
|
|
|
@ -210,7 +208,7 @@ export class LendingStationAPI extends DataSource {
|
|
|
|
return inserts.generatedMaps[0];
|
|
|
|
return inserts.generatedMaps[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* async updateTimeFrame (timeFrame: any) {
|
|
|
|
/* async updateTimeFrame (timeFrame: any) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await this.connection.transaction(async (entityManager: EntityManager) => {
|
|
|
|
await this.connection.transaction(async (entityManager: EntityManager) => {
|
|
|
|
if (timeFrame.to === undefined) {
|
|
|
|
if (timeFrame.to === undefined) {
|
|
|
@ -260,5 +258,5 @@ export class LendingStationAPI extends DataSource {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
inserts.generatedMaps[0].id = inserts.identifiers[0].id;
|
|
|
|
inserts.generatedMaps[0].id = inserts.identifiers[0].id;
|
|
|
|
return inserts.generatedMaps[0];
|
|
|
|
return inserts.generatedMaps[0];
|
|
|
|
}*/
|
|
|
|
} */
|
|
|
|
}
|
|
|
|
}
|
|
|
|