From 8ecd7a634bc44d74ab65cfe1a3bf7cabd8d96655 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Fri, 17 Sep 2021 13:36:13 +0200 Subject: [PATCH] add publisher id to backend --- backend/src/graphql/inputs/LoginUserInput.ts | 3 +++ backend/src/graphql/models/User.ts | 10 +++++----- backend/src/graphql/resolvers/UserResolver.ts | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/backend/src/graphql/inputs/LoginUserInput.ts b/backend/src/graphql/inputs/LoginUserInput.ts index 4a60d00e1..bafa6a851 100644 --- a/backend/src/graphql/inputs/LoginUserInput.ts +++ b/backend/src/graphql/inputs/LoginUserInput.ts @@ -59,6 +59,9 @@ export class UpdateUserInfosArgs { @Field({ nullable: true }) language?: string + @Field({ nullable: true }) + publisherId?: number + @Field({ nullable: true }) password?: string diff --git a/backend/src/graphql/models/User.ts b/backend/src/graphql/models/User.ts index ca7ed9cf2..cfcb8370a 100644 --- a/backend/src/graphql/models/User.ts +++ b/backend/src/graphql/models/User.ts @@ -17,6 +17,7 @@ export class User { this.username = json.username this.description = json.description this.language = json.language + this.publisherId = json.publisher_id } @Field(() => String) @@ -60,11 +61,10 @@ export class User { /* I suggest to have a group as type here @Field(() => ID) groupId: number - - // what is puvlisherId? - @Field(() => ID) - publisherId: number - */ +*/ + // what is publisherId? + @Field(() => Number) + publisherId: number @Field(() => KlickTipp) klickTipp: KlickTipp diff --git a/backend/src/graphql/resolvers/UserResolver.ts b/backend/src/graphql/resolvers/UserResolver.ts index c95af2eae..fe9194163 100644 --- a/backend/src/graphql/resolvers/UserResolver.ts +++ b/backend/src/graphql/resolvers/UserResolver.ts @@ -78,6 +78,7 @@ export class UserResolver { emailType: 2, login_after_register: true, language: language, + publisher_id: 0 } const result = await apiPost(CONFIG.LOGIN_API_URL + 'createUser', payload) if (!result.success) { @@ -131,6 +132,7 @@ export class UserResolver { description, username, language, + publisherId, password, passwordNew, }: UpdateUserInfosArgs, @@ -145,6 +147,7 @@ export class UserResolver { 'User.description': description || undefined, 'User.username': username || undefined, 'User.language': language || undefined, + 'User.publisher_id' : publisherId || undefined, 'User.password': passwordNew || undefined, 'User.password_old': password || undefined, },