Skip to content

Commit

Permalink
admin/Users: TSify, use GraphQL queries/mutations
Browse files Browse the repository at this point in the history
  • Loading branch information
nl0 committed May 23, 2024
1 parent 46b6b56 commit fdd7b3f
Show file tree
Hide file tree
Showing 23 changed files with 2,069 additions and 795 deletions.
753 changes: 0 additions & 753 deletions catalog/app/containers/Admin/Users/Users.js

This file was deleted.

851 changes: 851 additions & 0 deletions catalog/app/containers/Admin/Users/Users.tsx

Large diffs are not rendered by default.

104 changes: 104 additions & 0 deletions catalog/app/containers/Admin/Users/gql/UserCreate.generated.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'
import * as Types from '../../../../model/graphql/types.generated'

import {

Check warning on line 5 in catalog/app/containers/Admin/Users/gql/UserCreate.generated.ts

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/Admin/Users/gql/UserCreate.generated.ts#L5

Added line #L5 was not covered by tests
UserResultSelection_User_Fragment,
UserResultSelection_InvalidInput_Fragment,
UserResultSelection_OperationError_Fragment,
UserResultSelectionFragmentDoc,
} from './UserResultSelection.generated'

export type containers_Admin_Users_gql_UserCreateMutationVariables = Types.Exact<{
input: Types.UserInput
}>

export type containers_Admin_Users_gql_UserCreateMutation = {
readonly __typename: 'Mutation'
} & {
readonly admin: { readonly __typename: 'AdminMutations' } & {
readonly user: { readonly __typename: 'UserAdminMutations' } & {
readonly create:
| ({ readonly __typename: 'User' } & UserResultSelection_User_Fragment)
| ({
readonly __typename: 'InvalidInput'
} & UserResultSelection_InvalidInput_Fragment)
| ({
readonly __typename: 'OperationError'
} & UserResultSelection_OperationError_Fragment)
}
}
}

export const containers_Admin_Users_gql_UserCreateDocument = {

Check warning on line 33 in catalog/app/containers/Admin/Users/gql/UserCreate.generated.ts

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/Admin/Users/gql/UserCreate.generated.ts#L33

Added line #L33 was not covered by tests
kind: 'Document',
definitions: [
{
kind: 'OperationDefinition',
operation: 'mutation',
name: { kind: 'Name', value: 'containers_Admin_Users_gql_UserCreate' },
variableDefinitions: [
{
kind: 'VariableDefinition',
variable: { kind: 'Variable', name: { kind: 'Name', value: 'input' } },
type: {
kind: 'NonNullType',
type: { kind: 'NamedType', name: { kind: 'Name', value: 'UserInput' } },
},
},
],
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: { kind: 'Name', value: 'admin' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: { kind: 'Name', value: 'user' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: { kind: 'Name', value: 'create' },
arguments: [
{
kind: 'Argument',
name: { kind: 'Name', value: 'input' },
value: {
kind: 'Variable',
name: { kind: 'Name', value: 'input' },
},
},
],
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'FragmentSpread',
name: { kind: 'Name', value: 'UserResultSelection' },
},
],
},
},
],
},
},
],
},
},
],
},
},
...UserResultSelectionFragmentDoc.definitions,
],
} as unknown as DocumentNode<
containers_Admin_Users_gql_UserCreateMutation,
containers_Admin_Users_gql_UserCreateMutationVariables
>

export { containers_Admin_Users_gql_UserCreateDocument as default }

Check warning on line 104 in catalog/app/containers/Admin/Users/gql/UserCreate.generated.ts

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/Admin/Users/gql/UserCreate.generated.ts#L104

Added line #L104 was not covered by tests
11 changes: 11 additions & 0 deletions catalog/app/containers/Admin/Users/gql/UserCreate.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# import UserResultSelection from "./UserResultSelection.graphql"

mutation ($input: UserInput!) {
admin {
user {
create(input: $input) {
...UserResultSelection
}
}
}
}
176 changes: 176 additions & 0 deletions catalog/app/containers/Admin/Users/gql/UserDelete.generated.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'
import * as Types from '../../../../model/graphql/types.generated'

