From 00a5a53a3ea77b7e384544bdf4587fd06b5a933c Mon Sep 17 00:00:00 2001 From: Hazem Krimi Date: Wed, 28 Apr 2021 21:22:42 +0100 Subject: [PATCH] Generate gql auth types --- codegen.yml | 14 +++ src/graphql/types.ts | 237 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 250 insertions(+), 1 deletion(-) create mode 100644 codegen.yml diff --git a/codegen.yml b/codegen.yml new file mode 100644 index 0000000..8aca258 --- /dev/null +++ b/codegen.yml @@ -0,0 +1,14 @@ +overwrite: true +schema: 'https://astrobuild-gateway-v1.herokuapp.com' +documents: 'src/graphql/*.api.ts' +config: + withHOC: false + scalars: + Date: Date + enumsAsTypes: true + withHooks: true +generates: + src/graphql/types.ts: + plugins: + - 'typescript' + - 'typescript-operations' diff --git a/src/graphql/types.ts b/src/graphql/types.ts index cb0ff5c..4b4fbc3 100644 --- a/src/graphql/types.ts +++ b/src/graphql/types.ts @@ -1 +1,236 @@ -export {}; +export type Maybe = T | null; +export type Exact = { [K in keyof T]: T[K] }; +export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; +export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: string; + String: string; + Boolean: boolean; + Int: number; + Float: number; +}; + + +export type AddressInputModel = { + place: Scalars['String']; + city: Scalars['String']; + zip: Scalars['String']; + country: Scalars['String']; +}; + +export type AddressModel = { + __typename?: 'AddressModel'; + place: Scalars['String']; + city: Scalars['String']; + zip: Scalars['String']; + country: Scalars['String']; +}; + +export type AuthResponseModel = { + __typename?: 'AuthResponseModel'; + user: UserResponseModel; + token: Scalars['String']; +}; + +export type MutationRoot = { + __typename?: 'MutationRoot'; + signup: AuthResponseModel; + login: AuthResponseModel; + deleteUser: UserResponseModel; + updateUserInfo: UserResponseModel; + updateUserPassword: UserResponseModel; + resetUserPassword: UserResponseModel; + confirmUserResetPassword: UserResponseModel; +}; + + +export type MutationRootSignupArgs = { + email: Scalars['String']; + password: Scalars['String']; + firstName: Scalars['String']; + lastName: Scalars['String']; + phone: PhoneInputModel; + address: AddressInputModel; + active: Scalars['Boolean']; + role: Role; +}; + + +export type MutationRootLoginArgs = { + email: Scalars['String']; + password: Scalars['String']; +}; + + +export type MutationRootDeleteUserArgs = { + id: Scalars['String']; + password: Scalars['String']; +}; + + +export type MutationRootUpdateUserInfoArgs = { + id: Scalars['String']; + email: Scalars['String']; + phone: PhoneInputModel; + address: AddressInputModel; +}; + + +export type MutationRootUpdateUserPasswordArgs = { + id: Scalars['String']; + password: PasswordInputModel; +}; + + +export type MutationRootResetUserPasswordArgs = { + email: Scalars['String']; +}; + + +export type MutationRootConfirmUserResetPasswordArgs = { + id: Scalars['String']; + password: Scalars['String']; +}; + +export type PasswordInputModel = { + oldPassword: Scalars['String']; + newPassword: Scalars['String']; +}; + +export type PhoneInputModel = { + prefix: Scalars['String']; + number: Scalars['String']; +}; + +export type PhoneModel = { + __typename?: 'PhoneModel'; + prefix: Scalars['String']; + number: Scalars['String']; +}; + +export type QueryRoot = { + __typename?: 'QueryRoot'; + getAllUsers: Array; + getUserById: UserResponseModel; +}; + + +export type QueryRootGetUserByIdArgs = { + id: Scalars['String']; +}; + +export type Role = + | 'Admin' + | 'Client' + | 'ProductOwner' + | 'Developer'; + +export type UserResponseModel = { + __typename?: 'UserResponseModel'; + id: Scalars['String']; + email: Scalars['String']; + firstName: Scalars['String']; + lastName: Scalars['String']; + phone: PhoneModel; + address: AddressModel; + active: Scalars['Boolean']; + role: Scalars['String']; +}; + +export type SignupMutationVariables = Exact<{ + email: Scalars['String']; + password: Scalars['String']; + firstName: Scalars['String']; + lastName: Scalars['String']; + phone: PhoneInputModel; + address: AddressInputModel; + active: Scalars['Boolean']; + role: Role; +}>; + + +export type SignupMutation = ( + { __typename?: 'MutationRoot' } + & { signup: ( + { __typename?: 'AuthResponseModel' } + & Pick + & { user: ( + { __typename?: 'UserResponseModel' } + & Pick + & { phone: ( + { __typename?: 'PhoneModel' } + & Pick + ), address: ( + { __typename?: 'AddressModel' } + & Pick + ) } + ) } + ) } +); + +export type LoginMutationVariables = Exact<{ + email: Scalars['String']; + password: Scalars['String']; +}>; + + +export type LoginMutation = ( + { __typename?: 'MutationRoot' } + & { login: ( + { __typename?: 'AuthResponseModel' } + & Pick + & { user: ( + { __typename?: 'UserResponseModel' } + & Pick + & { phone: ( + { __typename?: 'PhoneModel' } + & Pick + ), address: ( + { __typename?: 'AddressModel' } + & Pick + ) } + ) } + ) } +); + +export type ResetPasswordMutationVariables = Exact<{ + email: Scalars['String']; +}>; + + +export type ResetPasswordMutation = ( + { __typename?: 'MutationRoot' } + & { resetUserPassword: ( + { __typename?: 'UserResponseModel' } + & Pick + & { phone: ( + { __typename?: 'PhoneModel' } + & Pick + ), address: ( + { __typename?: 'AddressModel' } + & Pick + ) } + ) } +); + +export type ConfirmUserResetPasswordMutationVariables = Exact<{ + id: Scalars['String']; + password: Scalars['String']; +}>; + + +export type ConfirmUserResetPasswordMutation = ( + { __typename?: 'MutationRoot' } + & { confirmUserResetPassword: ( + { __typename?: 'UserResponseModel' } + & Pick + & { phone: ( + { __typename?: 'PhoneModel' } + & Pick + ), address: ( + { __typename?: 'AddressModel' } + & Pick + ) } + ) } +);