From c1c5af43a606050e004281fc269a46af8b4d63bf Mon Sep 17 00:00:00 2001 From: Hazem Krimi Date: Tue, 18 May 2021 22:38:21 +0100 Subject: [PATCH] Update graphql types and mutations --- src/graphql/admin.api.ts | 20 +- src/graphql/auth.api.ts | 20 +- src/graphql/state.ts | 4 +- src/graphql/types.ts | 638 +++++++++++++++++------- src/pages/Auth/AdditionalInfo/index.tsx | 15 +- src/pages/CreateUser/index.tsx | 2 +- src/pages/Settings/index.tsx | 15 +- src/pages/UserSettings/index.tsx | 19 +- src/pages/Users/index.tsx | 6 +- 9 files changed, 505 insertions(+), 234 deletions(-) diff --git a/src/graphql/admin.api.ts b/src/graphql/admin.api.ts index 822989f..c74b14c 100644 --- a/src/graphql/admin.api.ts +++ b/src/graphql/admin.api.ts @@ -45,24 +45,8 @@ export const GET_USER_BY_ID = gql` `; export const CREATE_USER = gql` - mutation CreateUser( - $email: String! - $password: String! - $firstName: String! - $lastName: String! - $phone: PhoneInputModel! - $address: AddressInputModel! - $role: Role! - ) { - createUser( - email: $email - password: $password - firstName: $firstName - lastName: $lastName - phone: $phone - address: $address - role: $role - ) { + mutation CreateUser($user: UserInput!) { + createUser(user: $user) { id email firstName diff --git a/src/graphql/auth.api.ts b/src/graphql/auth.api.ts index ab47eaa..01ccc84 100644 --- a/src/graphql/auth.api.ts +++ b/src/graphql/auth.api.ts @@ -95,22 +95,8 @@ export const CONFIRM_USER_RESET_PASSWORD = gql` `; export const UPDATE_USER_INFO = gql` - mutation UpdateUserInfo( - $id: String! - $email: String! - $firstName: String! - $lastName: String! - $phone: PhoneInputModel! - $address: AddressInputModel! - ) { - updateUserInfo( - id: $id - email: $email - firstName: $firstName - lastName: $lastName - phone: $phone - address: $address - ) { + mutation UpdateUserInfo($user: UpdateUserInput!) { + updateUserInfo(user: $user) { id email firstName @@ -131,7 +117,7 @@ export const UPDATE_USER_INFO = gql` `; export const UPDATE_USER_PASSWORD = gql` - mutation UpdateUserPassword($id: String!, $password: PasswordInputModel!) { + mutation UpdateUserPassword($id: String!, $password: PasswordInput!) { updateUserPassword(id: $id, password: $password) { id email diff --git a/src/graphql/state.ts b/src/graphql/state.ts index baaed62..5c82426 100644 --- a/src/graphql/state.ts +++ b/src/graphql/state.ts @@ -1,5 +1,5 @@ import { makeVar } from '@apollo/client'; -import { UserResponseModel } from './types'; +import { UserOutput } from './types'; export const tokenVar = makeVar(undefined); @@ -7,4 +7,4 @@ export const roleVar = makeVar< 'client' | 'productOwner' | 'developer' | 'admin' | undefined >(undefined); -export const userVar = makeVar(undefined); +export const userVar = makeVar(undefined); diff --git a/src/graphql/types.ts b/src/graphql/types.ts index 46e76ff..8c23771 100644 --- a/src/graphql/types.ts +++ b/src/graphql/types.ts @@ -12,43 +12,92 @@ export type Scalars = { }; -export type AddressInputModel = { +export type AddressInput = { place: Scalars['String']; city: Scalars['String']; zip: Scalars['String']; country: Scalars['String']; }; -export type AddressModel = { - __typename?: 'AddressModel'; +export type AddressOutput = { + __typename?: 'AddressOutput'; place: Scalars['String']; city: Scalars['String']; zip: Scalars['String']; country: Scalars['String']; }; -export type AuthResponseModel = { - __typename?: 'AuthResponseModel'; - user: UserResponseModel; - token: Scalars['String']; +export type CategoryInput = { + name: Scalars['String']; + description: Scalars['String']; + image: InputFile; }; -export type CategoryResponseModel = { - __typename?: 'CategoryResponseModel'; +export type CategoryOutput = { + __typename?: 'CategoryOutput'; id: Scalars['String']; name: Scalars['String']; description: Scalars['String']; image: File; }; +export type ConnectionsInput = { + to: Scalars['String']; + releations: RelationsInput; +}; + +export type ConnectionsOutput = { + __typename?: 'ConnectionsOutput'; + to: Scalars['String']; + releations: RelationsOutput; +}; + export type CountryPrefixModel = { __typename?: 'CountryPrefixModel'; country: Scalars['String']; prefix: Scalars['String']; }; -export type FeatureResponseModel = { - __typename?: 'FeatureResponseModel'; +export type DelivrableInput = { + specification: Scalars['Boolean']; + fullBuild: Scalars['Boolean']; + mvp: Scalars['Boolean']; + design: Scalars['Boolean']; +}; + +export type DelivrableOutput = { + __typename?: 'DelivrableOutput'; + specification: File; + fullBuild: Scalars['String']; + mvp: File; + design: File; +}; + +export type DevtimeInput = { + months: Scalars['Int']; + days: Scalars['Int']; + hours: Scalars['Int']; +}; + +export type DevtimeOutput = { + __typename?: 'DevtimeOutput'; + months: Scalars['Int']; + days: Scalars['Int']; + hours: Scalars['Int']; +}; + +export type FeatureInput = { + name: Scalars['String']; + description: Scalars['String']; + featureType: Scalars['String']; + image: InputFile; + wireframes?: Maybe>; + price: Scalars['Float']; + repo: Scalars['String']; +}; + +export type FeatureOutput = { + __typename?: 'FeatureOutput'; id: Scalars['String']; name: Scalars['String']; description: Scalars['String']; @@ -72,12 +121,9 @@ export type FileWithOutOId = { src: Scalars['String']; }; -export type Introduction = { - __typename?: 'Introduction'; - purpose: Scalars['String']; - documentConventions: Scalars['String']; - intendedAudience: Scalars['String']; - projectScope: Scalars['String']; +export type InputFile = { + name: Scalars['String']; + src: Scalars['String']; }; export type IntroductionInput = { @@ -87,21 +133,43 @@ export type IntroductionInput = { projectScope: Scalars['String']; }; +export type IntroductionOutput = { + __typename?: 'IntroductionOutput'; + purpose: Scalars['String']; + documentConventions: Scalars['String']; + intendedAudience: Scalars['String']; + projectScope: Scalars['String']; +}; + export type MutationRoot = { __typename?: 'MutationRoot'; - signup: AuthResponseModel; - createUser: UserResponseModel; - login: AuthResponseModel; - deleteUser: UserResponseModel; - updateUserInfo: UserResponseModel; - updateUserPassword: UserResponseModel; - resetUserPassword: UserResponseModel; - confirmUserResetPassword: UserResponseModel; - deleteCategory: CategoryResponseModel; - deleteFeature: FeatureResponseModel; - deleteTemplate: TemplateModel; - updateTemplateFeature: TemplateResponseModel; - addTemplateSpecification: TemplateResponseModel; + signup: UserAuthenticationOutput; + createUser: UserOutput; + login: UserAuthenticationOutput; + deleteUser: UserOutput; + updateUserInfo: UserOutput; + updateUserPassword: UserOutput; + resetUserPassword: UserOutput; + confirmUserResetPassword: UserOutput; + deleteCategory: CategoryOutput; + deleteFeature: FeatureOutput; + deleteTemplate: TemplateDefactoredOutput; + updateTemplateFeature: TemplateOutput; + addTemplateSpecification: TemplateOutput; + addCategory: CategoryOutput; + updateCategory: CategoryOutput; + addFeature: FeatureOutput; + updateFeature: FeatureOutput; + deleteFeatureWireframe: FeatureOutput; + addFeatureWireframes: FeatureOutput; + addTemplate: TemplateOutput; + updateTemplate: TemplateOutput; + addPrototype: TemplateProtoTypeOutput; + updatePrototype: TemplateProtoTypeOutput; + addProject: ProjectOutput; + changeProjectState: ProjectOutput; + updateProject: ProjectOutput; + addProjectProposal: ProjectOutput; }; @@ -112,13 +180,7 @@ export type MutationRootSignupArgs = { export type MutationRootCreateUserArgs = { - email: Scalars['String']; - password: Scalars['String']; - firstName: Scalars['String']; - lastName: Scalars['String']; - phone: PhoneInputModel; - address: AddressInputModel; - role: Role; + user: UserInput; }; @@ -135,18 +197,13 @@ export type MutationRootDeleteUserArgs = { export type MutationRootUpdateUserInfoArgs = { - id: Scalars['String']; - firstName: Scalars['String']; - lastName: Scalars['String']; - email: Scalars['String']; - phone: PhoneInputModel; - address: AddressInputModel; + user: UpdateUserInput; }; export type MutationRootUpdateUserPasswordArgs = { id: Scalars['String']; - password: PasswordInputModel; + password: PasswordInput; }; @@ -187,12 +244,83 @@ export type MutationRootAddTemplateSpecificationArgs = { specification: SpecificationInput; }; -export type NonFunctionalRequirements = { - __typename?: 'NonFunctionalRequirements'; - performanceRequirements: Scalars['String']; - safetyRequirements: Scalars['String']; - securityRequirements: Scalars['String']; - softwareQualityAttributes: Scalars['String']; + +export type MutationRootAddCategoryArgs = { + category: CategoryInput; +}; + + +export type MutationRootUpdateCategoryArgs = { + id: Scalars['String']; + category: CategoryInput; +}; + + +export type MutationRootAddFeatureArgs = { + feature: FeatureInput; +}; + + +export type MutationRootUpdateFeatureArgs = { + id: Scalars['String']; + feature: FeatureInput; +}; + + +export type MutationRootDeleteFeatureWireframeArgs = { + id: Scalars['String']; +}; + + +export type MutationRootAddFeatureWireframesArgs = { + id: Scalars['String']; + wireframes: Array; +}; + + +export type MutationRootAddTemplateArgs = { + template: TemplateInput; +}; + + +export type MutationRootUpdateTemplateArgs = { + id: Scalars['String']; + template: TemplateUpdateInput; + specification?: Maybe; +}; + + +export type MutationRootAddPrototypeArgs = { + prototype: TemplateProtoTypeInput; +}; + + +export type MutationRootUpdatePrototypeArgs = { + prototype: TemplateProtoTypeInput; +}; + + +export type MutationRootAddProjectArgs = { + project: ProjectInput; +}; + + +export type MutationRootChangeProjectStateArgs = { + id: Scalars['String']; + state: State; +}; + + +export type MutationRootUpdateProjectArgs = { + id: Scalars['String']; + name: Scalars['String']; + image: InputFile; +}; + + +export type MutationRootAddProjectProposalArgs = { + id: Scalars['String']; + proposal: ProposalInput; }; export type NonFunctionalRequirementsInput = { @@ -202,14 +330,12 @@ export type NonFunctionalRequirementsInput = { softwareQualityAttributes: Scalars['String']; }; -export type OverallDescription = { - __typename?: 'OverallDescription'; - perspective: Scalars['String']; - userCharacteristics: Scalars['String']; - operatingEnvironment: Scalars['String']; - designImplementationConstraints: Scalars['String']; - userDocumentation: Scalars['String']; - assemptionsDependencies: Scalars['String']; +export type NonFunctionalRequirementsOutput = { + __typename?: 'NonFunctionalRequirementsOutput'; + performanceRequirements: Scalars['String']; + safetyRequirements: Scalars['String']; + securityRequirements: Scalars['String']; + softwareQualityAttributes: Scalars['String']; }; export type OverallDescriptionInput = { @@ -221,32 +347,113 @@ export type OverallDescriptionInput = { assemptionsDependencies: Scalars['String']; }; -export type PasswordInputModel = { +export type OverallDescriptionOutput = { + __typename?: 'OverallDescriptionOutput'; + perspective: Scalars['String']; + userCharacteristics: Scalars['String']; + operatingEnvironment: Scalars['String']; + designImplementationConstraints: Scalars['String']; + userDocumentation: Scalars['String']; + assemptionsDependencies: Scalars['String']; +}; + +export type PasswordInput = { oldPassword: Scalars['String']; newPassword: Scalars['String']; }; -export type PhoneInputModel = { +export type PaymentOptionInput = { + optOne: Scalars['Int']; + optTwo: Scalars['Int']; + optThree: Scalars['Int']; +}; + +export type PaymentOptionOutput = { + __typename?: 'PaymentOptionOutput'; + optOne: Scalars['Int']; + optTwo: Scalars['Int']; + optThree: Scalars['Int']; +}; + +export type PhoneInput = { prefix: Scalars['String']; number: Scalars['String']; }; -export type PhoneModel = { - __typename?: 'PhoneModel'; +export type PhoneOutput = { + __typename?: 'PhoneOutput'; prefix: Scalars['String']; number: Scalars['String']; }; +export type ProjectInput = { + clientId: Scalars['String']; + name: Scalars['String']; + image: InputFile; + platforms: Array; + template: Scalars['String']; + features: Array; + paymentOption: PaymentOptionInput; + delivrable?: Maybe; + totalPrice: Scalars['Float']; +}; + +export type ProjectOutput = { + __typename?: 'ProjectOutput'; + id: Scalars['String']; + clientId: Scalars['String']; + name: Scalars['String']; + image: File; + platforms: Array; + template: TemplateOutput; + features: Array; + state: Scalars['String']; + proposal?: Maybe; + paymentOption: PaymentOptionOutput; + delivrable?: Maybe; + totalPrice: Scalars['Float']; +}; + +export type ProposalInput = { + devtime: DevtimeInput; + summary: Scalars['String']; + purpose: Scalars['String']; + resources: Array; +}; + +export type ProposalOutput = { + __typename?: 'ProposalOutput'; + devtime: DevtimeOutput; + summary: Scalars['String']; + purpose: Scalars['String']; + resources: Array; +}; + +export type ProtoTypeInput = { + featureId: Scalars['String']; + connections: Array; +}; + +export type ProtoTypeOutput = { + __typename?: 'ProtoTypeOutput'; + feature: FeatureOutput; + connections: Array; +}; + export type QueryRoot = { __typename?: 'QueryRoot'; - getAllUsers: Array; - getUserById: UserResponseModel; - getCategoryById: CategoryResponseModel; - getFeatureById: FeatureResponseModel; - getTemplateById: TemplateResponseModel; - getAllCategories: Array; - getAllFeatures: Array; - getAllTemplates: Array; + getAllUsers: Array; + getUserById: UserOutput; + getCategoryById: CategoryOutput; + getFeatureById: FeatureOutput; + getPrototypeById: TemplateProtoTypeOutput; + getTemplateById: TemplateOutput; + getProjectById: ProjectOutput; + getAllProjectsByClientId: Array; + getAllCategories: Array; + getAllFeatures: Array; + getAllTemplates: Array; + getAllTemplatesByCategoriesId: Array; getCountryCode: Array; }; @@ -266,25 +473,50 @@ export type QueryRootGetFeatureByIdArgs = { }; +export type QueryRootGetPrototypeByIdArgs = { + id: Scalars['String']; +}; + + export type QueryRootGetTemplateByIdArgs = { id: Scalars['String']; }; -export type Role = - | 'Admin' - | 'Client' - | 'ProductOwner' - | 'Developer'; -export type Specification = { - __typename?: 'Specification'; - introduction: Introduction; - overallDescription: OverallDescription; - nonFunctionalRequirements: NonFunctionalRequirements; - otherRequirements: Scalars['String']; - glossary: Scalars['String']; - analysisModels: Scalars['String']; - issuesList: Scalars['String']; +export type QueryRootGetProjectByIdArgs = { + id: Scalars['String']; +}; + + +export type QueryRootGetAllProjectsByClientIdArgs = { + id: Scalars['String']; +}; + + +export type QueryRootGetAllTemplatesByCategoriesIdArgs = { + categoires: Array; +}; + +export type RelationsInput = { + back: Scalars['Boolean']; + forword: Scalars['Boolean']; +}; + +export type RelationsOutput = { + __typename?: 'RelationsOutput'; + back: Scalars['Boolean']; + forword: Scalars['Boolean']; +}; + +export type ResourceInput = { + resourceType: Scalars['String']; + developers: Scalars['Int']; +}; + +export type ResourceOutput = { + __typename?: 'ResourceOutput'; + resourceType: Scalars['String']; + developers: Scalars['Int']; }; export type SpecificationInput = { @@ -297,36 +529,107 @@ export type SpecificationInput = { issuesList: Scalars['String']; }; -export type TemplateModel = { - __typename?: 'TemplateModel'; +export type SpecificationOutput = { + __typename?: 'SpecificationOutput'; + introduction: IntroductionOutput; + overallDescription: OverallDescriptionOutput; + nonFunctionalRequirements: NonFunctionalRequirementsOutput; + otherRequirements: Scalars['String']; + glossary: Scalars['String']; + analysisModels: Scalars['String']; + issuesList: Scalars['String']; +}; + +export type State = + | 'Approved' + | 'Declined' + | 'OnReview' + | 'Archived'; + +export type TemplateDefactoredOutput = { + __typename?: 'TemplateDefactoredOutput'; id: Scalars['String']; name: Scalars['String']; description: Scalars['String']; category: Scalars['String']; features?: Maybe>; image: File; - specification?: Maybe; + specification?: Maybe; }; -export type TemplateResponseModel = { - __typename?: 'TemplateResponseModel'; +export type TemplateInput = { + name: Scalars['String']; + description: Scalars['String']; + category: Scalars['String']; + image: InputFile; +}; + +export type TemplateOutput = { + __typename?: 'TemplateOutput'; id: Scalars['String']; name: Scalars['String']; description: Scalars['String']; category: Scalars['String']; - features?: Maybe>; + features?: Maybe>; image: File; - specification?: Maybe; + specification?: Maybe; }; -export type UserResponseModel = { - __typename?: 'UserResponseModel'; +export type TemplateProtoTypeInput = { + templateId: Scalars['String']; + prototype: Array; +}; + +export type TemplateProtoTypeOutput = { + __typename?: 'TemplateProtoTypeOutput'; + id: Scalars['String']; + template: Scalars['String']; + prototype: Array; +}; + +export type TemplateUpdateInput = { + name: Scalars['String']; + description: Scalars['String']; + category: Scalars['String']; + features?: Maybe>; + image: InputFile; + specification?: Maybe; +}; + +export type UpdateUserInput = { id: Scalars['String']; email: Scalars['String']; firstName: Scalars['String']; lastName: Scalars['String']; - phone: PhoneModel; - address: AddressModel; + phone: PhoneInput; + address: AddressInput; + role: Scalars['String']; +}; + +export type UserAuthenticationOutput = { + __typename?: 'UserAuthenticationOutput'; + user: UserOutput; + token: Scalars['String']; +}; + +export type UserInput = { + email: Scalars['String']; + password: Scalars['String']; + firstName: Scalars['String']; + lastName: Scalars['String']; + phone: PhoneInput; + address: AddressInput; + role: Scalars['String']; +}; + +export type UserOutput = { + __typename?: 'UserOutput'; + id: Scalars['String']; + email: Scalars['String']; + firstName: Scalars['String']; + lastName: Scalars['String']; + phone: PhoneOutput; + address: AddressOutput; role: Scalars['String']; }; @@ -336,14 +639,14 @@ export type GetAllUsersQueryVariables = Exact<{ [key: string]: never; }>; export type GetAllUsersQuery = ( { __typename?: 'QueryRoot' } & { getAllUsers: Array<( - { __typename?: 'UserResponseModel' } - & Pick + { __typename?: 'UserOutput' } + & Pick & { phone: ( - { __typename?: 'PhoneModel' } - & Pick + { __typename?: 'PhoneOutput' } + & Pick ), address: ( - { __typename?: 'AddressModel' } - & Pick + { __typename?: 'AddressOutput' } + & Pick ) } )> } ); @@ -356,40 +659,34 @@ export type GetUserByIdQueryVariables = Exact<{ export type GetUserByIdQuery = ( { __typename?: 'QueryRoot' } & { getUserById: ( - { __typename?: 'UserResponseModel' } - & Pick + { __typename?: 'UserOutput' } + & Pick & { phone: ( - { __typename?: 'PhoneModel' } - & Pick + { __typename?: 'PhoneOutput' } + & Pick ), address: ( - { __typename?: 'AddressModel' } - & Pick + { __typename?: 'AddressOutput' } + & Pick ) } ) } ); export type CreateUserMutationVariables = Exact<{ - email: Scalars['String']; - password: Scalars['String']; - firstName: Scalars['String']; - lastName: Scalars['String']; - phone: PhoneInputModel; - address: AddressInputModel; - role: Role; + user: UserInput; }>; export type CreateUserMutation = ( { __typename?: 'MutationRoot' } & { createUser: ( - { __typename?: 'UserResponseModel' } - & Pick + { __typename?: 'UserOutput' } + & Pick & { phone: ( - { __typename?: 'PhoneModel' } - & Pick + { __typename?: 'PhoneOutput' } + & Pick ), address: ( - { __typename?: 'AddressModel' } - & Pick + { __typename?: 'AddressOutput' } + & Pick ) } ) } ); @@ -403,17 +700,17 @@ export type SignupMutationVariables = Exact<{ export type SignupMutation = ( { __typename?: 'MutationRoot' } & { signup: ( - { __typename?: 'AuthResponseModel' } - & Pick + { __typename?: 'UserAuthenticationOutput' } + & Pick & { user: ( - { __typename?: 'UserResponseModel' } - & Pick + { __typename?: 'UserOutput' } + & Pick & { phone: ( - { __typename?: 'PhoneModel' } - & Pick + { __typename?: 'PhoneOutput' } + & Pick ), address: ( - { __typename?: 'AddressModel' } - & Pick + { __typename?: 'AddressOutput' } + & Pick ) } ) } ) } @@ -428,17 +725,17 @@ export type LoginMutationVariables = Exact<{ export type LoginMutation = ( { __typename?: 'MutationRoot' } & { login: ( - { __typename?: 'AuthResponseModel' } - & Pick + { __typename?: 'UserAuthenticationOutput' } + & Pick & { user: ( - { __typename?: 'UserResponseModel' } - & Pick + { __typename?: 'UserOutput' } + & Pick & { phone: ( - { __typename?: 'PhoneModel' } - & Pick + { __typename?: 'PhoneOutput' } + & Pick ), address: ( - { __typename?: 'AddressModel' } - & Pick + { __typename?: 'AddressOutput' } + & Pick ) } ) } ) } @@ -452,14 +749,14 @@ export type ResetPasswordMutationVariables = Exact<{ export type ResetPasswordMutation = ( { __typename?: 'MutationRoot' } & { resetUserPassword: ( - { __typename?: 'UserResponseModel' } - & Pick + { __typename?: 'UserOutput' } + & Pick & { phone: ( - { __typename?: 'PhoneModel' } - & Pick + { __typename?: 'PhoneOutput' } + & Pick ), address: ( - { __typename?: 'AddressModel' } - & Pick + { __typename?: 'AddressOutput' } + & Pick ) } ) } ); @@ -473,60 +770,55 @@ export type ConfirmUserResetPasswordMutationVariables = Exact<{ export type ConfirmUserResetPasswordMutation = ( { __typename?: 'MutationRoot' } & { confirmUserResetPassword: ( - { __typename?: 'UserResponseModel' } - & Pick + { __typename?: 'UserOutput' } + & Pick & { phone: ( - { __typename?: 'PhoneModel' } - & Pick + { __typename?: 'PhoneOutput' } + & Pick ), address: ( - { __typename?: 'AddressModel' } - & Pick + { __typename?: 'AddressOutput' } + & Pick ) } ) } ); export type UpdateUserInfoMutationVariables = Exact<{ - id: Scalars['String']; - email: Scalars['String']; - firstName: Scalars['String']; - lastName: Scalars['String']; - phone: PhoneInputModel; - address: AddressInputModel; + user: UpdateUserInput; }>; export type UpdateUserInfoMutation = ( { __typename?: 'MutationRoot' } & { updateUserInfo: ( - { __typename?: 'UserResponseModel' } - & Pick + { __typename?: 'UserOutput' } + & Pick & { phone: ( - { __typename?: 'PhoneModel' } - & Pick + { __typename?: 'PhoneOutput' } + & Pick ), address: ( - { __typename?: 'AddressModel' } - & Pick + { __typename?: 'AddressOutput' } + & Pick ) } ) } ); export type UpdateUserPasswordMutationVariables = Exact<{ id: Scalars['String']; - password: PasswordInputModel; + password: PasswordInput; }>; export type UpdateUserPasswordMutation = ( { __typename?: 'MutationRoot' } & { updateUserPassword: ( - { __typename?: 'UserResponseModel' } - & Pick + { __typename?: 'UserOutput' } + & Pick & { phone: ( - { __typename?: 'PhoneModel' } - & Pick + { __typename?: 'PhoneOutput' } + & Pick ), address: ( - { __typename?: 'AddressModel' } - & Pick + { __typename?: 'AddressOutput' } + & Pick ) } ) } ); @@ -540,14 +832,14 @@ export type DeleteUserMutationVariables = Exact<{ export type DeleteUserMutation = ( { __typename?: 'MutationRoot' } & { deleteUser: ( - { __typename?: 'UserResponseModel' } - & Pick + { __typename?: 'UserOutput' } + & Pick & { phone: ( - { __typename?: 'PhoneModel' } - & Pick + { __typename?: 'PhoneOutput' } + & Pick ), address: ( - { __typename?: 'AddressModel' } - & Pick + { __typename?: 'AddressOutput' } + & Pick ) } ) } ); diff --git a/src/pages/Auth/AdditionalInfo/index.tsx b/src/pages/Auth/AdditionalInfo/index.tsx index 83bcf10..d78ee40 100644 --- a/src/pages/Auth/AdditionalInfo/index.tsx +++ b/src/pages/Auth/AdditionalInfo/index.tsx @@ -85,12 +85,15 @@ const AdditionalInfo = () => { }) => updateUserInfo({ variables: { - id: currentUser?.id!, - email: currentUser?.email!, - firstName, - lastName, - phone: { prefix, number }, - address: { place, city, country, zip }, + user: { + id: currentUser?.id!, + email: currentUser?.email!, + firstName, + lastName, + phone: { prefix, number }, + address: { place, city, country, zip }, + role: currentUser?.role!, + }, }, }), }); diff --git a/src/pages/CreateUser/index.tsx b/src/pages/CreateUser/index.tsx index 52b4586..d0ec566 100644 --- a/src/pages/CreateUser/index.tsx +++ b/src/pages/CreateUser/index.tsx @@ -169,7 +169,7 @@ const CreateUser = () => { }), onSubmit: ({ password }) => { setNewUser({ ...newUser, password }); - createUser({ variables: { ...newUser } }); + createUser({ variables: { user: { ...newUser } } }); }, }); diff --git a/src/pages/Settings/index.tsx b/src/pages/Settings/index.tsx index d9fc425..3875edd 100644 --- a/src/pages/Settings/index.tsx +++ b/src/pages/Settings/index.tsx @@ -108,12 +108,15 @@ const Settings = () => { }) => updateUserInfo({ variables: { - id: currentUser?.id!, - email: currentUser?.email!, - firstName, - lastName, - phone: { prefix, number }, - address: { place, city, country, zip }, + user: { + id: currentUser?.id!, + email: currentUser?.email!, + firstName, + lastName, + phone: { prefix, number }, + address: { place, city, country, zip }, + role: currentUser?.role!, + }, }, }), }); diff --git a/src/pages/UserSettings/index.tsx b/src/pages/UserSettings/index.tsx index fbd78b8..d1cd4d2 100644 --- a/src/pages/UserSettings/index.tsx +++ b/src/pages/UserSettings/index.tsx @@ -25,7 +25,7 @@ import { GetCountryCodesQueryVariables, GetUserByIdQuery, GetUserByIdQueryVariables, - UserResponseModel, + UserOutput, } from '../../graphql/types'; import { GET_COUNTRY_CODES, @@ -37,7 +37,7 @@ import { const UserSettings = () => { const history = useHistory(); const role = useReactiveVar(roleVar); - const [userToEdit, setUserToEdit] = useState(); + const [userToEdit, setUserToEdit] = useState(); const { id } = useParams<{ id: string }>(); const { data: countryCodes, loading: countryCodesLoading } = useQuery< GetCountryCodesQuery, @@ -119,12 +119,15 @@ const UserSettings = () => { }) => updateUserInfo({ variables: { - id: userToEdit?.id!, - email: userToEdit?.email!, - firstName, - lastName, - phone: { prefix, number }, - address: { place, city, country, zip }, + user: { + id: userToEdit?.id!, + email: userToEdit?.email!, + firstName, + lastName, + phone: { prefix, number }, + address: { place, city, country, zip }, + role: userToEdit?.role!, + }, }, }), enableReinitialize: true, diff --git a/src/pages/Users/index.tsx b/src/pages/Users/index.tsx index 05d2379..3eb27a0 100644 --- a/src/pages/Users/index.tsx +++ b/src/pages/Users/index.tsx @@ -20,7 +20,7 @@ import { DeleteUserMutationVariables, GetAllUsersQuery, GetAllUsersQueryVariables, - UserResponseModel, + UserOutput, } from '../../graphql/types'; import { GET_ALL_USERS } from '../../graphql/admin.api'; import { DELETE_USER } from '../../graphql/auth.api'; @@ -29,8 +29,8 @@ const Users = () => { const role = useReactiveVar(roleVar); const history = useHistory(); const location = useLocation(); - const [users, setUsers] = useState>(); - const [userToDelete, setUserToDelete] = useState(); + const [users, setUsers] = useState>(); + const [userToDelete, setUserToDelete] = useState(); const [error, setError] = useState(''); const [deleteAccountModal, setDeleteAccountModal] = useState(false);