From 65f74ddb70a7d439b8ec5c4126570214359f0319 Mon Sep 17 00:00:00 2001 From: KaleidoScope <121512095+Shubh152@users.noreply.github.com> Date: Mon, 12 Feb 2024 16:10:49 +0530 Subject: [PATCH 1/3] fix User Update Profile --- schema.graphql | 2 ++ src/resolvers/Mutation/updateUserProfile.ts | 12 +++++++++--- src/typeDefs/inputs.ts | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/schema.graphql b/schema.graphql index 19d7ad4b4d..56d32f0c1a 100644 --- a/schema.graphql +++ b/schema.graphql @@ -993,6 +993,8 @@ input UpdateOrganizationInput { } input UpdateUserInput { + id: ID + applangcode : String address: AddressInput birthDate: Date educationGrade: EducationGrade diff --git a/src/resolvers/Mutation/updateUserProfile.ts b/src/resolvers/Mutation/updateUserProfile.ts index d63d6821a5..8ebf5946ff 100644 --- a/src/resolvers/Mutation/updateUserProfile.ts +++ b/src/resolvers/Mutation/updateUserProfile.ts @@ -110,6 +110,9 @@ export const updateUserProfile: MutationResolvers["updateUserProfile"] = async ( maritalStatus: args.data?.maritalStatus ? args.data.maritalStatus : currentUser?.maritalStatus, + appLanguageCode: args.data?.applangcode + ? args.data.applangcode + : currentUser?.appLanguageCode, phone: { home: args.data?.phone?.home ? args.data?.phone?.home @@ -128,9 +131,12 @@ export const updateUserProfile: MutationResolvers["updateUserProfile"] = async ( runValidators: true, } ).lean(); - updatedUser!.image = updatedUser?.image - ? `${context.apiRootUrl}${updatedUser?.image}` - : null; + + if (updatedUser != null) { + updatedUser.image = updatedUser?.image + ? `${context.apiRootUrl}${updatedUser?.image}` + : null; + } return updatedUser ?? ({} as InterfaceUser); }; diff --git a/src/typeDefs/inputs.ts b/src/typeDefs/inputs.ts index d0bdd94af4..214e767716 100644 --- a/src/typeDefs/inputs.ts +++ b/src/typeDefs/inputs.ts @@ -334,6 +334,8 @@ export const inputs = gql` } input UpdateUserInput { + id: ID + applangcode: String address: AddressInput birthDate: Date educationGrade: EducationGrade From c4475c250b6551972e9828dcbda4271e9674c5b3 Mon Sep 17 00:00:00 2001 From: KaleidoScope <121512095+Shubh152@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:55:51 +0530 Subject: [PATCH 2/3] fix review changes --- schema.graphql | 2 -- src/resolvers/Mutation/updateUserProfile.ts | 4 ++-- src/typeDefs/inputs.ts | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/schema.graphql b/schema.graphql index 56d32f0c1a..19d7ad4b4d 100644 --- a/schema.graphql +++ b/schema.graphql @@ -993,8 +993,6 @@ input UpdateOrganizationInput { } input UpdateUserInput { - id: ID - applangcode : String address: AddressInput birthDate: Date educationGrade: EducationGrade diff --git a/src/resolvers/Mutation/updateUserProfile.ts b/src/resolvers/Mutation/updateUserProfile.ts index 8ebf5946ff..797fb0315d 100644 --- a/src/resolvers/Mutation/updateUserProfile.ts +++ b/src/resolvers/Mutation/updateUserProfile.ts @@ -110,8 +110,8 @@ export const updateUserProfile: MutationResolvers["updateUserProfile"] = async ( maritalStatus: args.data?.maritalStatus ? args.data.maritalStatus : currentUser?.maritalStatus, - appLanguageCode: args.data?.applangcode - ? args.data.applangcode + appLanguageCode: args.data?.appLanguageCode + ? args.data.appLanguageCode : currentUser?.appLanguageCode, phone: { home: args.data?.phone?.home diff --git a/src/typeDefs/inputs.ts b/src/typeDefs/inputs.ts index 214e767716..b3c9f42a52 100644 --- a/src/typeDefs/inputs.ts +++ b/src/typeDefs/inputs.ts @@ -335,7 +335,7 @@ export const inputs = gql` input UpdateUserInput { id: ID - applangcode: String + appLanguageCode: String address: AddressInput birthDate: Date educationGrade: EducationGrade From 01b41ae527781eb5f6d01ef3fed4190c667c1149 Mon Sep 17 00:00:00 2001 From: KaleidoScope <121512095+Shubh152@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:58:47 +0530 Subject: [PATCH 3/3] Update inputs.ts --- src/typeDefs/inputs.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/typeDefs/inputs.ts b/src/typeDefs/inputs.ts index b3c9f42a52..cb02c7412f 100644 --- a/src/typeDefs/inputs.ts +++ b/src/typeDefs/inputs.ts @@ -334,7 +334,6 @@ export const inputs = gql` } input UpdateUserInput { - id: ID appLanguageCode: String address: AddressInput birthDate: Date