Merge pull request #30 from fLotte-meets-HWR-DB/develop

Develop
pull/31/head^2
Trivernis 4 years ago committed by GitHub
commit 52ad02ef5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

1250
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -15,17 +15,17 @@
"devDependencies": { "devDependencies": {
"@types/crc": "^3.4.0", "@types/crc": "^3.4.0",
"@types/mocha-steps": "^1.3.0", "@types/mocha-steps": "^1.3.0",
"@types/node": "^14.10.0", "@types/node": "^14.14.10",
"@typescript-eslint/eslint-plugin": "^4.1.0", "@typescript-eslint/eslint-plugin": "^4.9.0",
"@typescript-eslint/parser": "^4.1.0", "@typescript-eslint/parser": "^4.9.0",
"chai": "^4.2.0", "chai": "^4.2.0",
"delete": "^1.1.0", "delete": "^1.1.0",
"eslint": "^7.8.1", "eslint": "^7.14.0",
"eslint-config-standard": "^14.1.1", "eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.0", "eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1", "eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1", "eslint-plugin-standard": "^4.1.0",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-eslint": "^6.0.0", "gulp-eslint": "^6.0.0",
"gulp-nodemon": "^2.5.0", "gulp-nodemon": "^2.5.0",
@ -33,14 +33,14 @@
"mocha": "^8.2.1", "mocha": "^8.2.1",
"mocha-steps": "^1.3.0", "mocha-steps": "^1.3.0",
"nyc": "^15.1.0", "nyc": "^15.1.0",
"ts-node": "^9.0.0", "ts-node": "^9.1.0",
"typescript": "^4.0.2" "typescript": "^4.1.2"
}, },
"dependencies": { "dependencies": {
"@types/chai": "^4.2.14", "@types/chai": "^4.2.14",
"@types/chai-http": "^4.2.0", "@types/chai-http": "^4.2.0",
"@types/mocha": "^8.0.4", "@types/mocha": "^8.0.4",
"apollo-server-express": "^2.17.0", "apollo-server-express": "^2.19.0",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"chai-http": "^4.3.0", "chai-http": "^4.3.0",
"cors": "^2.8.5", "cors": "^2.8.5",
@ -48,11 +48,11 @@
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"express": "^4.17.1", "express": "^4.17.1",
"express-cors": "0.0.3", "express-cors": "0.0.3",
"graphql": "^15.3.0", "graphql": "^15.4.0",
"messagepack": "^1.1.12", "messagepack": "^1.1.12",
"pg": "^8.3.3", "pg": "^8.5.1",
"promise-socket": "^7.0.0", "promise-socket": "^7.0.0",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"typeorm": "^0.2.26" "typeorm": "^0.2.29"
} }
} }

@ -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);

@ -179,15 +179,17 @@ export class ProviderAPI extends DataSource {
} }
async createOrganisation (organisation: any) { async createOrganisation (organisation: any) {
let inserts: any = null; let createdOrganisation: any = null;
await this.connection.transaction(async (entityManager: EntityManager) => { await this.connection.transaction(async (entityManager: EntityManager) => {
inserts = await entityManager.getRepository(Organisation) const result = await entityManager.getRepository(Organisation)
.createQueryBuilder('o') .createQueryBuilder('o')
.insert() .insert()
.values([organisation]) .values([organisation])
.execute(); .execute();
createdOrganisation = await entityManager.getRepository(Organisation).findOne(result.identifiers[0].id);
}); });
return inserts.generatedMaps[0];
return createdOrganisation;
} }
async lockOrganisation (id: number, userId: number) { async lockOrganisation (id: number, userId: number) {

@ -840,7 +840,7 @@ export default gql`
address: AddressCreateInput! address: AddressCreateInput!
name: String! name: String!
"registration number of association" "registration number of association"
associationNo: String! associationNo: String
"If Club, at what court registered" "If Club, at what court registered"
registeredAt: String registeredAt: String
contactInformationId: ID contactInformationId: ID

Loading…
Cancel
Save