|
|
@ -25,6 +25,7 @@ import { LendingStation } from '../../model/LendingStation';
|
|
|
|
import { TimeFrame } from '../../model/TimeFrame';
|
|
|
|
import { TimeFrame } from '../../model/TimeFrame';
|
|
|
|
import { ActionLogger, genDateRange, DBUtils, LockUtils } from './utils';
|
|
|
|
import { ActionLogger, genDateRange, DBUtils, LockUtils } from './utils';
|
|
|
|
import { ResourceLockedError } from '../../errors/ResourceLockedError';
|
|
|
|
import { ResourceLockedError } from '../../errors/ResourceLockedError';
|
|
|
|
|
|
|
|
import { NotFoundError } from '../../errors/NotFoundError';
|
|
|
|
|
|
|
|
|
|
|
|
export class LendingStationAPI extends DataSource {
|
|
|
|
export class LendingStationAPI extends DataSource {
|
|
|
|
connection : Connection
|
|
|
|
connection : Connection
|
|
|
@ -247,7 +248,7 @@ export class LendingStationAPI extends DataSource {
|
|
|
|
.set({ ...timeFrame })
|
|
|
|
.set({ ...timeFrame })
|
|
|
|
.where('id = :id', { id: timeFrame.id })
|
|
|
|
.where('id = :id', { id: timeFrame.id })
|
|
|
|
.execute()
|
|
|
|
.execute()
|
|
|
|
.then(value => { if (value.affected !== 1) { throw new UserInputError('ID not found'); } });
|
|
|
|
.then(value => { if (value.affected !== 1) { throw new NotFoundError('TimeFrame', 'id', timeFrame.id); } });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
!keepLock && await this.unlockTimeFrame(timeFrame.id, userId);
|
|
|
|
!keepLock && await this.unlockTimeFrame(timeFrame.id, userId);
|
|
|
|
return this.timeFrameById(timeFrame.id);
|
|
|
|
return this.timeFrameById(timeFrame.id);
|
|
|
|