Update graphql types and mutations

This commit is contained in:
Hazem Krimi
2021-05-18 22:38:21 +01:00
parent 05d43a3b31
commit c1c5af43a6
9 changed files with 505 additions and 234 deletions
+2 -18
View File
@@ -45,24 +45,8 @@ export const GET_USER_BY_ID = gql`
`; `;
export const CREATE_USER = gql` export const CREATE_USER = gql`
mutation CreateUser( mutation CreateUser($user: UserInput!) {
$email: String! createUser(user: $user) {
$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
) {
id id
email email
firstName firstName
+3 -17
View File
@@ -95,22 +95,8 @@ export const CONFIRM_USER_RESET_PASSWORD = gql`
`; `;
export const UPDATE_USER_INFO = gql` export const UPDATE_USER_INFO = gql`
mutation UpdateUserInfo( mutation UpdateUserInfo($user: UpdateUserInput!) {
$id: String! updateUserInfo(user: $user) {
$email: String!
$firstName: String!
$lastName: String!
$phone: PhoneInputModel!
$address: AddressInputModel!
) {
updateUserInfo(
id: $id
email: $email
firstName: $firstName
lastName: $lastName
phone: $phone
address: $address
) {
id id
email email
firstName firstName
@@ -131,7 +117,7 @@ export const UPDATE_USER_INFO = gql`
`; `;
export const UPDATE_USER_PASSWORD = gql` export const UPDATE_USER_PASSWORD = gql`
mutation UpdateUserPassword($id: String!, $password: PasswordInputModel!) { mutation UpdateUserPassword($id: String!, $password: PasswordInput!) {
updateUserPassword(id: $id, password: $password) { updateUserPassword(id: $id, password: $password) {
id id
email email
+2 -2
View File
@@ -1,5 +1,5 @@
import { makeVar } from '@apollo/client'; import { makeVar } from '@apollo/client';
import { UserResponseModel } from './types'; import { UserOutput } from './types';
export const tokenVar = makeVar<string | undefined>(undefined); export const tokenVar = makeVar<string | undefined>(undefined);
@@ -7,4 +7,4 @@ export const roleVar = makeVar<
'client' | 'productOwner' | 'developer' | 'admin' | undefined 'client' | 'productOwner' | 'developer' | 'admin' | undefined
>(undefined); >(undefined);
export const userVar = makeVar<UserResponseModel | undefined>(undefined); export const userVar = makeVar<UserOutput | undefined>(undefined);
+465 -173
View File
@@ -12,43 +12,92 @@ export type Scalars = {
}; };
export type AddressInputModel = { export type AddressInput = {
place: Scalars['String']; place: Scalars['String'];
city: Scalars['String']; city: Scalars['String'];
zip: Scalars['String']; zip: Scalars['String'];
country: Scalars['String']; country: Scalars['String'];
}; };
export type AddressModel = { export type AddressOutput = {
__typename?: 'AddressModel'; __typename?: 'AddressOutput';
place: Scalars['String']; place: Scalars['String'];
city: Scalars['String']; city: Scalars['String'];
zip: Scalars['String']; zip: Scalars['String'];
country: Scalars['String']; country: Scalars['String'];
}; };
export type AuthResponseModel = { export type CategoryInput = {
__typename?: 'AuthResponseModel'; name: Scalars['String'];
user: UserResponseModel; description: Scalars['String'];
token: Scalars['String']; image: InputFile;
}; };
export type CategoryResponseModel = { export type CategoryOutput = {
__typename?: 'CategoryResponseModel'; __typename?: 'CategoryOutput';
id: Scalars['String']; id: Scalars['String'];
name: Scalars['String']; name: Scalars['String'];
description: Scalars['String']; description: Scalars['String'];
image: File; image: File;
}; };
export type ConnectionsInput = {
to: Scalars['String'];
releations: RelationsInput;
};
export type ConnectionsOutput = {
__typename?: 'ConnectionsOutput';
to: Scalars['String'];
releations: RelationsOutput;
};
export type CountryPrefixModel = { export type CountryPrefixModel = {
__typename?: 'CountryPrefixModel'; __typename?: 'CountryPrefixModel';
country: Scalars['String']; country: Scalars['String'];
prefix: Scalars['String']; prefix: Scalars['String'];
}; };
export type FeatureResponseModel = { export type DelivrableInput = {
__typename?: 'FeatureResponseModel'; 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<Array<InputFile>>;
price: Scalars['Float'];
repo: Scalars['String'];
};
export type FeatureOutput = {
__typename?: 'FeatureOutput';
id: Scalars['String']; id: Scalars['String'];
name: Scalars['String']; name: Scalars['String'];
description: Scalars['String']; description: Scalars['String'];
@@ -72,12 +121,9 @@ export type FileWithOutOId = {
src: Scalars['String']; src: Scalars['String'];
}; };
export type Introduction = { export type InputFile = {
__typename?: 'Introduction'; name: Scalars['String'];
purpose: Scalars['String']; src: Scalars['String'];
documentConventions: Scalars['String'];
intendedAudience: Scalars['String'];
projectScope: Scalars['String'];
}; };
export type IntroductionInput = { export type IntroductionInput = {
@@ -87,21 +133,43 @@ export type IntroductionInput = {
projectScope: Scalars['String']; projectScope: Scalars['String'];
}; };
export type IntroductionOutput = {
__typename?: 'IntroductionOutput';
purpose: Scalars['String'];
documentConventions: Scalars['String'];
intendedAudience: Scalars['String'];
projectScope: Scalars['String'];
};
export type MutationRoot = { export type MutationRoot = {
__typename?: 'MutationRoot'; __typename?: 'MutationRoot';
signup: AuthResponseModel; signup: UserAuthenticationOutput;
createUser: UserResponseModel; createUser: UserOutput;
login: AuthResponseModel; login: UserAuthenticationOutput;
deleteUser: UserResponseModel; deleteUser: UserOutput;
updateUserInfo: UserResponseModel; updateUserInfo: UserOutput;
updateUserPassword: UserResponseModel; updateUserPassword: UserOutput;
resetUserPassword: UserResponseModel; resetUserPassword: UserOutput;
confirmUserResetPassword: UserResponseModel; confirmUserResetPassword: UserOutput;
deleteCategory: CategoryResponseModel; deleteCategory: CategoryOutput;
deleteFeature: FeatureResponseModel; deleteFeature: FeatureOutput;
deleteTemplate: TemplateModel; deleteTemplate: TemplateDefactoredOutput;
updateTemplateFeature: TemplateResponseModel; updateTemplateFeature: TemplateOutput;
addTemplateSpecification: TemplateResponseModel; 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 = { export type MutationRootCreateUserArgs = {
email: Scalars['String']; user: UserInput;
password: Scalars['String'];
firstName: Scalars['String'];
lastName: Scalars['String'];
phone: PhoneInputModel;
address: AddressInputModel;
role: Role;
}; };
@@ -135,18 +197,13 @@ export type MutationRootDeleteUserArgs = {
export type MutationRootUpdateUserInfoArgs = { export type MutationRootUpdateUserInfoArgs = {
id: Scalars['String']; user: UpdateUserInput;
firstName: Scalars['String'];
lastName: Scalars['String'];
email: Scalars['String'];
phone: PhoneInputModel;
address: AddressInputModel;
}; };
export type MutationRootUpdateUserPasswordArgs = { export type MutationRootUpdateUserPasswordArgs = {
id: Scalars['String']; id: Scalars['String'];
password: PasswordInputModel; password: PasswordInput;
}; };
@@ -187,12 +244,83 @@ export type MutationRootAddTemplateSpecificationArgs = {
specification: SpecificationInput; specification: SpecificationInput;
}; };
export type NonFunctionalRequirements = {
__typename?: 'NonFunctionalRequirements'; export type MutationRootAddCategoryArgs = {
performanceRequirements: Scalars['String']; category: CategoryInput;
safetyRequirements: Scalars['String']; };
securityRequirements: Scalars['String'];
softwareQualityAttributes: Scalars['String'];
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<InputFile>;
};
export type MutationRootAddTemplateArgs = {
template: TemplateInput;
};
export type MutationRootUpdateTemplateArgs = {
id: Scalars['String'];
template: TemplateUpdateInput;
specification?: Maybe<SpecificationInput>;
};
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 = { export type NonFunctionalRequirementsInput = {
@@ -202,14 +330,12 @@ export type NonFunctionalRequirementsInput = {
softwareQualityAttributes: Scalars['String']; softwareQualityAttributes: Scalars['String'];
}; };
export type OverallDescription = { export type NonFunctionalRequirementsOutput = {
__typename?: 'OverallDescription'; __typename?: 'NonFunctionalRequirementsOutput';
perspective: Scalars['String']; performanceRequirements: Scalars['String'];
userCharacteristics: Scalars['String']; safetyRequirements: Scalars['String'];
operatingEnvironment: Scalars['String']; securityRequirements: Scalars['String'];
designImplementationConstraints: Scalars['String']; softwareQualityAttributes: Scalars['String'];
userDocumentation: Scalars['String'];
assemptionsDependencies: Scalars['String'];
}; };
export type OverallDescriptionInput = { export type OverallDescriptionInput = {
@@ -221,32 +347,113 @@ export type OverallDescriptionInput = {
assemptionsDependencies: Scalars['String']; 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']; oldPassword: Scalars['String'];
newPassword: 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']; prefix: Scalars['String'];
number: Scalars['String']; number: Scalars['String'];
}; };
export type PhoneModel = { export type PhoneOutput = {
__typename?: 'PhoneModel'; __typename?: 'PhoneOutput';
prefix: Scalars['String']; prefix: Scalars['String'];
number: Scalars['String']; number: Scalars['String'];
}; };
export type ProjectInput = {
clientId: Scalars['String'];
name: Scalars['String'];
image: InputFile;
platforms: Array<Scalars['String']>;
template: Scalars['String'];
features: Array<Scalars['String']>;
paymentOption: PaymentOptionInput;
delivrable?: Maybe<DelivrableInput>;
totalPrice: Scalars['Float'];
};
export type ProjectOutput = {
__typename?: 'ProjectOutput';
id: Scalars['String'];
clientId: Scalars['String'];
name: Scalars['String'];
image: File;
platforms: Array<Scalars['String']>;
template: TemplateOutput;
features: Array<FeatureOutput>;
state: Scalars['String'];
proposal?: Maybe<ProposalOutput>;
paymentOption: PaymentOptionOutput;
delivrable?: Maybe<DelivrableOutput>;
totalPrice: Scalars['Float'];
};
export type ProposalInput = {
devtime: DevtimeInput;
summary: Scalars['String'];
purpose: Scalars['String'];
resources: Array<ResourceInput>;
};
export type ProposalOutput = {
__typename?: 'ProposalOutput';
devtime: DevtimeOutput;
summary: Scalars['String'];
purpose: Scalars['String'];
resources: Array<ResourceOutput>;
};
export type ProtoTypeInput = {
featureId: Scalars['String'];
connections: Array<ConnectionsInput>;
};
export type ProtoTypeOutput = {
__typename?: 'ProtoTypeOutput';
feature: FeatureOutput;
connections: Array<ConnectionsOutput>;
};
export type QueryRoot = { export type QueryRoot = {
__typename?: 'QueryRoot'; __typename?: 'QueryRoot';
getAllUsers: Array<UserResponseModel>; getAllUsers: Array<UserOutput>;
getUserById: UserResponseModel; getUserById: UserOutput;
getCategoryById: CategoryResponseModel; getCategoryById: CategoryOutput;
getFeatureById: FeatureResponseModel; getFeatureById: FeatureOutput;
getTemplateById: TemplateResponseModel; getPrototypeById: TemplateProtoTypeOutput;
getAllCategories: Array<CategoryResponseModel>; getTemplateById: TemplateOutput;
getAllFeatures: Array<FeatureResponseModel>; getProjectById: ProjectOutput;
getAllTemplates: Array<TemplateResponseModel>; getAllProjectsByClientId: Array<ProjectOutput>;
getAllCategories: Array<CategoryOutput>;
getAllFeatures: Array<FeatureOutput>;
getAllTemplates: Array<TemplateOutput>;
getAllTemplatesByCategoriesId: Array<TemplateOutput>;
getCountryCode: Array<CountryPrefixModel>; getCountryCode: Array<CountryPrefixModel>;
}; };
@@ -266,25 +473,50 @@ export type QueryRootGetFeatureByIdArgs = {
}; };
export type QueryRootGetPrototypeByIdArgs = {
id: Scalars['String'];
};
export type QueryRootGetTemplateByIdArgs = { export type QueryRootGetTemplateByIdArgs = {
id: Scalars['String']; id: Scalars['String'];
}; };
export type Role =
| 'Admin'
| 'Client'
| 'ProductOwner'
| 'Developer';
export type Specification = { export type QueryRootGetProjectByIdArgs = {
__typename?: 'Specification'; id: Scalars['String'];
introduction: Introduction; };
overallDescription: OverallDescription;
nonFunctionalRequirements: NonFunctionalRequirements;
otherRequirements: Scalars['String']; export type QueryRootGetAllProjectsByClientIdArgs = {
glossary: Scalars['String']; id: Scalars['String'];
analysisModels: Scalars['String']; };
issuesList: Scalars['String'];
export type QueryRootGetAllTemplatesByCategoriesIdArgs = {
categoires: Array<Scalars['String']>;
};
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 = { export type SpecificationInput = {
@@ -297,36 +529,107 @@ export type SpecificationInput = {
issuesList: Scalars['String']; issuesList: Scalars['String'];
}; };
export type TemplateModel = { export type SpecificationOutput = {
__typename?: 'TemplateModel'; __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']; id: Scalars['String'];
name: Scalars['String']; name: Scalars['String'];
description: Scalars['String']; description: Scalars['String'];
category: Scalars['String']; category: Scalars['String'];
features?: Maybe<Array<Scalars['String']>>; features?: Maybe<Array<Scalars['String']>>;
image: File; image: File;
specification?: Maybe<Specification>; specification?: Maybe<SpecificationOutput>;
}; };
export type TemplateResponseModel = { export type TemplateInput = {
__typename?: 'TemplateResponseModel'; name: Scalars['String'];
description: Scalars['String'];
category: Scalars['String'];
image: InputFile;
};
export type TemplateOutput = {
__typename?: 'TemplateOutput';
id: Scalars['String']; id: Scalars['String'];
name: Scalars['String']; name: Scalars['String'];
description: Scalars['String']; description: Scalars['String'];
category: Scalars['String']; category: Scalars['String'];
features?: Maybe<Array<FeatureResponseModel>>; features?: Maybe<Array<FeatureOutput>>;
image: File; image: File;
specification?: Maybe<Specification>; specification?: Maybe<SpecificationOutput>;
}; };
export type UserResponseModel = { export type TemplateProtoTypeInput = {
__typename?: 'UserResponseModel'; templateId: Scalars['String'];
prototype: Array<ProtoTypeInput>;
};
export type TemplateProtoTypeOutput = {
__typename?: 'TemplateProtoTypeOutput';
id: Scalars['String'];
template: Scalars['String'];
prototype: Array<ProtoTypeOutput>;
};
export type TemplateUpdateInput = {
name: Scalars['String'];
description: Scalars['String'];
category: Scalars['String'];
features?: Maybe<Array<Scalars['String']>>;
image: InputFile;
specification?: Maybe<Scalars['String']>;
};
export type UpdateUserInput = {
id: Scalars['String']; id: Scalars['String'];
email: Scalars['String']; email: Scalars['String'];
firstName: Scalars['String']; firstName: Scalars['String'];
lastName: Scalars['String']; lastName: Scalars['String'];
phone: PhoneModel; phone: PhoneInput;
address: AddressModel; 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']; role: Scalars['String'];
}; };
@@ -336,14 +639,14 @@ export type GetAllUsersQueryVariables = Exact<{ [key: string]: never; }>;
export type GetAllUsersQuery = ( export type GetAllUsersQuery = (
{ __typename?: 'QueryRoot' } { __typename?: 'QueryRoot' }
& { getAllUsers: Array<( & { getAllUsers: Array<(
{ __typename?: 'UserResponseModel' } { __typename?: 'UserOutput' }
& Pick<UserResponseModel, 'id' | 'email' | 'firstName' | 'lastName' | 'role'> & Pick<UserOutput, 'id' | 'email' | 'firstName' | 'lastName' | 'role'>
& { phone: ( & { phone: (
{ __typename?: 'PhoneModel' } { __typename?: 'PhoneOutput' }
& Pick<PhoneModel, 'prefix' | 'number'> & Pick<PhoneOutput, 'prefix' | 'number'>
), address: ( ), address: (
{ __typename?: 'AddressModel' } { __typename?: 'AddressOutput' }
& Pick<AddressModel, 'place' | 'city' | 'country' | 'zip'> & Pick<AddressOutput, 'place' | 'city' | 'country' | 'zip'>
) } ) }
)> } )> }
); );
@@ -356,40 +659,34 @@ export type GetUserByIdQueryVariables = Exact<{
export type GetUserByIdQuery = ( export type GetUserByIdQuery = (
{ __typename?: 'QueryRoot' } { __typename?: 'QueryRoot' }
& { getUserById: ( & { getUserById: (
{ __typename?: 'UserResponseModel' } { __typename?: 'UserOutput' }
& Pick<UserResponseModel, 'id' | 'email' | 'firstName' | 'lastName' | 'role'> & Pick<UserOutput, 'id' | 'email' | 'firstName' | 'lastName' | 'role'>
& { phone: ( & { phone: (
{ __typename?: 'PhoneModel' } { __typename?: 'PhoneOutput' }
& Pick<PhoneModel, 'prefix' | 'number'> & Pick<PhoneOutput, 'prefix' | 'number'>
), address: ( ), address: (
{ __typename?: 'AddressModel' } { __typename?: 'AddressOutput' }
& Pick<AddressModel, 'place' | 'city' | 'country' | 'zip'> & Pick<AddressOutput, 'place' | 'city' | 'country' | 'zip'>
) } ) }
) } ) }
); );
export type CreateUserMutationVariables = Exact<{ export type CreateUserMutationVariables = Exact<{
email: Scalars['String']; user: UserInput;
password: Scalars['String'];
firstName: Scalars['String'];
lastName: Scalars['String'];
phone: PhoneInputModel;
address: AddressInputModel;
role: Role;
}>; }>;
export type CreateUserMutation = ( export type CreateUserMutation = (
{ __typename?: 'MutationRoot' } { __typename?: 'MutationRoot' }
& { createUser: ( & { createUser: (
{ __typename?: 'UserResponseModel' } { __typename?: 'UserOutput' }
& Pick<UserResponseModel, 'id' | 'email' | 'firstName' | 'lastName' | 'role'> & Pick<UserOutput, 'id' | 'email' | 'firstName' | 'lastName' | 'role'>
& { phone: ( & { phone: (
{ __typename?: 'PhoneModel' } { __typename?: 'PhoneOutput' }
& Pick<PhoneModel, 'prefix' | 'number'> & Pick<PhoneOutput, 'prefix' | 'number'>
), address: ( ), address: (
{ __typename?: 'AddressModel' } { __typename?: 'AddressOutput' }
& Pick<AddressModel, 'place' | 'city' | 'country' | 'zip'> & Pick<AddressOutput, 'place' | 'city' | 'country' | 'zip'>
) } ) }
) } ) }
); );
@@ -403,17 +700,17 @@ export type SignupMutationVariables = Exact<{
export type SignupMutation = ( export type SignupMutation = (
{ __typename?: 'MutationRoot' } { __typename?: 'MutationRoot' }
& { signup: ( & { signup: (
{ __typename?: 'AuthResponseModel' } { __typename?: 'UserAuthenticationOutput' }
& Pick<AuthResponseModel, 'token'> & Pick<UserAuthenticationOutput, 'token'>
& { user: ( & { user: (
{ __typename?: 'UserResponseModel' } { __typename?: 'UserOutput' }
& Pick<UserResponseModel, 'id' | 'email' | 'firstName' | 'lastName' | 'role'> & Pick<UserOutput, 'id' | 'email' | 'firstName' | 'lastName' | 'role'>
& { phone: ( & { phone: (
{ __typename?: 'PhoneModel' } { __typename?: 'PhoneOutput' }
& Pick<PhoneModel, 'prefix' | 'number'> & Pick<PhoneOutput, 'prefix' | 'number'>
), address: ( ), address: (
{ __typename?: 'AddressModel' } { __typename?: 'AddressOutput' }
& Pick<AddressModel, 'place' | 'city' | 'country' | 'zip'> & Pick<AddressOutput, 'place' | 'city' | 'country' | 'zip'>
) } ) }
) } ) }
) } ) }
@@ -428,17 +725,17 @@ export type LoginMutationVariables = Exact<{
export type LoginMutation = ( export type LoginMutation = (
{ __typename?: 'MutationRoot' } { __typename?: 'MutationRoot' }
& { login: ( & { login: (
{ __typename?: 'AuthResponseModel' } { __typename?: 'UserAuthenticationOutput' }
& Pick<AuthResponseModel, 'token'> & Pick<UserAuthenticationOutput, 'token'>
& { user: ( & { user: (
{ __typename?: 'UserResponseModel' } { __typename?: 'UserOutput' }
& Pick<UserResponseModel, 'id' | 'email' | 'firstName' | 'lastName' | 'role'> & Pick<UserOutput, 'id' | 'email' | 'firstName' | 'lastName' | 'role'>
& { phone: ( & { phone: (
{ __typename?: 'PhoneModel' } { __typename?: 'PhoneOutput' }
& Pick<PhoneModel, 'prefix' | 'number'> & Pick<PhoneOutput, 'prefix' | 'number'>
), address: ( ), address: (
{ __typename?: 'AddressModel' } { __typename?: 'AddressOutput' }
& Pick<AddressModel, 'place' | 'city' | 'country' | 'zip'> & Pick<AddressOutput, 'place' | 'city' | 'country' | 'zip'>
) } ) }
) } ) }
) } ) }
@@ -452,14 +749,14 @@ export type ResetPasswordMutationVariables = Exact<{
export type ResetPasswordMutation = ( export type ResetPasswordMutation = (
{ __typename?: 'MutationRoot' } { __typename?: 'MutationRoot' }
& { resetUserPassword: ( & { resetUserPassword: (
{ __typename?: 'UserResponseModel' } { __typename?: 'UserOutput' }
& Pick<UserResponseModel, 'id' | 'email' | 'firstName' | 'lastName' | 'role'> & Pick<UserOutput, 'id' | 'email' | 'firstName' | 'lastName' | 'role'>
& { phone: ( & { phone: (
{ __typename?: 'PhoneModel' } { __typename?: 'PhoneOutput' }
& Pick<PhoneModel, 'prefix' | 'number'> & Pick<PhoneOutput, 'prefix' | 'number'>
), address: ( ), address: (
{ __typename?: 'AddressModel' } { __typename?: 'AddressOutput' }
& Pick<AddressModel, 'place' | 'city' | 'country' | 'zip'> & Pick<AddressOutput, 'place' | 'city' | 'country' | 'zip'>
) } ) }
) } ) }
); );
@@ -473,60 +770,55 @@ export type ConfirmUserResetPasswordMutationVariables = Exact<{
export type ConfirmUserResetPasswordMutation = ( export type ConfirmUserResetPasswordMutation = (
{ __typename?: 'MutationRoot' } { __typename?: 'MutationRoot' }
& { confirmUserResetPassword: ( & { confirmUserResetPassword: (
{ __typename?: 'UserResponseModel' } { __typename?: 'UserOutput' }
& Pick<UserResponseModel, 'id' | 'email' | 'firstName' | 'lastName' | 'role'> & Pick<UserOutput, 'id' | 'email' | 'firstName' | 'lastName' | 'role'>
& { phone: ( & { phone: (
{ __typename?: 'PhoneModel' } { __typename?: 'PhoneOutput' }
& Pick<PhoneModel, 'prefix' | 'number'> & Pick<PhoneOutput, 'prefix' | 'number'>
), address: ( ), address: (
{ __typename?: 'AddressModel' } { __typename?: 'AddressOutput' }
& Pick<AddressModel, 'place' | 'city' | 'country' | 'zip'> & Pick<AddressOutput, 'place' | 'city' | 'country' | 'zip'>
) } ) }
) } ) }
); );
export type UpdateUserInfoMutationVariables = Exact<{ export type UpdateUserInfoMutationVariables = Exact<{
id: Scalars['String']; user: UpdateUserInput;
email: Scalars['String'];
firstName: Scalars['String'];
lastName: Scalars['String'];
phone: PhoneInputModel;
address: AddressInputModel;
}>; }>;
export type UpdateUserInfoMutation = ( export type UpdateUserInfoMutation = (
{ __typename?: 'MutationRoot' } { __typename?: 'MutationRoot' }
& { updateUserInfo: ( & { updateUserInfo: (
{ __typename?: 'UserResponseModel' } { __typename?: 'UserOutput' }
& Pick<UserResponseModel, 'id' | 'email' | 'firstName' | 'lastName' | 'role'> & Pick<UserOutput, 'id' | 'email' | 'firstName' | 'lastName' | 'role'>
& { phone: ( & { phone: (
{ __typename?: 'PhoneModel' } { __typename?: 'PhoneOutput' }
& Pick<PhoneModel, 'prefix' | 'number'> & Pick<PhoneOutput, 'prefix' | 'number'>
), address: ( ), address: (
{ __typename?: 'AddressModel' } { __typename?: 'AddressOutput' }
& Pick<AddressModel, 'place' | 'city' | 'country' | 'zip'> & Pick<AddressOutput, 'place' | 'city' | 'country' | 'zip'>
) } ) }
) } ) }
); );
export type UpdateUserPasswordMutationVariables = Exact<{ export type UpdateUserPasswordMutationVariables = Exact<{
id: Scalars['String']; id: Scalars['String'];
password: PasswordInputModel; password: PasswordInput;
}>; }>;
export type UpdateUserPasswordMutation = ( export type UpdateUserPasswordMutation = (
{ __typename?: 'MutationRoot' } { __typename?: 'MutationRoot' }
& { updateUserPassword: ( & { updateUserPassword: (
{ __typename?: 'UserResponseModel' } { __typename?: 'UserOutput' }
& Pick<UserResponseModel, 'id' | 'email' | 'firstName' | 'lastName' | 'role'> & Pick<UserOutput, 'id' | 'email' | 'firstName' | 'lastName' | 'role'>
& { phone: ( & { phone: (
{ __typename?: 'PhoneModel' } { __typename?: 'PhoneOutput' }
& Pick<PhoneModel, 'prefix' | 'number'> & Pick<PhoneOutput, 'prefix' | 'number'>
), address: ( ), address: (
{ __typename?: 'AddressModel' } { __typename?: 'AddressOutput' }
& Pick<AddressModel, 'place' | 'city' | 'country' | 'zip'> & Pick<AddressOutput, 'place' | 'city' | 'country' | 'zip'>
) } ) }
) } ) }
); );
@@ -540,14 +832,14 @@ export type DeleteUserMutationVariables = Exact<{
export type DeleteUserMutation = ( export type DeleteUserMutation = (
{ __typename?: 'MutationRoot' } { __typename?: 'MutationRoot' }
& { deleteUser: ( & { deleteUser: (
{ __typename?: 'UserResponseModel' } { __typename?: 'UserOutput' }
& Pick<UserResponseModel, 'id' | 'email' | 'firstName' | 'lastName' | 'role'> & Pick<UserOutput, 'id' | 'email' | 'firstName' | 'lastName' | 'role'>
& { phone: ( & { phone: (
{ __typename?: 'PhoneModel' } { __typename?: 'PhoneOutput' }
& Pick<PhoneModel, 'prefix' | 'number'> & Pick<PhoneOutput, 'prefix' | 'number'>
), address: ( ), address: (
{ __typename?: 'AddressModel' } { __typename?: 'AddressOutput' }
& Pick<AddressModel, 'place' | 'city' | 'country' | 'zip'> & Pick<AddressOutput, 'place' | 'city' | 'country' | 'zip'>
) } ) }
) } ) }
); );
+3
View File
@@ -85,12 +85,15 @@ const AdditionalInfo = () => {
}) => }) =>
updateUserInfo({ updateUserInfo({
variables: { variables: {
user: {
id: currentUser?.id!, id: currentUser?.id!,
email: currentUser?.email!, email: currentUser?.email!,
firstName, firstName,
lastName, lastName,
phone: { prefix, number }, phone: { prefix, number },
address: { place, city, country, zip }, address: { place, city, country, zip },
role: currentUser?.role!,
},
}, },
}), }),
}); });
+1 -1
View File
@@ -169,7 +169,7 @@ const CreateUser = () => {
}), }),
onSubmit: ({ password }) => { onSubmit: ({ password }) => {
setNewUser({ ...newUser, password }); setNewUser({ ...newUser, password });
createUser({ variables: { ...newUser } }); createUser({ variables: { user: { ...newUser } } });
}, },
}); });
+3
View File
@@ -108,12 +108,15 @@ const Settings = () => {
}) => }) =>
updateUserInfo({ updateUserInfo({
variables: { variables: {
user: {
id: currentUser?.id!, id: currentUser?.id!,
email: currentUser?.email!, email: currentUser?.email!,
firstName, firstName,
lastName, lastName,
phone: { prefix, number }, phone: { prefix, number },
address: { place, city, country, zip }, address: { place, city, country, zip },
role: currentUser?.role!,
},
}, },
}), }),
}); });
+5 -2
View File
@@ -25,7 +25,7 @@ import {
GetCountryCodesQueryVariables, GetCountryCodesQueryVariables,
GetUserByIdQuery, GetUserByIdQuery,
GetUserByIdQueryVariables, GetUserByIdQueryVariables,
UserResponseModel, UserOutput,
} from '../../graphql/types'; } from '../../graphql/types';
import { import {
GET_COUNTRY_CODES, GET_COUNTRY_CODES,
@@ -37,7 +37,7 @@ import {
const UserSettings = () => { const UserSettings = () => {
const history = useHistory(); const history = useHistory();
const role = useReactiveVar(roleVar); const role = useReactiveVar(roleVar);
const [userToEdit, setUserToEdit] = useState<UserResponseModel>(); const [userToEdit, setUserToEdit] = useState<UserOutput>();
const { id } = useParams<{ id: string }>(); const { id } = useParams<{ id: string }>();
const { data: countryCodes, loading: countryCodesLoading } = useQuery< const { data: countryCodes, loading: countryCodesLoading } = useQuery<
GetCountryCodesQuery, GetCountryCodesQuery,
@@ -119,12 +119,15 @@ const UserSettings = () => {
}) => }) =>
updateUserInfo({ updateUserInfo({
variables: { variables: {
user: {
id: userToEdit?.id!, id: userToEdit?.id!,
email: userToEdit?.email!, email: userToEdit?.email!,
firstName, firstName,
lastName, lastName,
phone: { prefix, number }, phone: { prefix, number },
address: { place, city, country, zip }, address: { place, city, country, zip },
role: userToEdit?.role!,
},
}, },
}), }),
enableReinitialize: true, enableReinitialize: true,
+3 -3
View File
@@ -20,7 +20,7 @@ import {
DeleteUserMutationVariables, DeleteUserMutationVariables,
GetAllUsersQuery, GetAllUsersQuery,
GetAllUsersQueryVariables, GetAllUsersQueryVariables,
UserResponseModel, UserOutput,
} from '../../graphql/types'; } from '../../graphql/types';
import { GET_ALL_USERS } from '../../graphql/admin.api'; import { GET_ALL_USERS } from '../../graphql/admin.api';
import { DELETE_USER } from '../../graphql/auth.api'; import { DELETE_USER } from '../../graphql/auth.api';
@@ -29,8 +29,8 @@ const Users = () => {
const role = useReactiveVar(roleVar); const role = useReactiveVar(roleVar);
const history = useHistory(); const history = useHistory();
const location = useLocation(); const location = useLocation();
const [users, setUsers] = useState<Array<UserResponseModel>>(); const [users, setUsers] = useState<Array<UserOutput>>();
const [userToDelete, setUserToDelete] = useState<UserResponseModel>(); const [userToDelete, setUserToDelete] = useState<UserOutput>();
const [error, setError] = useState<string>(''); const [error, setError] = useState<string>('');
const [deleteAccountModal, setDeleteAccountModal] = useState<boolean>(false); const [deleteAccountModal, setDeleteAccountModal] = useState<boolean>(false);