|
|
@ -42,6 +42,14 @@ export class LendingStationAPI extends DataSource {
|
|
|
|
.getOne().catch(() => { return null; });
|
|
|
|
.getOne().catch(() => { return null; });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async lendingStationByTimeFrameId (id: number) {
|
|
|
|
|
|
|
|
await this.connection.getRepository(TimeFrame)
|
|
|
|
|
|
|
|
.createQueryBuilder('timeframe')
|
|
|
|
|
|
|
|
.relation(TimeFrame, 'lendingStation')
|
|
|
|
|
|
|
|
.of(id)
|
|
|
|
|
|
|
|
.loadOne();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async timeFrames (offset: number, limit: number) {
|
|
|
|
async timeFrames (offset: number, limit: number) {
|
|
|
|
return await this.connection.getRepository(TimeFrame)
|
|
|
|
return await this.connection.getRepository(TimeFrame)
|
|
|
|
.createQueryBuilder('timeframe')
|
|
|
|
.createQueryBuilder('timeframe')
|
|
|
@ -127,6 +135,7 @@ export class LendingStationAPI extends DataSource {
|
|
|
|
|
|
|
|
|
|
|
|
async createTimeFrame (timeFrame: any) {
|
|
|
|
async createTimeFrame (timeFrame: any) {
|
|
|
|
let inserts: any;
|
|
|
|
let inserts: any;
|
|
|
|
|
|
|
|
try {
|
|
|
|
await this.connection.transaction(async (entityManager: EntityManager) => {
|
|
|
|
await this.connection.transaction(async (entityManager: EntityManager) => {
|
|
|
|
if (timeFrame.to === undefined) {
|
|
|
|
if (timeFrame.to === undefined) {
|
|
|
|
timeFrame.to = '';
|
|
|
|
timeFrame.to = '';
|
|
|
@ -149,6 +158,9 @@ export class LendingStationAPI extends DataSource {
|
|
|
|
.of(inserts.identifiers[0].id)
|
|
|
|
.of(inserts.identifiers[0].id)
|
|
|
|
.set(timeFrame.lendingStationId);
|
|
|
|
.set(timeFrame.lendingStationId);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
return new GraphQLError('Transaction could not be completed');
|
|
|
|
|
|
|
|
}
|
|
|
|
inserts.generatedMaps[0].id = inserts.identifiers[0].id;
|
|
|
|
inserts.generatedMaps[0].id = inserts.identifiers[0].id;
|
|
|
|
return inserts.generatedMaps[0];
|
|
|
|
return inserts.generatedMaps[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|