export type containers_Admin_Users_gql_UserDeleteMutationVariables = Types.Exact<{
name: Types.Scalars['String']
}>

export type containers_Admin_Users_gql_UserDeleteMutation = {
readonly __typename: 'Mutation'
} & {
readonly admin: { readonly __typename: 'AdminMutations' } & {
readonly user: { readonly __typename: 'UserAdminMutations' } & {
readonly mutate: Types.Maybe<
{ readonly __typename: 'MutateUserAdminMutations' } & {
readonly delete:
| { readonly __typename: 'Ok' }
| ({ readonly __typename: 'InvalidInput' } & {
readonly errors: ReadonlyArray<
{ readonly __typename: 'InputError' } & Pick<
Types.InputError,
'path' | 'message' | 'name' | 'context'
>
>
})
| ({ readonly __typename: 'OperationError' } & Pick<
Types.OperationError,
'message' | 'name' | 'context'
>)
}
>
}
}
}

export const containers_Admin_Users_gql_UserDeleteDocument = {

Check warning on line 36 in catalog/app/containers/Admin/Users/gql/UserDelete.generated.ts

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/Admin/Users/gql/UserDelete.generated.ts#L36

Added line #L36 was not covered by tests
kind: 'Document',
definitions: [
{
kind: 'OperationDefinition',
operation: 'mutation',
name: { kind: 'Name', value: 'containers_Admin_Users_gql_UserDelete' },
variableDefinitions: [
{
kind: 'VariableDefinition',
variable: { kind: 'Variable', name: { kind: 'Name', value: 'name' } },
type: {
kind: 'NonNullType',
type: { kind: 'NamedType', name: { kind: 'Name', value: 'String' } },
},
},
],
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: { kind: 'Name', value: 'admin' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: { kind: 'Name', value: 'user' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: { kind: 'Name', value: 'mutate' },
arguments: [
{
kind: 'Argument',
name: { kind: 'Name', value: 'name' },
value: {
kind: 'Variable',
name: { kind: 'Name', value: 'name' },
},
},
],
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: { kind: 'Name', value: 'delete' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: { kind: 'Name', value: '__typename' },
},
{
kind: 'InlineFragment',
typeCondition: {
kind: 'NamedType',
name: { kind: 'Name', value: 'InvalidInput' },
},
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: { kind: 'Name', value: 'errors' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: { kind: 'Name', value: 'path' },
},
{
kind: 'Field',
name: { kind: 'Name', value: 'message' },
},
{
kind: 'Field',
name: { kind: 'Name', value: 'name' },
},
{
kind: 'Field',
name: { kind: 'Name', value: 'context' },
},
],
},
},
],
},
},
{
kind: 'InlineFragment',
typeCondition: {
kind: 'NamedType',
name: { kind: 'Name', value: 'OperationError' },
},
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: { kind: 'Name', value: 'message' },
},
{
kind: 'Field',
name: { kind: 'Name', value: 'name' },
},
{
kind: 'Field',
name: { kind: 'Name', value: 'context' },
},
],
},
},
],
},
},
],
},
},
],
},
},
],
},
},
],
},
},
],
} as unknown as DocumentNode<
containers_Admin_Users_gql_UserDeleteMutation,
containers_Admin_Users_gql_UserDeleteMutationVariables
>

export { containers_Admin_Users_gql_UserDeleteDocument as default }

Check warning on line 176 in catalog/app/containers/Admin/Users/gql/UserDelete.generated.ts

View check run for this annotation

Codecov / codecov/patch/informational

catalog/app/containers/Admin/Users/gql/UserDelete.generated.ts#L176

Added line #L176 was not covered by tests
24 changes: 24 additions & 0 deletions catalog/app/containers/Admin/Users/gql/UserDelete.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
mutation ($name: String!) {
admin {
user {
mutate(name: $name) {
delete {
__typename
... on InvalidInput {
errors {
path
message
name
context
}
}
... on OperationError {
message
name
context
}
}
}
}
}
}
Loading

0 comments on commit fdd7b3f

Please sign in to comment.