diff --git a/src/datasources/db/providerAPI.ts b/src/datasources/db/providerAPI.ts index dacece9..a72266c 100644 --- a/src/datasources/db/providerAPI.ts +++ b/src/datasources/db/providerAPI.ts @@ -145,6 +145,14 @@ export class ProviderAPI extends DataSource { } async updateProvider (provider: any, userId: number) { + // make sure that a provider cannot have both organisation and person at the same time + if (provider.privatePersonId && provider.organisationId) { return new UserInputError('Provider must have either privatePersonId or organisationId'); } + if (provider.privatePersonId) { + provider.organisationId = null; + } else if (provider.organisationId) { + provider.privatePersonId = null; + } + const keepLock = provider.keepLock; delete provider.keepLock; const cargoBikes = provider.cargoBikeIds; diff --git a/src/model/Provider.ts b/src/model/Provider.ts index c366be8..11e9b6e 100644 --- a/src/model/Provider.ts +++ b/src/model/Provider.ts @@ -52,7 +52,7 @@ export class Provider implements Lockable { id: number; @Column({ - nullable: false + nullable: true }) formName: String; diff --git a/src/resolvers/participantResolvers.ts b/src/resolvers/participantResolvers.ts index 456ee12..f79b572 100644 --- a/src/resolvers/participantResolvers.ts +++ b/src/resolvers/participantResolvers.ts @@ -88,6 +88,9 @@ export default { throw new PermissionError(); } }, + distributedActiveBikeParte: () => { + return false; + }, isLockedByMe: (parent: any, __: any, { req }: { req: any }) => isLockedByMe(parent, { req }), isLocked: (parent: any, __: any, { req }: { req: any }) => isLocked(parent, { req }) }, diff --git a/src/schema/type-defs.ts b/src/schema/type-defs.ts index 768b457..535fb61 100644 --- a/src/schema/type-defs.ts +++ b/src/schema/type-defs.ts @@ -422,6 +422,7 @@ export default gql` This value is calculated form other values. It is true, if the person is not on the black list and not retired and is either Mentor dt. Pate or Partner Mentor dt. Partnerpate for at least one bike. + Note: this will always be false for the moment. """ distributedActiveBikeParte: Boolean! engagement: [Engagement]