Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: create/update/delete one view instead of many #1384

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
refactor: create/update/delete one view instead of many
Closes #1359
  • Loading branch information
thaisguigon committed Aug 30, 2023
commit e04f0e8e93fd1a6ca34b770b16899d807401c1e7
156 changes: 96 additions & 60 deletions front/src/generated/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@ export type Mutation = {
createOneCompany: Company;
createOnePerson: Person;
createOnePipelineProgress: PipelineProgress;
createOneView: View;
createOneViewField: ViewField;
deleteCurrentWorkspace: Workspace;
deleteFavorite: Favorite;
Expand All @@ -1014,6 +1015,7 @@ export type Mutation = {
deleteManyView: AffectedRows;
deleteManyViewFilter: AffectedRows;
deleteManyViewSort: AffectedRows;
deleteOneView: View;
deleteUserAccount: User;
deleteWorkspaceMember: WorkspaceMember;
impersonate: Verify;
Expand Down Expand Up @@ -1128,6 +1130,11 @@ export type MutationCreateOnePipelineProgressArgs = {
};


export type MutationCreateOneViewArgs = {
data: ViewCreateInput;
};


export type MutationCreateOneViewFieldArgs = {
data: ViewFieldCreateInput;
};
Expand Down Expand Up @@ -1173,6 +1180,11 @@ export type MutationDeleteManyViewSortArgs = {
};


export type MutationDeleteOneViewArgs = {
where: ViewWhereUniqueInput;
};


export type MutationDeleteWorkspaceMemberArgs = {
where: WorkspaceMemberWhereUniqueInput;
};
Expand Down Expand Up @@ -2423,6 +2435,16 @@ export type View = {
type: ViewType;
};

export type ViewCreateInput = {
fields?: InputMaybe<ViewFieldCreateNestedManyWithoutViewInput>;
filters?: InputMaybe<ViewFilterCreateNestedManyWithoutViewInput>;
id?: InputMaybe<Scalars['String']>;
name: Scalars['String'];
objectId: Scalars['String'];
sorts?: InputMaybe<ViewSortCreateNestedManyWithoutViewInput>;
type: ViewType;
};

export type ViewCreateManyInput = {
id?: InputMaybe<Scalars['String']>;
name: Scalars['String'];
Expand Down Expand Up @@ -2466,6 +2488,10 @@ export type ViewFieldCreateManyInput = {
viewId?: InputMaybe<Scalars['String']>;
};

export type ViewFieldCreateNestedManyWithoutViewInput = {
connect?: InputMaybe<Array<ViewFieldWhereUniqueInput>>;
};

export type ViewFieldListRelationFilter = {
every?: InputMaybe<ViewFieldWhereInput>;
none?: InputMaybe<ViewFieldWhereInput>;
Expand Down Expand Up @@ -2565,6 +2591,10 @@ export type ViewFilterCreateManyInput = {
viewId: Scalars['String'];
};

export type ViewFilterCreateNestedManyWithoutViewInput = {
connect?: InputMaybe<Array<ViewFilterWhereUniqueInput>>;
};

export type ViewFilterListRelationFilter = {
every?: InputMaybe<ViewFilterWhereInput>;
none?: InputMaybe<ViewFilterWhereInput>;
Expand Down Expand Up @@ -2686,6 +2716,10 @@ export type ViewSortCreateManyInput = {
viewId: Scalars['String'];
};

export type ViewSortCreateNestedManyWithoutViewInput = {
connect?: InputMaybe<Array<ViewSortWhereUniqueInput>>;
};

export enum ViewSortDirection {
Asc = 'asc',
Desc = 'desc'
Expand Down Expand Up @@ -3380,6 +3414,13 @@ export type GetUsersQueryVariables = Exact<{ [key: string]: never; }>;

export type GetUsersQuery = { __typename?: 'Query', findManyUser: Array<{ __typename?: 'User', id: string, email: string, displayName: string, firstName?: string | null, lastName?: string | null }> };

export type CreateViewMutationVariables = Exact<{
data: ViewCreateInput;
}>;


export type CreateViewMutation = { __typename?: 'Mutation', view: { __typename?: 'View', id: string, name: string } };

export type CreateViewFieldsMutationVariables = Exact<{
data: Array<ViewFieldCreateManyInput> | ViewFieldCreateManyInput;
}>;
Expand All @@ -3401,12 +3442,12 @@ export type CreateViewSortsMutationVariables = Exact<{

export type CreateViewSortsMutation = { __typename?: 'Mutation', createManyViewSort: { __typename?: 'AffectedRows', count: number } };

export type CreateViewsMutationVariables = Exact<{
data: Array<ViewCreateManyInput> | ViewCreateManyInput;
export type DeleteViewMutationVariables = Exact<{
where: ViewWhereUniqueInput;
}>;


export type CreateViewsMutation = { __typename?: 'Mutation', createManyView: { __typename?: 'AffectedRows', count: number } };
export type DeleteViewMutation = { __typename?: 'Mutation', view: { __typename?: 'View', id: string, name: string } };

export type DeleteViewFiltersMutationVariables = Exact<{
where: ViewFilterWhereInput;
Expand All @@ -3422,20 +3463,13 @@ export type DeleteViewSortsMutationVariables = Exact<{

export type DeleteViewSortsMutation = { __typename?: 'Mutation', deleteManyViewSort: { __typename?: 'AffectedRows', count: number } };

export type DeleteViewsMutationVariables = Exact<{
where: ViewWhereInput;
}>;


export type DeleteViewsMutation = { __typename?: 'Mutation', deleteManyView: { __typename?: 'AffectedRows', count: number } };

export type UpdateViewMutationVariables = Exact<{
data: ViewUpdateInput;
where: ViewWhereUniqueInput;
}>;


export type UpdateViewMutation = { __typename?: 'Mutation', updateOneView: { __typename?: 'View', id: string, name: string } };
export type UpdateViewMutation = { __typename?: 'Mutation', view: { __typename?: 'View', id: string, name: string } };

export type UpdateViewFieldMutationVariables = Exact<{
data: ViewFieldUpdateInput;
Expand Down Expand Up @@ -6108,6 +6142,40 @@ export function useGetUsersLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<G
export type GetUsersQueryHookResult = ReturnType<typeof useGetUsersQuery>;
export type GetUsersLazyQueryHookResult = ReturnType<typeof useGetUsersLazyQuery>;
export type GetUsersQueryResult = Apollo.QueryResult<GetUsersQuery, GetUsersQueryVariables>;
export const CreateViewDocument = gql`
mutation CreateView($data: ViewCreateInput!) {
view: createOneView(data: $data) {
id
name
}
}
`;
export type CreateViewMutationFn = Apollo.MutationFunction<CreateViewMutation, CreateViewMutationVariables>;

/**
* __useCreateViewMutation__
*
* To run a mutation, you first call `useCreateViewMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useCreateViewMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [createViewMutation, { data, loading, error }] = useCreateViewMutation({
* variables: {
* data: // value for 'data'
* },
* });
*/
export function useCreateViewMutation(baseOptions?: Apollo.MutationHookOptions<CreateViewMutation, CreateViewMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<CreateViewMutation, CreateViewMutationVariables>(CreateViewDocument, options);
}
export type CreateViewMutationHookResult = ReturnType<typeof useCreateViewMutation>;
export type CreateViewMutationResult = Apollo.MutationResult<CreateViewMutation>;
export type CreateViewMutationOptions = Apollo.BaseMutationOptions<CreateViewMutation, CreateViewMutationVariables>;
export const CreateViewFieldsDocument = gql`
mutation CreateViewFields($data: [ViewFieldCreateManyInput!]!) {
createManyViewField(data: $data) {
Expand Down Expand Up @@ -6207,39 +6275,40 @@ export function useCreateViewSortsMutation(baseOptions?: Apollo.MutationHookOpti
export type CreateViewSortsMutationHookResult = ReturnType<typeof useCreateViewSortsMutation>;
export type CreateViewSortsMutationResult = Apollo.MutationResult<CreateViewSortsMutation>;
export type CreateViewSortsMutationOptions = Apollo.BaseMutationOptions<CreateViewSortsMutation, CreateViewSortsMutationVariables>;
export const CreateViewsDocument = gql`
mutation CreateViews($data: [ViewCreateManyInput!]!) {
createManyView(data: $data) {
count
export const DeleteViewDocument = gql`
mutation DeleteView($where: ViewWhereUniqueInput!) {
view: deleteOneView(where: $where) {
id
name
}
}
`;
export type CreateViewsMutationFn = Apollo.MutationFunction<CreateViewsMutation, CreateViewsMutationVariables>;
export type DeleteViewMutationFn = Apollo.MutationFunction<DeleteViewMutation, DeleteViewMutationVariables>;

/**
* __useCreateViewsMutation__
* __useDeleteViewMutation__
*
* To run a mutation, you first call `useCreateViewsMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useCreateViewsMutation` returns a tuple that includes:
* To run a mutation, you first call `useDeleteViewMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useDeleteViewMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [createViewsMutation, { data, loading, error }] = useCreateViewsMutation({
* const [deleteViewMutation, { data, loading, error }] = useDeleteViewMutation({
* variables: {
* data: // value for 'data'
* where: // value for 'where'
* },
* });
*/
export function useCreateViewsMutation(baseOptions?: Apollo.MutationHookOptions<CreateViewsMutation, CreateViewsMutationVariables>) {
export function useDeleteViewMutation(baseOptions?: Apollo.MutationHookOptions<DeleteViewMutation, DeleteViewMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<CreateViewsMutation, CreateViewsMutationVariables>(CreateViewsDocument, options);
return Apollo.useMutation<DeleteViewMutation, DeleteViewMutationVariables>(DeleteViewDocument, options);
}
export type CreateViewsMutationHookResult = ReturnType<typeof useCreateViewsMutation>;
export type CreateViewsMutationResult = Apollo.MutationResult<CreateViewsMutation>;
export type CreateViewsMutationOptions = Apollo.BaseMutationOptions<CreateViewsMutation, CreateViewsMutationVariables>;
export type DeleteViewMutationHookResult = ReturnType<typeof useDeleteViewMutation>;
export type DeleteViewMutationResult = Apollo.MutationResult<DeleteViewMutation>;
export type DeleteViewMutationOptions = Apollo.BaseMutationOptions<DeleteViewMutation, DeleteViewMutationVariables>;
export const DeleteViewFiltersDocument = gql`
mutation DeleteViewFilters($where: ViewFilterWhereInput!) {
deleteManyViewFilter(where: $where) {
Expand Down Expand Up @@ -6306,42 +6375,9 @@ export function useDeleteViewSortsMutation(baseOptions?: Apollo.MutationHookOpti
export type DeleteViewSortsMutationHookResult = ReturnType<typeof useDeleteViewSortsMutation>;
export type DeleteViewSortsMutationResult = Apollo.MutationResult<DeleteViewSortsMutation>;
export type DeleteViewSortsMutationOptions = Apollo.BaseMutationOptions<DeleteViewSortsMutation, DeleteViewSortsMutationVariables>;
export const DeleteViewsDocument = gql`
mutation DeleteViews($where: ViewWhereInput!) {
deleteManyView(where: $where) {
count
}
}
`;
export type DeleteViewsMutationFn = Apollo.MutationFunction<DeleteViewsMutation, DeleteViewsMutationVariables>;

/**
* __useDeleteViewsMutation__
*
* To run a mutation, you first call `useDeleteViewsMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useDeleteViewsMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [deleteViewsMutation, { data, loading, error }] = useDeleteViewsMutation({
* variables: {
* where: // value for 'where'
* },
* });
*/
export function useDeleteViewsMutation(baseOptions?: Apollo.MutationHookOptions<DeleteViewsMutation, DeleteViewsMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<DeleteViewsMutation, DeleteViewsMutationVariables>(DeleteViewsDocument, options);
}
export type DeleteViewsMutationHookResult = ReturnType<typeof useDeleteViewsMutation>;
export type DeleteViewsMutationResult = Apollo.MutationResult<DeleteViewsMutation>;
export type DeleteViewsMutationOptions = Apollo.BaseMutationOptions<DeleteViewsMutation, DeleteViewsMutationVariables>;
export const UpdateViewDocument = gql`
mutation UpdateView($data: ViewUpdateInput!, $where: ViewWhereUniqueInput!) {
updateOneView(data: $data, where: $where) {
view: updateOneView(data: $data, where: $where) {
id
name
}
Expand Down
10 changes: 10 additions & 0 deletions front/src/modules/views/graphql/mutations/createView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { gql } from '@apollo/client';

export const CREATE_VIEW = gql`
mutation CreateView($data: ViewCreateInput!) {
view: createOneView(data: $data) {
id
name
}
}
`;
9 changes: 0 additions & 9 deletions front/src/modules/views/graphql/mutations/createViews.ts

This file was deleted.

10 changes: 10 additions & 0 deletions front/src/modules/views/graphql/mutations/deleteView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { gql } from '@apollo/client';

export const DELETE_VIEW = gql`
mutation DeleteView($where: ViewWhereUniqueInput!) {
view: deleteOneView(where: $where) {
id
name
}
}
`;
9 changes: 0 additions & 9 deletions front/src/modules/views/graphql/mutations/deleteViews.ts

This file was deleted.

2 changes: 1 addition & 1 deletion front/src/modules/views/graphql/mutations/updateView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { gql } from '@apollo/client';

export const UPDATE_VIEW = gql`
mutation UpdateView($data: ViewUpdateInput!, $where: ViewWhereUniqueInput!) {
updateOneView(data: $data, where: $where) {
view: updateOneView(data: $data, where: $where) {
id
name
}
Expand Down
Loading