feat: disable atomic operation on nestjs graphql models (#751)

* feat: no atomic

* feat: update front not atomic operations

* feat: optional fields for person model & use proper gql type

* Fix bug display name

* Fix bug update user

* Fixed bug avatar URL

* Fixed display name on people cell

* Fix lint

* Fixed storybook display name

* Fix storybook requests

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
Jérémy M
2023-07-20 21:23:35 +02:00
committed by GitHub
parent 663c4d5c3f
commit 872ec9e6bb
58 changed files with 622 additions and 652 deletions

View File

@ -128,10 +128,6 @@ export type AuthTokens = {
tokens: AuthTokenPair;
};
export type BoolFieldUpdateOperationsInput = {
set?: InputMaybe<Scalars['Boolean']>;
};
export type BoolFilter = {
equals?: InputMaybe<Scalars['Boolean']>;
not?: InputMaybe<NestedBoolFilter>;
@ -362,17 +358,17 @@ export type CommentThreadUpdateInput = {
assignee?: InputMaybe<UserUpdateOneWithoutAssignedCommentThreadsNestedInput>;
attachments?: InputMaybe<AttachmentUpdateManyWithoutActivityNestedInput>;
author?: InputMaybe<UserUpdateOneRequiredWithoutAuthoredCommentThreadsNestedInput>;
body?: InputMaybe<NullableStringFieldUpdateOperationsInput>;
body?: InputMaybe<Scalars['String']>;
commentThreadTargets?: InputMaybe<CommentThreadTargetUpdateManyWithoutCommentThreadNestedInput>;
comments?: InputMaybe<CommentUpdateManyWithoutCommentThreadNestedInput>;
completedAt?: InputMaybe<NullableDateTimeFieldUpdateOperationsInput>;
createdAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
dueAt?: InputMaybe<NullableDateTimeFieldUpdateOperationsInput>;
id?: InputMaybe<StringFieldUpdateOperationsInput>;
reminderAt?: InputMaybe<NullableDateTimeFieldUpdateOperationsInput>;
title?: InputMaybe<NullableStringFieldUpdateOperationsInput>;
type?: InputMaybe<EnumActivityTypeFieldUpdateOperationsInput>;
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
completedAt?: InputMaybe<Scalars['DateTime']>;
createdAt?: InputMaybe<Scalars['DateTime']>;
dueAt?: InputMaybe<Scalars['DateTime']>;
id?: InputMaybe<Scalars['String']>;
reminderAt?: InputMaybe<Scalars['DateTime']>;
title?: InputMaybe<Scalars['String']>;
type?: InputMaybe<ActivityType>;
updatedAt?: InputMaybe<Scalars['DateTime']>;
};
export type CommentThreadUpdateManyWithoutAssigneeNestedInput = {
@ -536,14 +532,14 @@ export enum CompanyScalarFieldEnum {
export type CompanyUpdateInput = {
accountOwner?: InputMaybe<UserUpdateOneWithoutCompaniesNestedInput>;
address?: InputMaybe<StringFieldUpdateOperationsInput>;
createdAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
domainName?: InputMaybe<StringFieldUpdateOperationsInput>;
employees?: InputMaybe<NullableIntFieldUpdateOperationsInput>;
id?: InputMaybe<StringFieldUpdateOperationsInput>;
name?: InputMaybe<StringFieldUpdateOperationsInput>;
address?: InputMaybe<Scalars['String']>;
createdAt?: InputMaybe<Scalars['DateTime']>;
domainName?: InputMaybe<Scalars['String']>;
employees?: InputMaybe<Scalars['Int']>;
id?: InputMaybe<Scalars['String']>;
name?: InputMaybe<Scalars['String']>;
people?: InputMaybe<PersonUpdateManyWithoutCompanyNestedInput>;
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
updatedAt?: InputMaybe<Scalars['DateTime']>;
};
export type CompanyUpdateManyWithoutAccountOwnerNestedInput = {
@ -583,10 +579,6 @@ export type CompanyWhereUniqueInput = {
id?: InputMaybe<Scalars['String']>;
};
export type DateTimeFieldUpdateOperationsInput = {
set?: InputMaybe<Scalars['DateTime']>;
};
export type DateTimeFilter = {
equals?: InputMaybe<Scalars['DateTime']>;
gt?: InputMaybe<Scalars['DateTime']>;
@ -609,10 +601,6 @@ export type DateTimeNullableFilter = {
notIn?: InputMaybe<Array<Scalars['DateTime']>>;
};
export type EnumActivityTypeFieldUpdateOperationsInput = {
set?: InputMaybe<ActivityType>;
};
export type EnumActivityTypeFilter = {
equals?: InputMaybe<ActivityType>;
in?: InputMaybe<Array<ActivityType>>;
@ -627,10 +615,6 @@ export type EnumAttachmentTypeFilter = {
notIn?: InputMaybe<Array<AttachmentType>>;
};
export type EnumColorSchemeFieldUpdateOperationsInput = {
set?: InputMaybe<ColorScheme>;
};
export type EnumColorSchemeFilter = {
equals?: InputMaybe<ColorScheme>;
in?: InputMaybe<Array<ColorScheme>>;
@ -645,10 +629,6 @@ export type EnumCommentableTypeFilter = {
notIn?: InputMaybe<Array<CommentableType>>;
};
export type EnumPipelineProgressableTypeFieldUpdateOperationsInput = {
set?: InputMaybe<PipelineProgressableType>;
};
export type EnumPipelineProgressableTypeFilter = {
equals?: InputMaybe<PipelineProgressableType>;
in?: InputMaybe<Array<PipelineProgressableType>>;
@ -974,51 +954,35 @@ export type NestedStringNullableFilter = {
startsWith?: InputMaybe<Scalars['String']>;
};
export type NullableDateTimeFieldUpdateOperationsInput = {
set?: InputMaybe<Scalars['DateTime']>;
};
export type NullableIntFieldUpdateOperationsInput = {
decrement?: InputMaybe<Scalars['Int']>;
divide?: InputMaybe<Scalars['Int']>;
increment?: InputMaybe<Scalars['Int']>;
multiply?: InputMaybe<Scalars['Int']>;
set?: InputMaybe<Scalars['Int']>;
};
export type NullableStringFieldUpdateOperationsInput = {
set?: InputMaybe<Scalars['String']>;
};
export type Person = {
__typename?: 'Person';
PipelineProgress?: Maybe<Array<PipelineProgress>>;
_commentThreadCount: Scalars['Int'];
city: Scalars['String'];
city?: Maybe<Scalars['String']>;
commentThreads: Array<CommentThread>;
comments: Array<Comment>;
company?: Maybe<Company>;
companyId?: Maybe<Scalars['String']>;
createdAt: Scalars['DateTime'];
displayName: Scalars['String'];
email: Scalars['String'];
firstName: Scalars['String'];
email?: Maybe<Scalars['String']>;
firstName?: Maybe<Scalars['String']>;
id: Scalars['ID'];
lastName: Scalars['String'];
phone: Scalars['String'];
lastName?: Maybe<Scalars['String']>;
phone?: Maybe<Scalars['String']>;
pipelineProgresses?: Maybe<Array<PipelineProgress>>;
updatedAt: Scalars['DateTime'];
};
export type PersonCreateInput = {
PipelineProgress?: InputMaybe<PipelineProgressCreateNestedManyWithoutPointOfContactInput>;
city: Scalars['String'];
city?: InputMaybe<Scalars['String']>;
company?: InputMaybe<CompanyCreateNestedOneWithoutPeopleInput>;
createdAt?: InputMaybe<Scalars['DateTime']>;
email: Scalars['String'];
firstName: Scalars['String'];
email?: InputMaybe<Scalars['String']>;
firstName?: InputMaybe<Scalars['String']>;
id?: InputMaybe<Scalars['String']>;
lastName: Scalars['String'];
phone: Scalars['String'];
lastName?: InputMaybe<Scalars['String']>;
phone?: InputMaybe<Scalars['String']>;
pipelineProgresses?: InputMaybe<PipelineProgressCreateNestedManyWithoutPointOfContactInput>;
updatedAt?: InputMaybe<Scalars['DateTime']>;
};
@ -1026,7 +990,7 @@ export type PersonCreateNestedManyWithoutCompanyInput = {
connect?: InputMaybe<Array<PersonWhereUniqueInput>>;
};
export type PersonCreateNestedOneWithoutPipelineProgressInput = {
export type PersonCreateNestedOneWithoutPipelineProgressesInput = {
connect?: InputMaybe<PersonWhereUniqueInput>;
};
@ -1041,7 +1005,6 @@ export type PersonOrderByRelationAggregateInput = {
};
export type PersonOrderByWithRelationInput = {
PipelineProgress?: InputMaybe<PipelineProgressOrderByRelationAggregateInput>;
city?: InputMaybe<SortOrder>;
company?: InputMaybe<CompanyOrderByWithRelationInput>;
companyId?: InputMaybe<SortOrder>;
@ -1051,6 +1014,7 @@ export type PersonOrderByWithRelationInput = {
id?: InputMaybe<SortOrder>;
lastName?: InputMaybe<SortOrder>;
phone?: InputMaybe<SortOrder>;
pipelineProgresses?: InputMaybe<PipelineProgressOrderByRelationAggregateInput>;
updatedAt?: InputMaybe<SortOrder>;
};
@ -1074,16 +1038,16 @@ export enum PersonScalarFieldEnum {
}
export type PersonUpdateInput = {
PipelineProgress?: InputMaybe<PipelineProgressUpdateManyWithoutPointOfContactNestedInput>;
city?: InputMaybe<StringFieldUpdateOperationsInput>;
city?: InputMaybe<Scalars['String']>;
company?: InputMaybe<CompanyUpdateOneWithoutPeopleNestedInput>;
createdAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
email?: InputMaybe<StringFieldUpdateOperationsInput>;
firstName?: InputMaybe<StringFieldUpdateOperationsInput>;
id?: InputMaybe<StringFieldUpdateOperationsInput>;
lastName?: InputMaybe<StringFieldUpdateOperationsInput>;
phone?: InputMaybe<StringFieldUpdateOperationsInput>;
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
createdAt?: InputMaybe<Scalars['DateTime']>;
email?: InputMaybe<Scalars['String']>;
firstName?: InputMaybe<Scalars['String']>;
id?: InputMaybe<Scalars['String']>;
lastName?: InputMaybe<Scalars['String']>;
phone?: InputMaybe<Scalars['String']>;
pipelineProgresses?: InputMaybe<PipelineProgressUpdateManyWithoutPointOfContactNestedInput>;
updatedAt?: InputMaybe<Scalars['DateTime']>;
};
export type PersonUpdateManyWithoutCompanyNestedInput = {
@ -1098,7 +1062,7 @@ export type PersonUpdateManyWithoutWorkspaceNestedInput = {
set?: InputMaybe<Array<PersonWhereUniqueInput>>;
};
export type PersonUpdateOneWithoutPipelineProgressNestedInput = {
export type PersonUpdateOneWithoutPipelineProgressesNestedInput = {
connect?: InputMaybe<PersonWhereUniqueInput>;
disconnect?: InputMaybe<Scalars['Boolean']>;
};
@ -1107,16 +1071,16 @@ export type PersonWhereInput = {
AND?: InputMaybe<Array<PersonWhereInput>>;
NOT?: InputMaybe<Array<PersonWhereInput>>;
OR?: InputMaybe<Array<PersonWhereInput>>;
PipelineProgress?: InputMaybe<PipelineProgressListRelationFilter>;
city?: InputMaybe<StringFilter>;
city?: InputMaybe<StringNullableFilter>;
company?: InputMaybe<CompanyRelationFilter>;
companyId?: InputMaybe<StringNullableFilter>;
createdAt?: InputMaybe<DateTimeFilter>;
email?: InputMaybe<StringFilter>;
firstName?: InputMaybe<StringFilter>;
email?: InputMaybe<StringNullableFilter>;
firstName?: InputMaybe<StringNullableFilter>;
id?: InputMaybe<StringFilter>;
lastName?: InputMaybe<StringFilter>;
phone?: InputMaybe<StringFilter>;
lastName?: InputMaybe<StringNullableFilter>;
phone?: InputMaybe<StringNullableFilter>;
pipelineProgresses?: InputMaybe<PipelineProgressListRelationFilter>;
updatedAt?: InputMaybe<DateTimeFilter>;
};
@ -1176,7 +1140,7 @@ export type PipelineProgressCreateInput = {
id?: InputMaybe<Scalars['String']>;
pipeline: PipelineCreateNestedOneWithoutPipelineProgressesInput;
pipelineStage: PipelineStageCreateNestedOneWithoutPipelineProgressesInput;
pointOfContact?: InputMaybe<PersonCreateNestedOneWithoutPipelineProgressInput>;
pointOfContact?: InputMaybe<PersonCreateNestedOneWithoutPipelineProgressesInput>;
probability?: InputMaybe<Scalars['Int']>;
progressableId: Scalars['String'];
progressableType: PipelineProgressableType;
@ -1231,17 +1195,17 @@ export enum PipelineProgressScalarFieldEnum {
}
export type PipelineProgressUpdateInput = {
amount?: InputMaybe<NullableIntFieldUpdateOperationsInput>;
closeDate?: InputMaybe<NullableDateTimeFieldUpdateOperationsInput>;
createdAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
id?: InputMaybe<StringFieldUpdateOperationsInput>;
amount?: InputMaybe<Scalars['Int']>;
closeDate?: InputMaybe<Scalars['DateTime']>;
createdAt?: InputMaybe<Scalars['DateTime']>;
id?: InputMaybe<Scalars['String']>;
pipeline?: InputMaybe<PipelineUpdateOneRequiredWithoutPipelineProgressesNestedInput>;
pipelineStage?: InputMaybe<PipelineStageUpdateOneRequiredWithoutPipelineProgressesNestedInput>;
pointOfContact?: InputMaybe<PersonUpdateOneWithoutPipelineProgressNestedInput>;
probability?: InputMaybe<NullableIntFieldUpdateOperationsInput>;
progressableId?: InputMaybe<StringFieldUpdateOperationsInput>;
progressableType?: InputMaybe<EnumPipelineProgressableTypeFieldUpdateOperationsInput>;
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
pointOfContact?: InputMaybe<PersonUpdateOneWithoutPipelineProgressesNestedInput>;
probability?: InputMaybe<Scalars['Int']>;
progressableId?: InputMaybe<Scalars['String']>;
progressableType?: InputMaybe<PipelineProgressableType>;
updatedAt?: InputMaybe<Scalars['DateTime']>;
};
export type PipelineProgressUpdateManyWithoutPipelineStageNestedInput = {
@ -1367,15 +1331,15 @@ export enum PipelineStageScalarFieldEnum {
}
export type PipelineStageUpdateInput = {
color?: InputMaybe<StringFieldUpdateOperationsInput>;
createdAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
id?: InputMaybe<StringFieldUpdateOperationsInput>;
index?: InputMaybe<NullableIntFieldUpdateOperationsInput>;
name?: InputMaybe<StringFieldUpdateOperationsInput>;
color?: InputMaybe<Scalars['String']>;
createdAt?: InputMaybe<Scalars['DateTime']>;
id?: InputMaybe<Scalars['String']>;
index?: InputMaybe<Scalars['Int']>;
name?: InputMaybe<Scalars['String']>;
pipeline?: InputMaybe<PipelineUpdateOneRequiredWithoutPipelineStagesNestedInput>;
pipelineProgresses?: InputMaybe<PipelineProgressUpdateManyWithoutPipelineStageNestedInput>;
type?: InputMaybe<StringFieldUpdateOperationsInput>;
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
type?: InputMaybe<Scalars['String']>;
updatedAt?: InputMaybe<Scalars['DateTime']>;
};
export type PipelineStageUpdateManyWithoutWorkspaceNestedInput = {
@ -1569,10 +1533,6 @@ export enum SortOrder {
Desc = 'desc'
}
export type StringFieldUpdateOperationsInput = {
set?: InputMaybe<Scalars['String']>;
};
export type StringFilter = {
contains?: InputMaybe<Scalars['String']>;
endsWith?: InputMaybe<Scalars['String']>;
@ -1732,11 +1692,11 @@ export type UserSettingsUpdateOneRequiredWithoutUserNestedInput = {
};
export type UserSettingsUpdateWithoutUserInput = {
colorScheme?: InputMaybe<EnumColorSchemeFieldUpdateOperationsInput>;
createdAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
id?: InputMaybe<StringFieldUpdateOperationsInput>;
locale?: InputMaybe<StringFieldUpdateOperationsInput>;
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
colorScheme?: InputMaybe<ColorScheme>;
createdAt?: InputMaybe<Scalars['DateTime']>;
id?: InputMaybe<Scalars['String']>;
locale?: InputMaybe<Scalars['String']>;
updatedAt?: InputMaybe<Scalars['DateTime']>;
};
export type UserSettingsWhereInput = {
@ -1755,22 +1715,22 @@ export type UserUpdateInput = {
assignedCommentThreads?: InputMaybe<CommentThreadUpdateManyWithoutAssigneeNestedInput>;
authoredAttachments?: InputMaybe<AttachmentUpdateManyWithoutAuthorNestedInput>;
authoredCommentThreads?: InputMaybe<CommentThreadUpdateManyWithoutAuthorNestedInput>;
avatarUrl?: InputMaybe<NullableStringFieldUpdateOperationsInput>;
avatarUrl?: InputMaybe<Scalars['String']>;
comments?: InputMaybe<CommentUpdateManyWithoutAuthorNestedInput>;
companies?: InputMaybe<CompanyUpdateManyWithoutAccountOwnerNestedInput>;
createdAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
disabled?: InputMaybe<BoolFieldUpdateOperationsInput>;
email?: InputMaybe<StringFieldUpdateOperationsInput>;
emailVerified?: InputMaybe<BoolFieldUpdateOperationsInput>;
firstName?: InputMaybe<NullableStringFieldUpdateOperationsInput>;
id?: InputMaybe<StringFieldUpdateOperationsInput>;
lastName?: InputMaybe<NullableStringFieldUpdateOperationsInput>;
lastSeen?: InputMaybe<NullableDateTimeFieldUpdateOperationsInput>;
locale?: InputMaybe<StringFieldUpdateOperationsInput>;
createdAt?: InputMaybe<Scalars['DateTime']>;
disabled?: InputMaybe<Scalars['Boolean']>;
email?: InputMaybe<Scalars['String']>;
emailVerified?: InputMaybe<Scalars['Boolean']>;
firstName?: InputMaybe<Scalars['String']>;
id?: InputMaybe<Scalars['String']>;
lastName?: InputMaybe<Scalars['String']>;
lastSeen?: InputMaybe<Scalars['DateTime']>;
locale?: InputMaybe<Scalars['String']>;
metadata?: InputMaybe<Scalars['JSON']>;
phoneNumber?: InputMaybe<NullableStringFieldUpdateOperationsInput>;
phoneNumber?: InputMaybe<Scalars['String']>;
settings?: InputMaybe<UserSettingsUpdateOneRequiredWithoutUserNestedInput>;
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
updatedAt?: InputMaybe<Scalars['DateTime']>;
};
export type UserUpdateOneRequiredWithoutAuthoredCommentThreadsNestedInput = {
@ -1902,17 +1862,17 @@ export type WorkspaceUpdateInput = {
commentThreads?: InputMaybe<CommentThreadUpdateManyWithoutWorkspaceNestedInput>;
comments?: InputMaybe<CommentUpdateManyWithoutWorkspaceNestedInput>;
companies?: InputMaybe<CompanyUpdateManyWithoutWorkspaceNestedInput>;
createdAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
displayName?: InputMaybe<NullableStringFieldUpdateOperationsInput>;
domainName?: InputMaybe<NullableStringFieldUpdateOperationsInput>;
id?: InputMaybe<StringFieldUpdateOperationsInput>;
inviteHash?: InputMaybe<NullableStringFieldUpdateOperationsInput>;
logo?: InputMaybe<NullableStringFieldUpdateOperationsInput>;
createdAt?: InputMaybe<Scalars['DateTime']>;
displayName?: InputMaybe<Scalars['String']>;
domainName?: InputMaybe<Scalars['String']>;
id?: InputMaybe<Scalars['String']>;
inviteHash?: InputMaybe<Scalars['String']>;
logo?: InputMaybe<Scalars['String']>;
people?: InputMaybe<PersonUpdateManyWithoutWorkspaceNestedInput>;
pipelineProgresses?: InputMaybe<PipelineProgressUpdateManyWithoutWorkspaceNestedInput>;
pipelineStages?: InputMaybe<PipelineStageUpdateManyWithoutWorkspaceNestedInput>;
pipelines?: InputMaybe<PipelineUpdateManyWithoutWorkspaceNestedInput>;
updatedAt?: InputMaybe<DateTimeFieldUpdateOperationsInput>;
updatedAt?: InputMaybe<Scalars['DateTime']>;
workspaceMember?: InputMaybe<WorkspaceMemberUpdateManyWithoutWorkspaceNestedInput>;
};
@ -1946,14 +1906,14 @@ export type GetCommentThreadsByTargetsQueryVariables = Exact<{
}>;
export type GetCommentThreadsByTargetsQuery = { __typename?: 'Query', findManyCommentThreads: Array<{ __typename?: 'CommentThread', id: string, createdAt: string, title?: string | null, body?: string | null, type: ActivityType, author: { __typename?: 'User', id: string, firstName?: string | null, lastName?: string | null }, comments?: Array<{ __typename?: 'Comment', id: string, body: string, createdAt: string, updatedAt: string, author: { __typename?: 'User', id: string, displayName: string, firstName?: string | null, lastName?: string | null, avatarUrl?: string | null } }> | null, commentThreadTargets?: Array<{ __typename?: 'CommentThreadTarget', id: string, commentableId: string, commentableType: CommentableType }> | null }> };
export type GetCommentThreadsByTargetsQuery = { __typename?: 'Query', findManyCommentThreads: Array<{ __typename?: 'CommentThread', id: string, createdAt: string, title?: string | null, body?: string | null, type: ActivityType, author: { __typename?: 'User', id: string, firstName?: string | null, lastName?: string | null, displayName: string }, comments?: Array<{ __typename?: 'Comment', id: string, body: string, createdAt: string, updatedAt: string, author: { __typename?: 'User', id: string, displayName: string, firstName?: string | null, lastName?: string | null, avatarUrl?: string | null } }> | null, commentThreadTargets?: Array<{ __typename?: 'CommentThreadTarget', id: string, commentableId: string, commentableType: CommentableType }> | null }> };
export type GetCommentThreadQueryVariables = Exact<{
commentThreadId: Scalars['String'];
}>;
export type GetCommentThreadQuery = { __typename?: 'Query', findManyCommentThreads: Array<{ __typename?: 'CommentThread', id: string, createdAt: string, body?: string | null, title?: string | null, type: ActivityType, author: { __typename?: 'User', id: string, firstName?: string | null, lastName?: string | null }, comments?: Array<{ __typename?: 'Comment', id: string, body: string, createdAt: string, updatedAt: string, author: { __typename?: 'User', id: string, displayName: string, firstName?: string | null, lastName?: string | null, avatarUrl?: string | null } }> | null, commentThreadTargets?: Array<{ __typename?: 'CommentThreadTarget', id: string, commentableId: string, commentableType: CommentableType }> | null }> };
export type GetCommentThreadQuery = { __typename?: 'Query', findManyCommentThreads: Array<{ __typename?: 'CommentThread', id: string, createdAt: string, body?: string | null, title?: string | null, type: ActivityType, author: { __typename?: 'User', id: string, firstName?: string | null, lastName?: string | null, displayName: string }, comments?: Array<{ __typename?: 'Comment', id: string, body: string, createdAt: string, updatedAt: string, author: { __typename?: 'User', id: string, displayName: string, firstName?: string | null, lastName?: string | null, avatarUrl?: string | null } }> | null, commentThreadTargets?: Array<{ __typename?: 'CommentThreadTarget', id: string, commentableId: string, commentableType: CommentableType }> | null }> };
export type AddCommentThreadTargetOnCommentThreadMutationVariables = Exact<{
commentThreadId: Scalars['String'];
@ -2065,37 +2025,27 @@ export type GetCompanyQueryVariables = Exact<{
export type GetCompanyQuery = { __typename?: 'Query', findUniqueCompany: { __typename?: 'Company', id: string, domainName: string, name: string, createdAt: string, address: string, employees?: number | null, _commentThreadCount: number, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, avatarUrl?: string | null } | null } };
export type UpdateCompanyMutationVariables = Exact<{
id?: InputMaybe<Scalars['String']>;
name?: InputMaybe<Scalars['String']>;
domainName?: InputMaybe<Scalars['String']>;
accountOwnerId?: InputMaybe<Scalars['String']>;
createdAt?: InputMaybe<Scalars['DateTime']>;
address?: InputMaybe<Scalars['String']>;
employees?: InputMaybe<Scalars['Int']>;
export type UpdateOneCompanyMutationVariables = Exact<{
where: CompanyWhereUniqueInput;
data: CompanyUpdateInput;
}>;
export type UpdateCompanyMutation = { __typename?: 'Mutation', updateOneCompany?: { __typename?: 'Company', address: string, createdAt: string, domainName: string, employees?: number | null, id: string, name: string, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, firstName?: string | null, lastName?: string | null } | null } | null };
export type UpdateOneCompanyMutation = { __typename?: 'Mutation', updateOneCompany?: { __typename?: 'Company', address: string, createdAt: string, domainName: string, employees?: number | null, id: string, name: string, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, firstName?: string | null, lastName?: string | null } | null } | null };
export type InsertCompanyMutationVariables = Exact<{
id: Scalars['String'];
name: Scalars['String'];
domainName: Scalars['String'];
createdAt?: InputMaybe<Scalars['DateTime']>;
address: Scalars['String'];
employees?: InputMaybe<Scalars['Int']>;
export type InsertOneCompanyMutationVariables = Exact<{
data: CompanyCreateInput;
}>;
export type InsertCompanyMutation = { __typename?: 'Mutation', createOneCompany: { __typename?: 'Company', address: string, createdAt: string, domainName: string, employees?: number | null, id: string, name: string } };
export type InsertOneCompanyMutation = { __typename?: 'Mutation', createOneCompany: { __typename?: 'Company', address: string, createdAt: string, domainName: string, employees?: number | null, id: string, name: string } };
export type DeleteCompaniesMutationVariables = Exact<{
export type DeleteManyCompaniesMutationVariables = Exact<{
ids?: InputMaybe<Array<Scalars['String']> | Scalars['String']>;
}>;
export type DeleteCompaniesMutation = { __typename?: 'Mutation', deleteManyCompany: { __typename?: 'AffectedRows', count: number } };
export type DeleteManyCompaniesMutation = { __typename?: 'Mutation', deleteManyCompany: { __typename?: 'AffectedRows', count: number } };
export type GetPeopleQueryVariables = Exact<{
orderBy?: InputMaybe<Array<PersonOrderByWithRelationInput> | PersonOrderByWithRelationInput>;
@ -2104,28 +2054,28 @@ export type GetPeopleQueryVariables = Exact<{
}>;
export type GetPeopleQuery = { __typename?: 'Query', people: Array<{ __typename?: 'Person', id: string, phone: string, email: string, city: string, firstName: string, lastName: string, createdAt: string, _commentThreadCount: number, company?: { __typename?: 'Company', id: string, name: string, domainName: string } | null }> };
export type GetPeopleQuery = { __typename?: 'Query', people: Array<{ __typename?: 'Person', id: string, phone?: string | null, email?: string | null, city?: string | null, firstName?: string | null, lastName?: string | null, displayName: string, createdAt: string, _commentThreadCount: number, company?: { __typename?: 'Company', id: string, name: string, domainName: string } | null }> };
export type GetPersonPhoneByIdQueryVariables = Exact<{
id: Scalars['String'];
}>;
export type GetPersonPhoneByIdQuery = { __typename?: 'Query', person: { __typename?: 'Person', id: string, phone: string } };
export type GetPersonPhoneByIdQuery = { __typename?: 'Query', person: { __typename?: 'Person', id: string, phone?: string | null } };
export type GetPersonEmailByIdQueryVariables = Exact<{
id: Scalars['String'];
}>;
export type GetPersonEmailByIdQuery = { __typename?: 'Query', person: { __typename?: 'Person', id: string, email: string } };
export type GetPersonEmailByIdQuery = { __typename?: 'Query', person: { __typename?: 'Person', id: string, email?: string | null } };
export type GetPersonNamesAndCommentCountByIdQueryVariables = Exact<{
id: Scalars['String'];
}>;
export type GetPersonNamesAndCommentCountByIdQuery = { __typename?: 'Query', person: { __typename?: 'Person', id: string, firstName: string, lastName: string, _commentThreadCount: number } };
export type GetPersonNamesAndCommentCountByIdQuery = { __typename?: 'Query', person: { __typename?: 'Person', id: string, firstName?: string | null, lastName?: string | null, displayName: string, _commentThreadCount: number } };
export type GetPersonCompanyByIdQueryVariables = Exact<{
id: Scalars['String'];
@ -2153,48 +2103,36 @@ export type GetPersonCityByIdQueryVariables = Exact<{
}>;
export type GetPersonCityByIdQuery = { __typename?: 'Query', person: { __typename?: 'Person', id: string, city: string } };
export type GetPersonCityByIdQuery = { __typename?: 'Query', person: { __typename?: 'Person', id: string, city?: string | null } };
export type GetPersonQueryVariables = Exact<{
id: Scalars['String'];
}>;
export type GetPersonQuery = { __typename?: 'Query', findUniquePerson: { __typename?: 'Person', id: string, firstName: string, lastName: string, displayName: string, email: string, createdAt: string, city: string, phone: string, _commentThreadCount: number, company?: { __typename?: 'Company', id: string, name: string, domainName: string } | null } };
export type GetPersonQuery = { __typename?: 'Query', findUniquePerson: { __typename?: 'Person', id: string, firstName?: string | null, lastName?: string | null, displayName: string, email?: string | null, createdAt: string, city?: string | null, phone?: string | null, _commentThreadCount: number, company?: { __typename?: 'Company', id: string, name: string, domainName: string } | null } };
export type UpdatePeopleMutationVariables = Exact<{
id?: InputMaybe<Scalars['String']>;
firstName?: InputMaybe<Scalars['String']>;
lastName?: InputMaybe<Scalars['String']>;
phone?: InputMaybe<Scalars['String']>;
city?: InputMaybe<Scalars['String']>;
companyId?: InputMaybe<Scalars['String']>;
email?: InputMaybe<Scalars['String']>;
createdAt?: InputMaybe<Scalars['DateTime']>;
export type UpdateOnePersonMutationVariables = Exact<{
where: PersonWhereUniqueInput;
data: PersonUpdateInput;
}>;
export type UpdatePeopleMutation = { __typename?: 'Mutation', updateOnePerson?: { __typename?: 'Person', id: string, city: string, email: string, firstName: string, lastName: string, phone: string, createdAt: string, company?: { __typename?: 'Company', domainName: string, name: string, id: string } | null } | null };
export type UpdateOnePersonMutation = { __typename?: 'Mutation', updateOnePerson?: { __typename?: 'Person', id: string, city?: string | null, email?: string | null, firstName?: string | null, lastName?: string | null, displayName: string, phone?: string | null, createdAt: string, company?: { __typename?: 'Company', domainName: string, name: string, id: string } | null } | null };
export type InsertPersonMutationVariables = Exact<{
id: Scalars['String'];
firstName: Scalars['String'];
lastName: Scalars['String'];
phone: Scalars['String'];
city: Scalars['String'];
email: Scalars['String'];
createdAt?: InputMaybe<Scalars['DateTime']>;
export type InsertOnePersonMutationVariables = Exact<{
data: PersonCreateInput;
}>;
export type InsertPersonMutation = { __typename?: 'Mutation', createOnePerson: { __typename?: 'Person', id: string, city: string, email: string, firstName: string, lastName: string, phone: string, createdAt: string, company?: { __typename?: 'Company', domainName: string, name: string, id: string } | null } };
export type InsertOnePersonMutation = { __typename?: 'Mutation', createOnePerson: { __typename?: 'Person', id: string, city?: string | null, email?: string | null, firstName?: string | null, lastName?: string | null, displayName: string, phone?: string | null, createdAt: string, company?: { __typename?: 'Company', domainName: string, name: string, id: string } | null } };
export type DeletePeopleMutationVariables = Exact<{
export type DeleteManyPersonMutationVariables = Exact<{
ids?: InputMaybe<Array<Scalars['String']> | Scalars['String']>;
}>;
export type DeletePeopleMutation = { __typename?: 'Mutation', deleteManyPerson: { __typename?: 'AffectedRows', count: number } };
export type DeleteManyPersonMutation = { __typename?: 'Mutation', deleteManyPerson: { __typename?: 'AffectedRows', count: number } };
export type GetPipelinesQueryVariables = Exact<{
where?: InputMaybe<PipelineWhereInput>;
@ -2209,7 +2147,7 @@ export type GetPipelineProgressQueryVariables = Exact<{
}>;
export type GetPipelineProgressQuery = { __typename?: 'Query', findManyPipelineProgress: Array<{ __typename?: 'PipelineProgress', id: string, pipelineStageId: string, progressableType: PipelineProgressableType, progressableId: string, amount?: number | null, closeDate?: string | null, pointOfContactId?: string | null, probability?: number | null, pointOfContact?: { __typename?: 'Person', id: string, firstName: string, lastName: string } | null }> };
export type GetPipelineProgressQuery = { __typename?: 'Query', findManyPipelineProgress: Array<{ __typename?: 'PipelineProgress', id: string, pipelineStageId: string, progressableType: PipelineProgressableType, progressableId: string, amount?: number | null, closeDate?: string | null, pointOfContactId?: string | null, probability?: number | null, pointOfContact?: { __typename?: 'Person', id: string, firstName?: string | null, lastName?: string | null, displayName: string } | null }> };
export type UpdateOnePipelineProgressMutationVariables = Exact<{
id?: InputMaybe<Scalars['String']>;
@ -2263,7 +2201,7 @@ export type SearchPeopleQueryVariables = Exact<{
}>;
export type SearchPeopleQuery = { __typename?: 'Query', searchResults: Array<{ __typename?: 'Person', id: string, phone: string, email: string, city: string, firstName: string, lastName: string, createdAt: string }> };
export type SearchPeopleQuery = { __typename?: 'Query', searchResults: Array<{ __typename?: 'Person', id: string, phone?: string | null, email?: string | null, city?: string | null, firstName?: string | null, lastName?: string | null, createdAt: string }> };
export type SearchUserQueryVariables = Exact<{
where?: InputMaybe<UserWhereInput>;
@ -2323,7 +2261,7 @@ export type RemoveProfilePictureMutation = { __typename?: 'Mutation', updateUser
export type GetWorkspaceMembersQueryVariables = Exact<{ [key: string]: never; }>;
export type GetWorkspaceMembersQuery = { __typename?: 'Query', workspaceMembers: Array<{ __typename?: 'WorkspaceMember', id: string, user: { __typename?: 'User', id: string, email: string, avatarUrl?: string | null, firstName?: string | null, lastName?: string | null } }> };
export type GetWorkspaceMembersQuery = { __typename?: 'Query', workspaceMembers: Array<{ __typename?: 'WorkspaceMember', id: string, user: { __typename?: 'User', id: string, email: string, avatarUrl?: string | null, firstName?: string | null, lastName?: string | null, displayName: string } }> };
export type UpdateWorkspaceMutationVariables = Exact<{
data: WorkspaceUpdateInput;
@ -2478,6 +2416,7 @@ export const GetCommentThreadsByTargetsDocument = gql`
id
firstName
lastName
displayName
}
comments {
id
@ -2541,6 +2480,7 @@ export const GetCommentThreadDocument = gql`
id
firstName
lastName
displayName
}
comments {
id
@ -2723,7 +2663,7 @@ export const UpdateCommentThreadDocument = gql`
mutation UpdateCommentThread($id: String!, $body: String, $title: String, $type: ActivityType) {
updateOneCommentThread(
where: {id: $id}
data: {body: {set: $body}, title: {set: $title}, type: {set: $type}}
data: {body: $body, title: $title, type: $type}
) {
id
body
@ -3181,12 +3121,9 @@ export function useGetCompanyLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions
export type GetCompanyQueryHookResult = ReturnType<typeof useGetCompanyQuery>;
export type GetCompanyLazyQueryHookResult = ReturnType<typeof useGetCompanyLazyQuery>;
export type GetCompanyQueryResult = Apollo.QueryResult<GetCompanyQuery, GetCompanyQueryVariables>;
export const UpdateCompanyDocument = gql`
mutation UpdateCompany($id: String, $name: String, $domainName: String, $accountOwnerId: String, $createdAt: DateTime, $address: String, $employees: Int) {
updateOneCompany(
where: {id: $id}
data: {accountOwner: {connect: {id: $accountOwnerId}}, address: {set: $address}, domainName: {set: $domainName}, employees: {set: $employees}, name: {set: $name}, createdAt: {set: $createdAt}}
) {
export const UpdateOneCompanyDocument = gql`
mutation UpdateOneCompany($where: CompanyWhereUniqueInput!, $data: CompanyUpdateInput!) {
updateOneCompany(data: $data, where: $where) {
accountOwner {
id
email
@ -3203,43 +3140,36 @@ export const UpdateCompanyDocument = gql`
}
}
`;
export type UpdateCompanyMutationFn = Apollo.MutationFunction<UpdateCompanyMutation, UpdateCompanyMutationVariables>;
export type UpdateOneCompanyMutationFn = Apollo.MutationFunction<UpdateOneCompanyMutation, UpdateOneCompanyMutationVariables>;
/**
* __useUpdateCompanyMutation__
* __useUpdateOneCompanyMutation__
*
* To run a mutation, you first call `useUpdateCompanyMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useUpdateCompanyMutation` returns a tuple that includes:
* To run a mutation, you first call `useUpdateOneCompanyMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useUpdateOneCompanyMutation` 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 [updateCompanyMutation, { data, loading, error }] = useUpdateCompanyMutation({
* const [updateOneCompanyMutation, { data, loading, error }] = useUpdateOneCompanyMutation({
* variables: {
* id: // value for 'id'
* name: // value for 'name'
* domainName: // value for 'domainName'
* accountOwnerId: // value for 'accountOwnerId'
* createdAt: // value for 'createdAt'
* address: // value for 'address'
* employees: // value for 'employees'
* where: // value for 'where'
* data: // value for 'data'
* },
* });
*/
export function useUpdateCompanyMutation(baseOptions?: Apollo.MutationHookOptions<UpdateCompanyMutation, UpdateCompanyMutationVariables>) {
export function useUpdateOneCompanyMutation(baseOptions?: Apollo.MutationHookOptions<UpdateOneCompanyMutation, UpdateOneCompanyMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<UpdateCompanyMutation, UpdateCompanyMutationVariables>(UpdateCompanyDocument, options);
return Apollo.useMutation<UpdateOneCompanyMutation, UpdateOneCompanyMutationVariables>(UpdateOneCompanyDocument, options);
}
export type UpdateCompanyMutationHookResult = ReturnType<typeof useUpdateCompanyMutation>;
export type UpdateCompanyMutationResult = Apollo.MutationResult<UpdateCompanyMutation>;
export type UpdateCompanyMutationOptions = Apollo.BaseMutationOptions<UpdateCompanyMutation, UpdateCompanyMutationVariables>;
export const InsertCompanyDocument = gql`
mutation InsertCompany($id: String!, $name: String!, $domainName: String!, $createdAt: DateTime, $address: String!, $employees: Int) {
createOneCompany(
data: {id: $id, name: $name, domainName: $domainName, createdAt: $createdAt, address: $address, employees: $employees}
) {
export type UpdateOneCompanyMutationHookResult = ReturnType<typeof useUpdateOneCompanyMutation>;
export type UpdateOneCompanyMutationResult = Apollo.MutationResult<UpdateOneCompanyMutation>;
export type UpdateOneCompanyMutationOptions = Apollo.BaseMutationOptions<UpdateOneCompanyMutation, UpdateOneCompanyMutationVariables>;
export const InsertOneCompanyDocument = gql`
mutation InsertOneCompany($data: CompanyCreateInput!) {
createOneCompany(data: $data) {
address
createdAt
domainName
@ -3249,70 +3179,65 @@ export const InsertCompanyDocument = gql`
}
}
`;
export type InsertCompanyMutationFn = Apollo.MutationFunction<InsertCompanyMutation, InsertCompanyMutationVariables>;
export type InsertOneCompanyMutationFn = Apollo.MutationFunction<InsertOneCompanyMutation, InsertOneCompanyMutationVariables>;
/**
* __useInsertCompanyMutation__
* __useInsertOneCompanyMutation__
*
* To run a mutation, you first call `useInsertCompanyMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useInsertCompanyMutation` returns a tuple that includes:
* To run a mutation, you first call `useInsertOneCompanyMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useInsertOneCompanyMutation` 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 [insertCompanyMutation, { data, loading, error }] = useInsertCompanyMutation({
* const [insertOneCompanyMutation, { data, loading, error }] = useInsertOneCompanyMutation({
* variables: {
* id: // value for 'id'
* name: // value for 'name'
* domainName: // value for 'domainName'
* createdAt: // value for 'createdAt'
* address: // value for 'address'
* employees: // value for 'employees'
* data: // value for 'data'
* },
* });
*/
export function useInsertCompanyMutation(baseOptions?: Apollo.MutationHookOptions<InsertCompanyMutation, InsertCompanyMutationVariables>) {
export function useInsertOneCompanyMutation(baseOptions?: Apollo.MutationHookOptions<InsertOneCompanyMutation, InsertOneCompanyMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<InsertCompanyMutation, InsertCompanyMutationVariables>(InsertCompanyDocument, options);
return Apollo.useMutation<InsertOneCompanyMutation, InsertOneCompanyMutationVariables>(InsertOneCompanyDocument, options);
}
export type InsertCompanyMutationHookResult = ReturnType<typeof useInsertCompanyMutation>;
export type InsertCompanyMutationResult = Apollo.MutationResult<InsertCompanyMutation>;
export type InsertCompanyMutationOptions = Apollo.BaseMutationOptions<InsertCompanyMutation, InsertCompanyMutationVariables>;
export const DeleteCompaniesDocument = gql`
mutation DeleteCompanies($ids: [String!]) {
export type InsertOneCompanyMutationHookResult = ReturnType<typeof useInsertOneCompanyMutation>;
export type InsertOneCompanyMutationResult = Apollo.MutationResult<InsertOneCompanyMutation>;
export type InsertOneCompanyMutationOptions = Apollo.BaseMutationOptions<InsertOneCompanyMutation, InsertOneCompanyMutationVariables>;
export const DeleteManyCompaniesDocument = gql`
mutation DeleteManyCompanies($ids: [String!]) {
deleteManyCompany(where: {id: {in: $ids}}) {
count
}
}
`;
export type DeleteCompaniesMutationFn = Apollo.MutationFunction<DeleteCompaniesMutation, DeleteCompaniesMutationVariables>;
export type DeleteManyCompaniesMutationFn = Apollo.MutationFunction<DeleteManyCompaniesMutation, DeleteManyCompaniesMutationVariables>;
/**
* __useDeleteCompaniesMutation__
* __useDeleteManyCompaniesMutation__
*
* To run a mutation, you first call `useDeleteCompaniesMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useDeleteCompaniesMutation` returns a tuple that includes:
* To run a mutation, you first call `useDeleteManyCompaniesMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useDeleteManyCompaniesMutation` 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 [deleteCompaniesMutation, { data, loading, error }] = useDeleteCompaniesMutation({
* const [deleteManyCompaniesMutation, { data, loading, error }] = useDeleteManyCompaniesMutation({
* variables: {
* ids: // value for 'ids'
* },
* });
*/
export function useDeleteCompaniesMutation(baseOptions?: Apollo.MutationHookOptions<DeleteCompaniesMutation, DeleteCompaniesMutationVariables>) {
export function useDeleteManyCompaniesMutation(baseOptions?: Apollo.MutationHookOptions<DeleteManyCompaniesMutation, DeleteManyCompaniesMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<DeleteCompaniesMutation, DeleteCompaniesMutationVariables>(DeleteCompaniesDocument, options);
return Apollo.useMutation<DeleteManyCompaniesMutation, DeleteManyCompaniesMutationVariables>(DeleteManyCompaniesDocument, options);
}
export type DeleteCompaniesMutationHookResult = ReturnType<typeof useDeleteCompaniesMutation>;
export type DeleteCompaniesMutationResult = Apollo.MutationResult<DeleteCompaniesMutation>;
export type DeleteCompaniesMutationOptions = Apollo.BaseMutationOptions<DeleteCompaniesMutation, DeleteCompaniesMutationVariables>;
export type DeleteManyCompaniesMutationHookResult = ReturnType<typeof useDeleteManyCompaniesMutation>;
export type DeleteManyCompaniesMutationResult = Apollo.MutationResult<DeleteManyCompaniesMutation>;
export type DeleteManyCompaniesMutationOptions = Apollo.BaseMutationOptions<DeleteManyCompaniesMutation, DeleteManyCompaniesMutationVariables>;
export const GetPeopleDocument = gql`
query GetPeople($orderBy: [PersonOrderByWithRelationInput!], $where: PersonWhereInput, $limit: Int) {
people: findManyPerson(orderBy: $orderBy, where: $where, take: $limit) {
@ -3322,6 +3247,7 @@ export const GetPeopleDocument = gql`
city
firstName
lastName
displayName
createdAt
_commentThreadCount
company {
@ -3440,6 +3366,7 @@ export const GetPersonNamesAndCommentCountByIdDocument = gql`
id
firstName
lastName
displayName
_commentThreadCount
}
}
@ -3668,12 +3595,9 @@ export function useGetPersonLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<
export type GetPersonQueryHookResult = ReturnType<typeof useGetPersonQuery>;
export type GetPersonLazyQueryHookResult = ReturnType<typeof useGetPersonLazyQuery>;
export type GetPersonQueryResult = Apollo.QueryResult<GetPersonQuery, GetPersonQueryVariables>;
export const UpdatePeopleDocument = gql`
mutation UpdatePeople($id: String, $firstName: String, $lastName: String, $phone: String, $city: String, $companyId: String, $email: String, $createdAt: DateTime) {
updateOnePerson(
where: {id: $id}
data: {city: {set: $city}, company: {connect: {id: $companyId}}, email: {set: $email}, firstName: {set: $firstName}, id: {set: $id}, lastName: {set: $lastName}, phone: {set: $phone}, createdAt: {set: $createdAt}}
) {
export const UpdateOnePersonDocument = gql`
mutation UpdateOnePerson($where: PersonWhereUniqueInput!, $data: PersonUpdateInput!) {
updateOnePerson(data: $data, where: $where) {
id
city
company {
@ -3684,49 +3608,42 @@ export const UpdatePeopleDocument = gql`
email
firstName
lastName
displayName
phone
createdAt
}
}
`;
export type UpdatePeopleMutationFn = Apollo.MutationFunction<UpdatePeopleMutation, UpdatePeopleMutationVariables>;
export type UpdateOnePersonMutationFn = Apollo.MutationFunction<UpdateOnePersonMutation, UpdateOnePersonMutationVariables>;
/**
* __useUpdatePeopleMutation__
* __useUpdateOnePersonMutation__
*
* To run a mutation, you first call `useUpdatePeopleMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useUpdatePeopleMutation` returns a tuple that includes:
* To run a mutation, you first call `useUpdateOnePersonMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useUpdateOnePersonMutation` 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 [updatePeopleMutation, { data, loading, error }] = useUpdatePeopleMutation({
* const [updateOnePersonMutation, { data, loading, error }] = useUpdateOnePersonMutation({
* variables: {
* id: // value for 'id'
* firstName: // value for 'firstName'
* lastName: // value for 'lastName'
* phone: // value for 'phone'
* city: // value for 'city'
* companyId: // value for 'companyId'
* email: // value for 'email'
* createdAt: // value for 'createdAt'
* where: // value for 'where'
* data: // value for 'data'
* },
* });
*/
export function useUpdatePeopleMutation(baseOptions?: Apollo.MutationHookOptions<UpdatePeopleMutation, UpdatePeopleMutationVariables>) {
export function useUpdateOnePersonMutation(baseOptions?: Apollo.MutationHookOptions<UpdateOnePersonMutation, UpdateOnePersonMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<UpdatePeopleMutation, UpdatePeopleMutationVariables>(UpdatePeopleDocument, options);
return Apollo.useMutation<UpdateOnePersonMutation, UpdateOnePersonMutationVariables>(UpdateOnePersonDocument, options);
}
export type UpdatePeopleMutationHookResult = ReturnType<typeof useUpdatePeopleMutation>;
export type UpdatePeopleMutationResult = Apollo.MutationResult<UpdatePeopleMutation>;
export type UpdatePeopleMutationOptions = Apollo.BaseMutationOptions<UpdatePeopleMutation, UpdatePeopleMutationVariables>;
export const InsertPersonDocument = gql`
mutation InsertPerson($id: String!, $firstName: String!, $lastName: String!, $phone: String!, $city: String!, $email: String!, $createdAt: DateTime) {
createOnePerson(
data: {id: $id, firstName: $firstName, lastName: $lastName, phone: $phone, city: $city, email: $email, createdAt: $createdAt}
) {
export type UpdateOnePersonMutationHookResult = ReturnType<typeof useUpdateOnePersonMutation>;
export type UpdateOnePersonMutationResult = Apollo.MutationResult<UpdateOnePersonMutation>;
export type UpdateOnePersonMutationOptions = Apollo.BaseMutationOptions<UpdateOnePersonMutation, UpdateOnePersonMutationVariables>;
export const InsertOnePersonDocument = gql`
mutation InsertOnePerson($data: PersonCreateInput!) {
createOnePerson(data: $data) {
id
city
company {
@ -3737,76 +3654,71 @@ export const InsertPersonDocument = gql`
email
firstName
lastName
displayName
phone
createdAt
}
}
`;
export type InsertPersonMutationFn = Apollo.MutationFunction<InsertPersonMutation, InsertPersonMutationVariables>;
export type InsertOnePersonMutationFn = Apollo.MutationFunction<InsertOnePersonMutation, InsertOnePersonMutationVariables>;
/**
* __useInsertPersonMutation__
* __useInsertOnePersonMutation__
*
* To run a mutation, you first call `useInsertPersonMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useInsertPersonMutation` returns a tuple that includes:
* To run a mutation, you first call `useInsertOnePersonMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useInsertOnePersonMutation` 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 [insertPersonMutation, { data, loading, error }] = useInsertPersonMutation({
* const [insertOnePersonMutation, { data, loading, error }] = useInsertOnePersonMutation({
* variables: {
* id: // value for 'id'
* firstName: // value for 'firstName'
* lastName: // value for 'lastName'
* phone: // value for 'phone'
* city: // value for 'city'
* email: // value for 'email'
* createdAt: // value for 'createdAt'
* data: // value for 'data'
* },
* });
*/
export function useInsertPersonMutation(baseOptions?: Apollo.MutationHookOptions<InsertPersonMutation, InsertPersonMutationVariables>) {
export function useInsertOnePersonMutation(baseOptions?: Apollo.MutationHookOptions<InsertOnePersonMutation, InsertOnePersonMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<InsertPersonMutation, InsertPersonMutationVariables>(InsertPersonDocument, options);
return Apollo.useMutation<InsertOnePersonMutation, InsertOnePersonMutationVariables>(InsertOnePersonDocument, options);
}
export type InsertPersonMutationHookResult = ReturnType<typeof useInsertPersonMutation>;
export type InsertPersonMutationResult = Apollo.MutationResult<InsertPersonMutation>;
export type InsertPersonMutationOptions = Apollo.BaseMutationOptions<InsertPersonMutation, InsertPersonMutationVariables>;
export const DeletePeopleDocument = gql`
mutation DeletePeople($ids: [String!]) {
export type InsertOnePersonMutationHookResult = ReturnType<typeof useInsertOnePersonMutation>;
export type InsertOnePersonMutationResult = Apollo.MutationResult<InsertOnePersonMutation>;
export type InsertOnePersonMutationOptions = Apollo.BaseMutationOptions<InsertOnePersonMutation, InsertOnePersonMutationVariables>;
export const DeleteManyPersonDocument = gql`
mutation DeleteManyPerson($ids: [String!]) {
deleteManyPerson(where: {id: {in: $ids}}) {
count
}
}
`;
export type DeletePeopleMutationFn = Apollo.MutationFunction<DeletePeopleMutation, DeletePeopleMutationVariables>;
export type DeleteManyPersonMutationFn = Apollo.MutationFunction<DeleteManyPersonMutation, DeleteManyPersonMutationVariables>;
/**
* __useDeletePeopleMutation__
* __useDeleteManyPersonMutation__
*
* To run a mutation, you first call `useDeletePeopleMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useDeletePeopleMutation` returns a tuple that includes:
* To run a mutation, you first call `useDeleteManyPersonMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useDeleteManyPersonMutation` 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 [deletePeopleMutation, { data, loading, error }] = useDeletePeopleMutation({
* const [deleteManyPersonMutation, { data, loading, error }] = useDeleteManyPersonMutation({
* variables: {
* ids: // value for 'ids'
* },
* });
*/
export function useDeletePeopleMutation(baseOptions?: Apollo.MutationHookOptions<DeletePeopleMutation, DeletePeopleMutationVariables>) {
export function useDeleteManyPersonMutation(baseOptions?: Apollo.MutationHookOptions<DeleteManyPersonMutation, DeleteManyPersonMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<DeletePeopleMutation, DeletePeopleMutationVariables>(DeletePeopleDocument, options);
return Apollo.useMutation<DeleteManyPersonMutation, DeleteManyPersonMutationVariables>(DeleteManyPersonDocument, options);
}
export type DeletePeopleMutationHookResult = ReturnType<typeof useDeletePeopleMutation>;
export type DeletePeopleMutationResult = Apollo.MutationResult<DeletePeopleMutation>;
export type DeletePeopleMutationOptions = Apollo.BaseMutationOptions<DeletePeopleMutation, DeletePeopleMutationVariables>;
export type DeleteManyPersonMutationHookResult = ReturnType<typeof useDeleteManyPersonMutation>;
export type DeleteManyPersonMutationResult = Apollo.MutationResult<DeleteManyPersonMutation>;
export type DeleteManyPersonMutationOptions = Apollo.BaseMutationOptions<DeleteManyPersonMutation, DeleteManyPersonMutationVariables>;
export const GetPipelinesDocument = gql`
query GetPipelines($where: PipelineWhereInput) {
findManyPipeline(where: $where) {
@ -3864,6 +3776,7 @@ export const GetPipelineProgressDocument = gql`
id
firstName
lastName
displayName
}
probability
}
@ -3902,7 +3815,7 @@ export const UpdateOnePipelineProgressDocument = gql`
mutation UpdateOnePipelineProgress($id: String, $amount: Int, $closeDate: DateTime, $probability: Int, $pointOfContactId: String) {
updateOnePipelineProgress(
where: {id: $id}
data: {amount: {set: $amount}, closeDate: {set: $closeDate}, probability: {set: $probability}, pointOfContact: {connect: {id: $pointOfContactId}}}
data: {amount: $amount, closeDate: $closeDate, probability: $probability, pointOfContact: {connect: {id: $pointOfContactId}}}
) {
id
amount
@ -4051,7 +3964,7 @@ export type DeleteManyPipelineProgressMutationResult = Apollo.MutationResult<Del
export type DeleteManyPipelineProgressMutationOptions = Apollo.BaseMutationOptions<DeleteManyPipelineProgressMutation, DeleteManyPipelineProgressMutationVariables>;
export const UpdatePipelineStageDocument = gql`
mutation UpdatePipelineStage($id: String, $name: String) {
updateOnePipelineStage(where: {id: $id}, data: {name: {set: $name}}) {
updateOnePipelineStage(where: {id: $id}, data: {name: $name}) {
id
name
}
@ -4421,7 +4334,7 @@ export type UploadProfilePictureMutationResult = Apollo.MutationResult<UploadPro
export type UploadProfilePictureMutationOptions = Apollo.BaseMutationOptions<UploadProfilePictureMutation, UploadProfilePictureMutationVariables>;
export const RemoveProfilePictureDocument = gql`
mutation RemoveProfilePicture($where: UserWhereUniqueInput!) {
updateUser(data: {avatarUrl: {set: null}}, where: $where) {
updateUser(data: {avatarUrl: null}, where: $where) {
id
avatarUrl
}
@ -4463,6 +4376,7 @@ export const GetWorkspaceMembersDocument = gql`
avatarUrl
firstName
lastName
displayName
}
}
}
@ -4563,7 +4477,7 @@ export type UploadWorkspaceLogoMutationResult = Apollo.MutationResult<UploadWork
export type UploadWorkspaceLogoMutationOptions = Apollo.BaseMutationOptions<UploadWorkspaceLogoMutation, UploadWorkspaceLogoMutationVariables>;
export const RemoveWorkspaceLogoDocument = gql`
mutation RemoveWorkspaceLogo {
updateWorkspace(data: {logo: {set: null}}) {
updateWorkspace(data: {logo: null}) {
id
}
}

View File

@ -22,6 +22,7 @@ export const GET_COMMENT_THREADS_BY_TARGETS = gql`
id
firstName
lastName
displayName
}
comments {
id
@ -57,6 +58,7 @@ export const GET_COMMENT_THREAD = gql`
id
firstName
lastName
displayName
}
comments {
id

View File

@ -78,11 +78,7 @@ export const UPDATE_COMMENT_THREAD = gql`
) {
updateOneCommentThread(
where: { id: $id }
data: {
body: { set: $body }
title: { set: $title }
type: { set: $type }
}
data: { body: $body, title: $title, type: $type }
) {
id
body

View File

@ -252,10 +252,7 @@ export function Timeline({ entity }: { entity: CommentableEntity }) {
<IconNotes />
</StyledIconContainer>
<StyledItemTitleContainer>
<span>
{commentThread.author.firstName}{' '}
{commentThread.author.lastName}
</span>
<span>{commentThread.author.displayName}</span>
created a note
</StyledItemTitleContainer>
<StyledItemTitleDate id={`id-${commentThread.id}`}>

View File

@ -8,7 +8,7 @@ import {
Company,
User,
useSearchUserQuery,
useUpdateCompanyMutation,
useUpdateOneCompanyMutation,
} from '~/generated/graphql';
export type OwnProps = {
@ -31,7 +31,7 @@ export function CompanyAccountOwnerPicker({
const [searchFilter] = useRecoilScopedState(
relationPickerSearchFilterScopedState,
);
const [updateCompany] = useUpdateCompanyMutation();
const [updateCompany] = useUpdateOneCompanyMutation();
const companies = useFilteredSearchEntityQuery({
queryHook: useSearchUserQuery,
@ -51,8 +51,10 @@ export function CompanyAccountOwnerPicker({
async function handleEntitySelected(selectedUser: UserForSelect) {
await updateCompany({
variables: {
...company,
accountOwnerId: selectedUser.id,
where: { id: company.id },
data: {
accountOwner: { connect: { id: selectedUser.id } },
},
},
});

View File

@ -4,7 +4,7 @@ import { getOperationName } from '@apollo/client/utilities';
import { EditableCellChip } from '@/ui/table/editable-cell/types/EditableChip';
import {
GetCompaniesQuery,
useUpdateCompanyMutation,
useUpdateOneCompanyMutation,
} from '~/generated/graphql';
import { getLogoUrlFromDomainName } from '~/utils';
@ -20,7 +20,7 @@ type OwnProps = {
};
export function CompanyEditableNameChipCell({ company }: OwnProps) {
const [updateCompany] = useUpdateCompanyMutation();
const [updateCompany] = useUpdateOneCompanyMutation();
const [internalValue, setInternalValue] = useState(company.name ?? '');
@ -44,8 +44,10 @@ export function CompanyEditableNameChipCell({ company }: OwnProps) {
onSubmit={() =>
updateCompany({
variables: {
id: company.id,
name: internalValue,
where: { id: company.id },
data: {
name: internalValue,
},
},
refetchQueries: [getOperationName(GET_COMPANY) ?? ''],
})

View File

@ -5,7 +5,7 @@ import { FieldContext } from '@/ui/editable-field/states/FieldContext';
import { IconMap } from '@/ui/icon';
import { InplaceInputText } from '@/ui/inplace-input/components/InplaceInputText';
import { RecoilScope } from '@/ui/recoil-scope/components/RecoilScope';
import { Company, useUpdateCompanyMutation } from '~/generated/graphql';
import { Company, useUpdateOneCompanyMutation } from '~/generated/graphql';
type OwnProps = {
company: Pick<Company, 'id' | 'address'>;
@ -14,7 +14,7 @@ type OwnProps = {
export function CompanyAddressEditableField({ company }: OwnProps) {
const [internalValue, setInternalValue] = useState(company.address);
const [updateCompany] = useUpdateCompanyMutation();
const [updateCompany] = useUpdateOneCompanyMutation();
useEffect(() => {
setInternalValue(company.address);
@ -27,8 +27,12 @@ export function CompanyAddressEditableField({ company }: OwnProps) {
async function handleSubmit() {
await updateCompany({
variables: {
id: company.id,
address: internalValue ?? '',
where: {
id: company.id,
},
data: {
address: internalValue ?? '',
},
},
});
}

View File

@ -5,7 +5,7 @@ import { FieldContext } from '@/ui/editable-field/states/FieldContext';
import { EditableFieldEditModeDate } from '@/ui/editable-field/variants/components/EditableFieldEditModeDate';
import { IconCalendar } from '@/ui/icon';
import { RecoilScope } from '@/ui/recoil-scope/components/RecoilScope';
import { Company, useUpdateCompanyMutation } from '~/generated/graphql';
import { Company, useUpdateOneCompanyMutation } from '~/generated/graphql';
import { formatToHumanReadableDate } from '~/utils';
import { parseDate } from '~/utils/date-utils';
@ -16,7 +16,7 @@ type OwnProps = {
export function CompanyCreatedAtEditableField({ company }: OwnProps) {
const [internalValue, setInternalValue] = useState(company.createdAt);
const [updateCompany] = useUpdateCompanyMutation();
const [updateCompany] = useUpdateOneCompanyMutation();
useEffect(() => {
setInternalValue(company.createdAt);
@ -29,8 +29,12 @@ export function CompanyCreatedAtEditableField({ company }: OwnProps) {
async function handleSubmit() {
await updateCompany({
variables: {
id: company.id,
createdAt: internalValue ?? '',
where: {
id: company.id,
},
data: {
createdAt: internalValue ?? '',
},
},
});
}

View File

@ -6,7 +6,7 @@ import { FieldContext } from '@/ui/editable-field/states/FieldContext';
import { IconLink } from '@/ui/icon';
import { InplaceInputText } from '@/ui/inplace-input/components/InplaceInputText';
import { RecoilScope } from '@/ui/recoil-scope/components/RecoilScope';
import { Company, useUpdateCompanyMutation } from '~/generated/graphql';
import { Company, useUpdateOneCompanyMutation } from '~/generated/graphql';
type OwnProps = {
company: Pick<Company, 'id' | 'domainName'>;
@ -15,7 +15,7 @@ type OwnProps = {
export function CompanyDomainNameEditableField({ company }: OwnProps) {
const [internalValue, setInternalValue] = useState(company.domainName);
const [updateCompany] = useUpdateCompanyMutation();
const [updateCompany] = useUpdateOneCompanyMutation();
useEffect(() => {
setInternalValue(company.domainName);
@ -28,8 +28,12 @@ export function CompanyDomainNameEditableField({ company }: OwnProps) {
async function handleSubmit() {
await updateCompany({
variables: {
id: company.id,
domainName: internalValue ?? '',
where: {
id: company.id,
},
data: {
domainName: internalValue ?? '',
},
},
});
}

View File

@ -5,7 +5,7 @@ import { FieldContext } from '@/ui/editable-field/states/FieldContext';
import { IconUsers } from '@/ui/icon';
import { InplaceInputText } from '@/ui/inplace-input/components/InplaceInputText';
import { RecoilScope } from '@/ui/recoil-scope/components/RecoilScope';
import { Company, useUpdateCompanyMutation } from '~/generated/graphql';
import { Company, useUpdateOneCompanyMutation } from '~/generated/graphql';
type OwnProps = {
company: Pick<Company, 'id' | 'employees'>;
@ -16,7 +16,7 @@ export function CompanyEmployeesEditableField({ company }: OwnProps) {
company.employees?.toString(),
);
const [updateCompany] = useUpdateCompanyMutation();
const [updateCompany] = useUpdateOneCompanyMutation();
useEffect(() => {
setInternalValue(company.employees?.toString());
@ -38,8 +38,12 @@ export function CompanyEmployeesEditableField({ company }: OwnProps) {
await updateCompany({
variables: {
id: company.id,
employees: numberValue,
where: {
id: company.id,
},
data: {
employees: numberValue,
},
},
});

View File

@ -1,26 +1,11 @@
import { gql } from '@apollo/client';
export const UPDATE_COMPANY = gql`
mutation UpdateCompany(
$id: String
$name: String
$domainName: String
$accountOwnerId: String
$createdAt: DateTime
$address: String
$employees: Int
export const UPDATE_ONE_COMPANY = gql`
mutation UpdateOneCompany(
$where: CompanyWhereUniqueInput!
$data: CompanyUpdateInput!
) {
updateOneCompany(
where: { id: $id }
data: {
accountOwner: { connect: { id: $accountOwnerId } }
address: { set: $address }
domainName: { set: $domainName }
employees: { set: $employees }
name: { set: $name }
createdAt: { set: $createdAt }
}
) {
updateOneCompany(data: $data, where: $where) {
accountOwner {
id
email
@ -38,25 +23,9 @@ export const UPDATE_COMPANY = gql`
}
`;
export const INSERT_COMPANY = gql`
mutation InsertCompany(
$id: String!
$name: String!
$domainName: String!
$createdAt: DateTime
$address: String!
$employees: Int
) {
createOneCompany(
data: {
id: $id
name: $name
domainName: $domainName
createdAt: $createdAt
address: $address
employees: $employees
}
) {
export const INSERT_ONE_COMPANY = gql`
mutation InsertOneCompany($data: CompanyCreateInput!) {
createOneCompany(data: $data) {
address
createdAt
domainName
@ -67,8 +36,8 @@ export const INSERT_COMPANY = gql`
}
`;
export const DELETE_COMPANIES = gql`
mutation DeleteCompanies($ids: [String!]) {
export const DELETE_MANY_COMPANIES = gql`
mutation DeleteManyCompanies($ids: [String!]) {
deleteManyCompany(where: { id: { in: $ids } }) {
count
}

View File

@ -4,12 +4,12 @@ import { useRecoilValue } from 'recoil';
import { companyAddressFamilyState } from '@/companies/states/companyAddressFamilyState';
import { EditableCellText } from '@/ui/table/editable-cell/types/EditableCellText';
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
import { useUpdateCompanyMutation } from '~/generated/graphql';
import { useUpdateOneCompanyMutation } from '~/generated/graphql';
export function EditableCompanyAddressCell() {
const currentRowEntityId = useCurrentRowEntityId();
const [updateCompany] = useUpdateCompanyMutation();
const [updateCompany] = useUpdateOneCompanyMutation();
const address = useRecoilValue(
companyAddressFamilyState(currentRowEntityId ?? ''),
@ -27,8 +27,12 @@ export function EditableCompanyAddressCell() {
onSubmit={() =>
updateCompany({
variables: {
id: currentRowEntityId,
address: internalValue,
where: {
id: currentRowEntityId,
},
data: {
address: internalValue,
},
},
})
}

View File

@ -4,7 +4,7 @@ import { useRecoilValue } from 'recoil';
import { companyCreatedAtFamilyState } from '@/companies/states/companyCreatedAtFamilyState';
import { EditableCellDate } from '@/ui/table/editable-cell/types/EditableCellDate';
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
import { useUpdateCompanyMutation } from '~/generated/graphql';
import { useUpdateOneCompanyMutation } from '~/generated/graphql';
export function EditableCompanyCreatedAtCell() {
const currentRowEntityId = useCurrentRowEntityId();
@ -13,7 +13,7 @@ export function EditableCompanyCreatedAtCell() {
companyCreatedAtFamilyState(currentRowEntityId ?? ''),
);
const [updateCompany] = useUpdateCompanyMutation();
const [updateCompany] = useUpdateOneCompanyMutation();
return (
<EditableCellDate
@ -22,8 +22,12 @@ export function EditableCompanyCreatedAtCell() {
await updateCompany({
variables: {
id: currentRowEntityId,
createdAt: newDate.toISOString(),
where: {
id: currentRowEntityId,
},
data: {
createdAt: newDate.toISOString(),
},
},
});
}}

View File

@ -4,12 +4,12 @@ import { useRecoilValue } from 'recoil';
import { companyDomainNameFamilyState } from '@/companies/states/companyDomainNameFamilyState';
import { EditableCellText } from '@/ui/table/editable-cell/types/EditableCellText';
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
import { useUpdateCompanyMutation } from '~/generated/graphql';
import { useUpdateOneCompanyMutation } from '~/generated/graphql';
export function EditableCompanyDomainNameCell() {
const currentRowEntityId = useCurrentRowEntityId();
const [updateCompany] = useUpdateCompanyMutation();
const [updateCompany] = useUpdateOneCompanyMutation();
const name = useRecoilValue(
companyDomainNameFamilyState(currentRowEntityId ?? ''),
@ -26,8 +26,12 @@ export function EditableCompanyDomainNameCell() {
onSubmit={() =>
updateCompany({
variables: {
id: currentRowEntityId,
domainName: internalValue,
where: {
id: currentRowEntityId,
},
data: {
domainName: internalValue,
},
},
})
}

View File

@ -4,12 +4,12 @@ import { useRecoilValue } from 'recoil';
import { companyEmployeesFamilyState } from '@/companies/states/companyEmployeesFamilyState';
import { EditableCellText } from '@/ui/table/editable-cell/types/EditableCellText';
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
import { useUpdateCompanyMutation } from '~/generated/graphql';
import { useUpdateOneCompanyMutation } from '~/generated/graphql';
export function EditableCompanyEmployeesCell() {
const currentRowEntityId = useCurrentRowEntityId();
const [updateCompany] = useUpdateCompanyMutation();
const [updateCompany] = useUpdateOneCompanyMutation();
const employees = useRecoilValue(
companyEmployeesFamilyState(currentRowEntityId ?? ''),
@ -29,8 +29,12 @@ export function EditableCompanyEmployeesCell() {
onSubmit={() =>
updateCompany({
variables: {
id: currentRowEntityId,
employees: parseInt(internalValue),
where: {
id: currentRowEntityId,
},
data: {
employees: parseInt(internalValue),
},
},
})
}

View File

@ -6,14 +6,14 @@ import { IconTrash } from '@/ui/icon/index';
import { EntityTableActionBarButton } from '@/ui/table/action-bar/components/EntityTableActionBarButton';
import { useResetTableRowSelection } from '@/ui/table/hooks/useResetTableRowSelection';
import { selectedRowIdsSelector } from '@/ui/table/states/selectedRowIdsSelector';
import { useDeleteCompaniesMutation } from '~/generated/graphql';
import { useDeleteManyCompaniesMutation } from '~/generated/graphql';
export function TableActionBarButtonDeleteCompanies() {
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
const resetRowSelection = useResetTableRowSelection();
const [deleteCompanies] = useDeleteCompaniesMutation({
const [deleteCompanies] = useDeleteManyCompaniesMutation({
refetchQueries: [getOperationName(GET_COMPANIES) ?? ''],
});

View File

@ -10,7 +10,7 @@ export type PipelineProgressForBoard = Pick<
| 'probability'
| 'pointOfContactId'
> & {
pointOfContact?: Pick<Person, 'id' | 'firstName' | 'lastName'> | null;
pointOfContact?: Pick<Person, 'id' | 'displayName'> | null;
};
export type CompanyProgress = {

View File

@ -8,7 +8,14 @@ import { PersonChip } from './PersonChip';
type OwnProps = {
person:
| Partial<
Pick<Person, 'id' | 'firstName' | 'lastName' | '_commentThreadCount'>
Pick<
Person,
| 'id'
| 'firstName'
| 'lastName'
| 'displayName'
| '_commentThreadCount'
>
>
| null
| undefined;
@ -49,7 +56,7 @@ export function EditablePeopleFullName({
nonEditModeContent={
<NoEditModeContainer>
<PersonChip
name={person?.firstName + ' ' + person?.lastName}
name={`${person?.firstName ?? ''} ${person?.lastName ?? ''}`}
id={person?.id ?? ''}
clickable
/>

View File

@ -9,8 +9,8 @@ import { isCreateModeScopedState } from '@/ui/table/editable-cell/states/isCreat
import { EditableCellDoubleTextEditMode } from '@/ui/table/editable-cell/types/EditableCellDoubleTextEditMode';
import {
Person,
useInsertCompanyMutation,
useUpdatePeopleMutation,
useInsertOneCompanyMutation,
useUpdateOnePersonMutation,
} from '~/generated/graphql';
import { logError } from '~/utils/logError';
@ -30,8 +30,8 @@ export function PeopleCompanyCreateCell({ people }: OwnProps) {
const [companyName, setCompanyName] = useState(currentSearchFilter);
const [companyDomainName, setCompanyDomainName] = useState('');
const [insertCompany] = useInsertCompanyMutation();
const [updatePeople] = useUpdatePeopleMutation();
const [insertCompany] = useInsertOneCompanyMutation();
const [updatePerson] = useUpdateOnePersonMutation();
function handleDoubleTextChange(leftValue: string, rightValue: string): void {
setCompanyDomainName(leftValue);
@ -47,11 +47,12 @@ export function PeopleCompanyCreateCell({ people }: OwnProps) {
try {
await insertCompany({
variables: {
id: newCompanyId,
name: companyName,
domainName: companyDomainName,
address: '',
createdAt: new Date().toISOString(),
data: {
id: newCompanyId,
name: companyName,
domainName: companyDomainName,
address: '',
},
},
refetchQueries: [
getOperationName(GET_COMPANIES) ?? '',
@ -59,10 +60,14 @@ export function PeopleCompanyCreateCell({ people }: OwnProps) {
],
});
await updatePeople({
await updatePerson({
variables: {
...people,
companyId: newCompanyId,
where: {
id: people.id,
},
data: {
company: { connect: { id: newCompanyId } },
},
},
});
} catch (error) {

View File

@ -10,7 +10,11 @@ import { RelationPickerHotkeyScope } from '@/ui/relation-picker/types/RelationPi
import { useEditableCell } from '@/ui/table/editable-cell/hooks/useEditableCell';
import { isCreateModeScopedState } from '@/ui/table/editable-cell/states/isCreateModeScopedState';
import { TableHotkeyScope } from '@/ui/table/types/TableHotkeyScope';
import { Company, Person, useUpdatePeopleMutation } from '~/generated/graphql';
import {
Company,
Person,
useUpdateOnePersonMutation,
} from '~/generated/graphql';
export type OwnProps = {
people: Pick<Person, 'id'> & { company?: Pick<Company, 'id'> | null };
@ -22,7 +26,7 @@ export function PeopleCompanyPicker({ people }: OwnProps) {
const [searchFilter] = useRecoilScopedState(
relationPickerSearchFilterScopedState,
);
const [updatePeople] = useUpdatePeopleMutation();
const [updatePerson] = useUpdateOnePersonMutation();
const { closeEditableCell } = useEditableCell();
@ -34,10 +38,14 @@ export function PeopleCompanyPicker({ people }: OwnProps) {
});
async function handleEntitySelected(entity: any) {
await updatePeople({
await updatePerson({
variables: {
...people,
companyId: entity.id,
where: {
id: people.id,
},
data: {
company: { connect: { id: entity.id } },
},
},
});

View File

@ -9,7 +9,11 @@ import { PropertyBox } from '@/ui/editable-field/property-box/components/Propert
import { DateEditableField } from '@/ui/editable-field/variants/components/DateEditableField';
import { PhoneEditableField } from '@/ui/editable-field/variants/components/PhoneEditableField';
import { TextEditableField } from '@/ui/editable-field/variants/components/TextEditableField';
import { Company, Person, useUpdatePeopleMutation } from '~/generated/graphql';
import {
Company,
Person,
useUpdateOnePersonMutation,
} from '~/generated/graphql';
import { PeopleCompanyEditableField } from '../editable-field/components/PeopleCompanyEditableField';
@ -23,7 +27,7 @@ type OwnProps = {
};
export function PersonPropertyBox({ person }: OwnProps) {
const [updatePerson] = useUpdatePeopleMutation();
const [updatePerson] = useUpdateOnePersonMutation();
return (
<PropertyBox extraPadding={true}>
@ -34,8 +38,12 @@ export function PersonPropertyBox({ person }: OwnProps) {
onSubmit={(newEmail) => {
updatePerson({
variables: {
id: person.id,
email: newEmail,
where: {
id: person.id,
},
data: {
email: newEmail,
},
},
});
}}
@ -47,8 +55,12 @@ export function PersonPropertyBox({ person }: OwnProps) {
onSubmit={(newPhone) => {
updatePerson({
variables: {
id: person.id,
phone: newPhone,
where: {
id: person.id,
},
data: {
phone: newPhone,
},
},
});
}}
@ -59,8 +71,12 @@ export function PersonPropertyBox({ person }: OwnProps) {
onSubmit={(newDate) => {
updatePerson({
variables: {
id: person.id,
createdAt: newDate,
where: {
id: person.id,
},
data: {
createdAt: newDate,
},
},
});
}}
@ -73,8 +89,12 @@ export function PersonPropertyBox({ person }: OwnProps) {
onSubmit={(newCity) => {
updatePerson({
variables: {
id: person.id,
city: newCity,
where: {
id: person.id,
},
data: {
city: newCity,
},
},
});
}}

View File

@ -4,7 +4,11 @@ import { useRecoilScopedState } from '@/ui/recoil-scope/hooks/useRecoilScopedSta
import { SingleEntitySelect } from '@/ui/relation-picker/components/SingleEntitySelect';
import { relationPickerSearchFilterScopedState } from '@/ui/relation-picker/states/relationPickerSearchFilterScopedState';
import { EntityForSelect } from '@/ui/relation-picker/types/EntityForSelect';
import { Company, Person, useUpdatePeopleMutation } from '~/generated/graphql';
import {
Company,
Person,
useUpdateOnePersonMutation,
} from '~/generated/graphql';
export type OwnProps = {
people: Pick<Person, 'id'> & { company?: Pick<Company, 'id'> | null };
@ -16,7 +20,7 @@ export function PeopleCompanyEditableFieldEditMode({ people }: OwnProps) {
const [searchFilter] = useRecoilScopedState(
relationPickerSearchFilterScopedState,
);
const [updatePeople] = useUpdatePeopleMutation();
const [updatePerson] = useUpdateOnePersonMutation();
const companies = useFilteredSearchCompanyQuery({
searchFilter,
@ -24,10 +28,14 @@ export function PeopleCompanyEditableFieldEditMode({ people }: OwnProps) {
});
async function handleEntitySelected(entity: EntityForSelect) {
await updatePeople({
await updatePerson({
variables: {
...people,
companyId: entity.id,
where: {
id: people.id,
},
data: {
company: { connect: { id: entity.id } },
},
},
});
closeEditableField();

View File

@ -19,7 +19,7 @@ export function useSetPeopleEntityTable() {
.valueOrThrow();
if (currentEmail !== person.email) {
set(peopleEmailFamilyState(person.id), person.email);
set(peopleEmailFamilyState(person.id), person.email ?? null);
}
const currentCity = snapshot
@ -27,7 +27,7 @@ export function useSetPeopleEntityTable() {
.valueOrThrow();
if (currentCity !== person.city) {
set(peopleCityFamilyState(person.id), person.city);
set(peopleCityFamilyState(person.id), person.city ?? null);
}
const currentCompany = snapshot
@ -45,7 +45,7 @@ export function useSetPeopleEntityTable() {
.valueOrThrow();
if (currentPhone !== person.phone) {
set(peoplePhoneFamilyState(person.id), person.phone);
set(peoplePhoneFamilyState(person.id), person.phone ?? null);
}
const currentCreatedAt = snapshot
@ -66,9 +66,10 @@ export function useSetPeopleEntityTable() {
currentNameCell.commentCount !== person._commentThreadCount
) {
set(peopleNameCellFamilyState(person.id), {
firstName: person.firstName,
lastName: person.lastName,
firstName: person.firstName ?? null,
lastName: person.lastName ?? null,
commentCount: person._commentThreadCount,
displayName: person.displayName ?? null,
});
}
}

View File

@ -9,13 +9,11 @@ describe('reduceSortsToOrderBy', () => {
key: 'firstName',
label: 'firstName',
order: 'asc',
_type: 'default_sort',
},
{
key: 'lastName',
label: 'lastName',
order: 'desc',
_type: 'default_sort',
},
] satisfies PeopleSelectedSortType[];
const result = reduceSortsToOrderBy(sorts);

View File

@ -27,6 +27,7 @@ export const GET_PEOPLE = gql`
city
firstName
lastName
displayName
createdAt
_commentThreadCount
company {
@ -103,6 +104,7 @@ export const GET_PERSON_NAMES_AND_COMMENT_COUNT = gql`
id
firstName
lastName
displayName
_commentThreadCount
}
}

View File

@ -1,29 +1,11 @@
import { gql } from '@apollo/client';
export const UPDATE_PERSON = gql`
mutation UpdatePeople(
$id: String
$firstName: String
$lastName: String
$phone: String
$city: String
$companyId: String
$email: String
$createdAt: DateTime
export const UPDATE_ONE_PERSON = gql`
mutation UpdateOnePerson(
$where: PersonWhereUniqueInput!
$data: PersonUpdateInput!
) {
updateOnePerson(
where: { id: $id }
data: {
city: { set: $city }
company: { connect: { id: $companyId } }
email: { set: $email }
firstName: { set: $firstName }
id: { set: $id }
lastName: { set: $lastName }
phone: { set: $phone }
createdAt: { set: $createdAt }
}
) {
updateOnePerson(data: $data, where: $where) {
id
city
company {
@ -34,33 +16,16 @@ export const UPDATE_PERSON = gql`
email
firstName
lastName
displayName
phone
createdAt
}
}
`;
export const INSERT_PERSON = gql`
mutation InsertPerson(
$id: String!
$firstName: String!
$lastName: String!
$phone: String!
$city: String!
$email: String!
$createdAt: DateTime
) {
createOnePerson(
data: {
id: $id
firstName: $firstName
lastName: $lastName
phone: $phone
city: $city
email: $email
createdAt: $createdAt
}
) {
export const INSERT_ONE_PERSON = gql`
mutation InsertOnePerson($data: PersonCreateInput!) {
createOnePerson(data: $data) {
id
city
company {
@ -71,14 +36,15 @@ export const INSERT_PERSON = gql`
email
firstName
lastName
displayName
phone
createdAt
}
}
`;
export const DELETE_PEOPLE = gql`
mutation DeletePeople($ids: [String!]) {
export const DELETE_MANY_PERSON = gql`
mutation DeleteManyPerson($ids: [String!]) {
deleteManyPerson(where: { id: { in: $ids } }) {
count
}

View File

@ -5,6 +5,7 @@ export const peopleNameCellFamilyState = atomFamily<
firstName: string | null;
lastName: string | null;
commentCount: number | null;
displayName: string | null;
},
string
>({
@ -13,5 +14,6 @@ export const peopleNameCellFamilyState = atomFamily<
firstName: null,
lastName: null,
commentCount: null,
displayName: null,
},
});

View File

@ -4,12 +4,12 @@ import { useRecoilValue } from 'recoil';
import { peopleCityFamilyState } from '@/people/states/peopleCityFamilyState';
import { EditableCellText } from '@/ui/table/editable-cell/types/EditableCellText';
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
import { useUpdatePeopleMutation } from '~/generated/graphql';
import { useUpdateOnePersonMutation } from '~/generated/graphql';
export function EditablePeopleCityCell() {
const currentRowEntityId = useCurrentRowEntityId();
const [updatePerson] = useUpdatePeopleMutation();
const [updatePerson] = useUpdateOnePersonMutation();
const city = useRecoilValue(peopleCityFamilyState(currentRowEntityId ?? ''));
@ -26,8 +26,12 @@ export function EditablePeopleCityCell() {
onSubmit={() =>
updatePerson({
variables: {
id: currentRowEntityId,
city: internalValue,
where: {
id: currentRowEntityId,
},
data: {
city: internalValue,
},
},
})
}

View File

@ -4,7 +4,7 @@ import { useRecoilValue } from 'recoil';
import { peopleCreatedAtFamilyState } from '@/people/states/peopleCreatedAtFamilyState';
import { EditableCellDate } from '@/ui/table/editable-cell/types/EditableCellDate';
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
import { useUpdatePeopleMutation } from '~/generated/graphql';
import { useUpdateOnePersonMutation } from '~/generated/graphql';
export function EditablePeopleCreatedAtCell() {
const currentRowEntityId = useCurrentRowEntityId();
@ -13,7 +13,7 @@ export function EditablePeopleCreatedAtCell() {
peopleCreatedAtFamilyState(currentRowEntityId ?? ''),
);
const [updatePerson] = useUpdatePeopleMutation();
const [updatePerson] = useUpdateOnePersonMutation();
return (
<EditableCellDate
@ -22,8 +22,12 @@ export function EditablePeopleCreatedAtCell() {
await updatePerson({
variables: {
id: currentRowEntityId,
createdAt: newDate.toISOString(),
where: {
id: currentRowEntityId,
},
data: {
createdAt: newDate.toISOString(),
},
},
});
}}

View File

@ -4,12 +4,12 @@ import { useRecoilValue } from 'recoil';
import { peopleEmailFamilyState } from '@/people/states/peopleEmailFamilyState';
import { EditableCellText } from '@/ui/table/editable-cell/types/EditableCellText';
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
import { useUpdatePeopleMutation } from '~/generated/graphql';
import { useUpdateOnePersonMutation } from '~/generated/graphql';
export function EditablePeopleEmailCell() {
const currentRowEntityId = useCurrentRowEntityId();
const [updatePerson] = useUpdatePeopleMutation();
const [updatePerson] = useUpdateOnePersonMutation();
const email = useRecoilValue(
peopleEmailFamilyState(currentRowEntityId ?? ''),
@ -28,8 +28,12 @@ export function EditablePeopleEmailCell() {
onSubmit={() =>
updatePerson({
variables: {
id: currentRowEntityId,
email: internalValue,
where: {
id: currentRowEntityId,
},
data: {
email: internalValue,
},
},
})
}

View File

@ -5,16 +5,16 @@ import { useRecoilValue } from 'recoil';
import { EditablePeopleFullName } from '@/people/components/EditablePeopleFullName';
import { peopleNameCellFamilyState } from '@/people/states/peopleNamesFamilyState';
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
import { useUpdatePeopleMutation } from '~/generated/graphql';
import { useUpdateOnePersonMutation } from '~/generated/graphql';
import { GET_PERSON } from '../../queries';
export function EditablePeopleFullNameCell() {
const currentRowEntityId = useCurrentRowEntityId();
const [updatePerson] = useUpdatePeopleMutation();
const [updatePerson] = useUpdateOnePersonMutation();
const { commentCount, firstName, lastName } = useRecoilValue(
const { commentCount, firstName, lastName, displayName } = useRecoilValue(
peopleNameCellFamilyState(currentRowEntityId ?? ''),
);
@ -33,6 +33,7 @@ export function EditablePeopleFullNameCell() {
_commentThreadCount: commentCount ?? undefined,
firstName: internalFirstName,
lastName: internalLastName,
displayName: displayName ?? undefined,
}}
onChange={(firstName, lastName) => {
setInternalFirstName(firstName);
@ -41,9 +42,13 @@ export function EditablePeopleFullNameCell() {
onSubmit={() =>
updatePerson({
variables: {
id: currentRowEntityId,
firstName: internalFirstName,
lastName: internalLastName,
where: {
id: currentRowEntityId,
},
data: {
firstName: internalFirstName,
lastName: internalLastName,
},
},
refetchQueries: [getOperationName(GET_PERSON) ?? ''],
})

View File

@ -4,12 +4,12 @@ import { useRecoilValue } from 'recoil';
import { peoplePhoneFamilyState } from '@/people/states/peoplePhoneFamilyState';
import { EditableCellPhone } from '@/ui/table/editable-cell/types/EditableCellPhone';
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
import { useUpdatePeopleMutation } from '~/generated/graphql';
import { useUpdateOnePersonMutation } from '~/generated/graphql';
export function EditablePeoplePhoneCell() {
const currentRowEntityId = useCurrentRowEntityId();
const [updatePerson] = useUpdatePeopleMutation();
const [updatePerson] = useUpdateOnePersonMutation();
const phone = useRecoilValue(
peoplePhoneFamilyState(currentRowEntityId ?? ''),
@ -28,8 +28,12 @@ export function EditablePeoplePhoneCell() {
onSubmit={() =>
updatePerson({
variables: {
id: currentRowEntityId,
phone: internalValue,
where: {
id: currentRowEntityId,
},
data: {
phone: internalValue,
},
},
})
}

View File

@ -6,14 +6,14 @@ import { IconTrash } from '@/ui/icon/index';
import { EntityTableActionBarButton } from '@/ui/table/action-bar/components/EntityTableActionBarButton';
import { useResetTableRowSelection } from '@/ui/table/hooks/useResetTableRowSelection';
import { selectedRowIdsSelector } from '@/ui/table/states/selectedRowIdsSelector';
import { useDeletePeopleMutation } from '~/generated/graphql';
import { useDeleteManyPersonMutation } from '~/generated/graphql';
export function TableActionBarButtonDeletePeople() {
const selectedRowIds = useRecoilValue(selectedRowIdsSelector);
const resetRowSelection = useResetTableRowSelection();
const [deletePeople] = useDeletePeopleMutation({
const [deleteManyPerson] = useDeleteManyPersonMutation({
refetchQueries: [getOperationName(GET_PEOPLE) ?? ''],
});
@ -22,7 +22,7 @@ export function TableActionBarButtonDeletePeople() {
resetRowSelection();
await deletePeople({
await deleteManyPerson({
variables: {
ids: rowIdsToDelete,
},

View File

@ -10,7 +10,7 @@ import { PipelineProgressPointOfContactPickerFieldEditMode } from './PipelinePro
type OwnProps = {
pipelineProgress: Pick<PipelineProgress, 'id' | 'pointOfContactId'> & {
pointOfContact?: Pick<Person, 'id' | 'firstName' | 'lastName'> | null;
pointOfContact?: Pick<Person, 'id' | 'displayName'> | null;
};
};
@ -34,10 +34,7 @@ export function PipelineProgressPointOfContactEditableField({
pipelineProgress.pointOfContact ? (
<PersonChip
id={pipelineProgress.pointOfContact.id}
name={
pipelineProgress.pointOfContact?.firstName +
pipelineProgress.pointOfContact.lastName
}
name={pipelineProgress.pointOfContact.displayName}
/>
) : (
<></>

View File

@ -12,7 +12,10 @@ const PipelineProgressPointOfContactPickerContainer = styled.div`
export type OwnProps = {
pipelineProgress: Pick<PipelineProgress, 'id'> & {
pointOfContact?: Pick<Person, 'id' | 'firstName' | 'lastName'> | null;
pointOfContact?: Pick<
Person,
'id' | 'firstName' | 'lastName' | 'displayName'
> | null;
};
onSubmit?: () => void;
onCancel?: () => void;

View File

@ -42,6 +42,7 @@ export const GET_PIPELINE_PROGRESS = gql`
id
firstName
lastName
displayName
}
probability
}
@ -59,9 +60,9 @@ export const UPDATE_PIPELINE_PROGRESS = gql`
updateOnePipelineProgress(
where: { id: $id }
data: {
amount: { set: $amount }
closeDate: { set: $closeDate }
probability: { set: $probability }
amount: $amount
closeDate: $closeDate
probability: $probability
pointOfContact: { connect: { id: $pointOfContactId } }
}
) {

View File

@ -10,7 +10,7 @@ export const DELETE_PIPELINE_PROGRESS = gql`
export const UPDATE_PIPELINE_STAGE = gql`
mutation UpdatePipelineStage($id: String, $name: String) {
updateOnePipelineStage(where: { id: $id }, data: { name: { set: $name } }) {
updateOnePipelineStage(where: { id: $id }, data: { name: $name }) {
id
name
}

View File

@ -51,12 +51,8 @@ export function NameFields({
id: currentUser?.id,
},
data: {
firstName: {
set: firstName,
},
lastName: {
set: lastName,
},
firstName,
lastName,
},
},
refetchQueries: [getOperationName(GET_CURRENT_USER) ?? ''],

View File

@ -44,9 +44,7 @@ export function NameField({ autoSave = true, onNameUpdate }: OwnProps) {
const { data, errors } = await updateWorkspace({
variables: {
data: {
displayName: {
set: name,
},
displayName: name,
},
},
refetchQueries: [getOperationName(GET_CURRENT_USER) ?? ''],

View File

@ -5,7 +5,7 @@ import { FieldContext } from '@/ui/editable-field/states/FieldContext';
import { IconMap } from '@/ui/icon';
import { InplaceInputText } from '@/ui/inplace-input/components/InplaceInputText';
import { RecoilScope } from '@/ui/recoil-scope/components/RecoilScope';
import { Company, useUpdateCompanyMutation } from '~/generated/graphql';
import { Company, useUpdateOneCompanyMutation } from '~/generated/graphql';
type OwnProps = {
company: Pick<Company, 'id' | 'address'>;
@ -14,7 +14,7 @@ type OwnProps = {
export function CompanyEditableFieldAddress({ company }: OwnProps) {
const [internalValue, setInternalValue] = useState(company.address);
const [updateCompany] = useUpdateCompanyMutation();
const [updateCompany] = useUpdateOneCompanyMutation();
useEffect(() => {
setInternalValue(company.address);
@ -27,8 +27,12 @@ export function CompanyEditableFieldAddress({ company }: OwnProps) {
async function handleSubmit() {
await updateCompany({
variables: {
id: company.id,
address: internalValue ?? '',
where: {
id: company.id,
},
data: {
address: internalValue ?? '',
},
},
});
}

View File

@ -29,9 +29,7 @@ export function useColorScheme() {
data: {
settings: {
update: {
colorScheme: {
set: value,
},
colorScheme: value,
},
},
},

View File

@ -36,7 +36,7 @@ export const UPDATE_PROFILE_PICTURE = gql`
export const REMOVE_PROFILE_PICTURE = gql`
mutation RemoveProfilePicture($where: UserWhereUniqueInput!) {
updateUser(data: { avatarUrl: { set: null } }, where: $where) {
updateUser(data: { avatarUrl: null }, where: $where) {
id
avatarUrl
}

View File

@ -1,7 +1,6 @@
import styled from '@emotion/styled';
import { Avatar } from '@/users/components/Avatar';
import { getImageAbsoluteURIOrBase64 } from '@/users/utils/getProfilePictureAbsoluteURI';
import { User } from '~/generated/graphql';
const StyledContainer = styled.div`
@ -33,7 +32,10 @@ const EmailText = styled.span`
type OwnProps = {
workspaceMember: {
user: Pick<User, 'id' | 'firstName' | 'lastName' | 'avatarUrl' | 'email'>;
user: Pick<
User,
'id' | 'firstName' | 'lastName' | 'displayName' | 'avatarUrl' | 'email'
>;
};
accessory?: React.ReactNode;
};
@ -42,16 +44,14 @@ export function WorkspaceMemberCard({ workspaceMember, accessory }: OwnProps) {
return (
<StyledContainer>
<Avatar
avatarUrl={getImageAbsoluteURIOrBase64(workspaceMember.user.avatarUrl)}
avatarUrl={workspaceMember.user.avatarUrl}
colorId={workspaceMember.user.id}
placeholder={workspaceMember.user.firstName || ''}
type="squared"
size={40}
/>
<Content>
<NameText>
{workspaceMember.user.firstName} {workspaceMember.user.lastName}{' '}
</NameText>
<NameText>{workspaceMember.user.displayName}</NameText>
<EmailText>{workspaceMember.user.email}</EmailText>
</Content>

View File

@ -10,6 +10,7 @@ export const GET_WORKSPACE_MEMBERS = gql`
avatarUrl
firstName
lastName
displayName
}
}
}

View File

@ -19,7 +19,7 @@ export const UPDATE_WORKSPACE_LOGO = gql`
export const REMOVE_WORKSPACE_LOGO = gql`
mutation RemoveWorkspaceLogo {
updateWorkspace(data: { logo: { set: null } }) {
updateWorkspace(data: { logo: null }) {
id
}
}

View File

@ -98,12 +98,8 @@ export function CreateProfile() {
id: currentUser?.id,
},
data: {
firstName: {
set: data.firstName,
},
lastName: {
set: data.lastName,
},
firstName: data.firstName,
lastName: data.lastName,
},
},
refetchQueries: [getOperationName(GET_CURRENT_USER) ?? ''],

View File

@ -73,9 +73,7 @@ export function CreateWorkspace() {
const result = await updateWorkspace({
variables: {
data: {
displayName: {
set: data.name,
},
displayName: data.name,
},
},
refetchQueries: [getOperationName(GET_CURRENT_USER) ?? ''],

View File

@ -1,7 +1,6 @@
import { getOperationName } from '@apollo/client/utilities';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { v4 as uuidv4 } from 'uuid';
import { GET_COMPANIES } from '@/companies/queries';
import { CompanyTable } from '@/companies/table/components/CompanyTable';
@ -12,10 +11,7 @@ import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer'
import { RecoilScope } from '@/ui/recoil-scope/components/RecoilScope';
import { EntityTableActionBar } from '@/ui/table/action-bar/components/EntityTableActionBar';
import { TableContext } from '@/ui/table/states/TableContext';
import {
InsertCompanyMutationVariables,
useInsertCompanyMutation,
} from '~/generated/graphql';
import { useInsertOneCompanyMutation } from '~/generated/graphql';
import { SEARCH_COMPANY_QUERY } from '../../modules/search/queries/search';
@ -25,20 +21,17 @@ const StyledTableContainer = styled.div`
`;
export function Companies() {
const [insertCompany] = useInsertCompanyMutation();
const [insertCompany] = useInsertOneCompanyMutation();
async function handleAddButtonClick() {
const newCompany: InsertCompanyMutationVariables = {
id: uuidv4(),
name: '',
domainName: '',
employees: null,
address: '',
createdAt: new Date().toISOString(),
};
await insertCompany({
variables: newCompany,
variables: {
data: {
name: '',
domainName: '',
address: '',
},
},
refetchQueries: [
getOperationName(GET_COMPANIES) ?? '',
getOperationName(SEARCH_COMPANY_QUERY) ?? '',

View File

@ -1,7 +1,6 @@
import { getOperationName } from '@apollo/client/utilities';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { v4 as uuidv4 } from 'uuid';
import { GET_PEOPLE } from '@/people/queries';
import { PeopleTable } from '@/people/table/components/PeopleTable';
@ -12,7 +11,7 @@ import { WithTopBarContainer } from '@/ui/layout/components/WithTopBarContainer'
import { RecoilScope } from '@/ui/recoil-scope/components/RecoilScope';
import { EntityTableActionBar } from '@/ui/table/action-bar/components/EntityTableActionBar';
import { TableContext } from '@/ui/table/states/TableContext';
import { useInsertPersonMutation } from '~/generated/graphql';
import { useInsertOnePersonMutation } from '~/generated/graphql';
const StyledTableContainer = styled.div`
display: flex;
@ -20,18 +19,12 @@ const StyledTableContainer = styled.div`
`;
export function People() {
const [insertPersonMutation] = useInsertPersonMutation();
const [insertOnePerson] = useInsertOnePersonMutation();
async function handleAddButtonClick() {
await insertPersonMutation({
await insertOnePerson({
variables: {
id: uuidv4(),
firstName: '',
lastName: '',
email: '',
phone: '',
createdAt: new Date().toISOString(),
city: '',
data: {},
},
refetchQueries: [getOperationName(GET_PEOPLE) ?? ''],
});

View File

@ -4,7 +4,7 @@ import type { Meta } from '@storybook/react';
import { userEvent, within } from '@storybook/testing-library';
import { graphql } from 'msw';
import { UPDATE_PERSON } from '@/people/queries';
import { UPDATE_ONE_PERSON } from '@/people/queries';
import { SEARCH_COMPANY_QUERY } from '@/search/queries/search';
import { Company } from '~/generated/graphql';
import { graphqlMocks } from '~/testing/graphqlMocks';
@ -113,7 +113,7 @@ const editRelationMocks = (
if (
typeof graphqlMock.info.operationName === 'string' &&
[
getOperationName(UPDATE_PERSON),
getOperationName(UPDATE_ONE_PERSON),
getOperationName(SEARCH_COMPANY_QUERY),
].includes(graphqlMock.info.operationName)
) {
@ -122,23 +122,26 @@ const editRelationMocks = (
return true;
}),
...[
graphql.mutation(getOperationName(UPDATE_PERSON) ?? '', (req, res, ctx) => {
return res(
ctx.data({
updateOnePerson: {
...fetchOneFromData(mockedPeopleData, req.variables.id),
...{
company: {
id: req.variables.companyId,
name: updateSelectedCompany.name,
domainName: updateSelectedCompany.domainName,
__typename: 'Company',
graphql.mutation(
getOperationName(UPDATE_ONE_PERSON) ?? '',
(req, res, ctx) => {
return res(
ctx.data({
updateOnePerson: {
...fetchOneFromData(mockedPeopleData, req.variables.where.id),
...{
company: {
id: req.variables.where.id,
name: updateSelectedCompany.name,
domainName: updateSelectedCompany.domainName,
__typename: 'Company',
},
},
},
},
}),
);
}),
}),
);
},
),
graphql.query(
getOperationName(SEARCH_COMPANY_QUERY) ?? '',
(req, res, ctx) => {

View File

@ -4,7 +4,7 @@ import { graphql } from 'msw';
import { CREATE_EVENT } from '@/analytics/queries';
import { GET_CLIENT_CONFIG } from '@/client-config/queries';
import { GET_COMPANIES } from '@/companies/queries';
import { GET_PEOPLE, GET_PERSON, UPDATE_PERSON } from '@/people/queries';
import { GET_PEOPLE, GET_PERSON, UPDATE_ONE_PERSON } from '@/people/queries';
import { GET_PIPELINE_PROGRESS, GET_PIPELINES } from '@/pipeline/queries';
import {
SEARCH_COMPANY_QUERY,
@ -134,17 +134,20 @@ export const graphqlMocks = [
}),
);
}),
graphql.mutation(getOperationName(UPDATE_PERSON) ?? '', (req, res, ctx) => {
return res(
ctx.data({
updateOnePerson: updateOneFromData(
mockedPeopleData,
req.variables.id,
req.variables,
),
}),
);
}),
graphql.mutation(
getOperationName(UPDATE_ONE_PERSON) ?? '',
(req, res, ctx) => {
return res(
ctx.data({
updateOnePerson: updateOneFromData(
mockedPeopleData,
req.variables.where.id,
req.variables,
),
}),
);
},
),
graphql.query(getOperationName(GET_PIPELINES) ?? '', (req, res, ctx) => {
return res(
ctx.data({

View File

@ -22,6 +22,7 @@ type MockedCommentThread = Pick<
id: string;
firstName: string;
lastName: string;
displayName: string;
};
comments: Array<Pick<Comment, 'body'>>;
commentThreadTargets: Array<
@ -50,6 +51,7 @@ export const mockedCommentThreads: Array<MockedCommentThread> = [
id: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
firstName: 'Charles',
lastName: 'Test',
displayName: 'Charles Test',
},
authorId: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
comments: [],
@ -96,6 +98,7 @@ export const mockedCommentThreads: Array<MockedCommentThread> = [
id: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
firstName: 'Charles',
lastName: 'Test',
displayName: 'Charles Test',
},
authorId: '374fe3a5-df1e-4119-afe0-2a62a2ba481e',
comments: [],

View File

@ -7,6 +7,8 @@ import {
UserOrderByWithRelationInput,
} from '~/generated/graphql';
import { isDefined } from '../../utils/isDefined';
function filterData<DataT>(
data: Array<DataT>,
where: Record<string, any>,
@ -135,15 +137,28 @@ export function fetchOneFromData<DataT extends { id: string }>(
data: Array<DataT>,
id: string,
): DataT | undefined {
if (!isDefined(id)) {
throw new Error(
`id is not defined in updateOneFromData, check that you provided where.id if needed.`,
);
}
return data.filter((item) => item.id === id)[0];
}
export function updateOneFromData<DataT extends { id: string }>(
data: Array<DataT>,
id: string,
id: string | undefined,
payload: GraphQLVariables,
): DataT | undefined {
if (!isDefined(id)) {
throw new Error(
`id is not defined in updateOneFromData, check that you provided where.id if needed.`,
);
}
const object = data.filter((item) => item.id === id)[0];
const newObject = Object.assign(object, payload);
return newObject;

View File

@ -1,22 +1,28 @@
import { Company, Person } from '~/generated/graphql';
type MockedPerson = Pick<
Person,
| 'id'
| 'firstName'
| 'lastName'
| 'displayName'
| 'email'
| '__typename'
| 'phone'
| 'city'
| '_commentThreadCount'
| 'createdAt'
> & {
company: Pick<Company, 'id' | 'name' | 'domainName' | '__typename'>;
type RequiredAndNotNull<T> = {
[P in keyof T]-?: Exclude<T[P], null | undefined>;
};
export const mockedPeopleData: Array<MockedPerson> = [
type MockedPerson = RequiredAndNotNull<
Pick<
Person,
| 'id'
| 'firstName'
| 'lastName'
| 'displayName'
| 'email'
| '__typename'
| 'phone'
| 'city'
| '_commentThreadCount'
| 'createdAt'
> & {
company: Pick<Company, 'id' | 'name' | 'domainName' | '__typename'>;
}
>;
export const mockedPeopleData: MockedPerson[] = [
{
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
__typename: 'Person',

View File

@ -89,21 +89,6 @@ export class CompanyResolver {
@PrismaSelector({ modelName: 'Company' })
prismaSelect: PrismaSelect<'Company'>,
): Promise<Partial<Company> | null> {
// TODO: Do a proper check with recursion testing on args in a more generic place
for (const key in args.data) {
if (args.data[key]) {
for (const subKey in args.data[key]) {
if (JSON.stringify(args.data[key][subKey]) === '{}') {
delete args.data[key][subKey];
}
}
}
if (JSON.stringify(args.data[key]) === '{}') {
delete args.data[key];
}
}
return this.companyService.update({
where: args.where,
data: args.data,

View File

@ -0,0 +1,6 @@
-- AlterTable
ALTER TABLE "people" ALTER COLUMN "email" DROP NOT NULL,
ALTER COLUMN "phone" DROP NOT NULL,
ALTER COLUMN "city" DROP NOT NULL,
ALTER COLUMN "firstName" DROP NOT NULL,
ALTER COLUMN "lastName" DROP NOT NULL;

View File

@ -9,8 +9,9 @@ datasource db {
}
generator nestgraphql {
provider = "node node_modules/prisma-nestjs-graphql"
output = "../../src/core/@generated"
provider = "node node_modules/prisma-nestjs-graphql"
output = "../../src/core/@generated"
noAtomicOperations = true
// field validator
fields_Validator_input = true
@ -47,11 +48,13 @@ generator nestgraphql {
decorate_count_arguments = "[]"
// create data validator
decorate_classValidator_type = "@(Create|Update|Upsert)*Args"
decorate_classValidator_field = "@(data|[A-Z]*)"
decorate_classValidator_name = ValidateNested
decorate_classValidator_from = "class-validator"
decorate_classValidator_arguments = "['{each: true}']"
decorate_classValidator_type = "@(Create|Update|Upsert)*Args"
decorate_classValidator_field = "@(data|[A-Z]*)"
decorate_classValidator_name = ValidateNested
decorate_classValidator_from = "class-validator"
decorate_classValidator_arguments = "['{each: true}']"
// create data transformer
decorate_classTransformer_type = "@(Create|Update|Upsert)*Args"
decorate_classTransformer_field = "@(data|[A-Z]*)"
decorate_classTransformer_from = "class-transformer"
@ -70,6 +73,7 @@ model User {
/// @Validator.IsOptional()
lastName String?
/// @Validator.IsEmail()
/// @Validator.IsOptional()
email String @unique
/// @Validator.IsBoolean()
/// @Validator.IsOptional()
@ -78,6 +82,7 @@ model User {
/// @Validator.IsOptional()
avatarUrl String?
/// @Validator.IsString()
/// @Validator.IsOptional()
locale String
/// @Validator.IsString()
/// @Validator.IsOptional()
@ -200,10 +205,13 @@ model Company {
/// @Validator.IsOptional()
id String @id @default(uuid())
/// @Validator.IsString()
/// @Validator.IsOptional()
name String
/// @Validator.IsString()
/// @Validator.IsOptional()
domainName String
/// @Validator.IsString()
/// @Validator.IsOptional()
address String
/// @Validator.IsNumber()
/// @Validator.IsOptional()
@ -229,31 +237,36 @@ model Company {
model Person {
/// @Validator.IsString()
/// @Validator.IsOptional()
id String @id @default(uuid())
id String @id @default(uuid())
/// @Validator.IsString()
firstName String
/// @Validator.IsOptional()
firstName String?
/// @Validator.IsString()
lastName String
/// @Validator.IsOptional()
lastName String?
/// @Validator.IsString()
email String
/// @Validator.IsOptional()
email String?
/// @Validator.IsString()
phone String
/// @Validator.IsOptional()
phone String?
/// @Validator.IsString()
city String
/// @Validator.IsOptional()
city String?
company Company? @relation(fields: [companyId], references: [id])
companyId String?
company Company? @relation(fields: [companyId], references: [id])
companyId String?
/// @TypeGraphQL.omit(input: true, output: true)
workspace Workspace @relation(fields: [workspaceId], references: [id])
workspace Workspace @relation(fields: [workspaceId], references: [id])
/// @TypeGraphQL.omit(input: true, output: true)
workspaceId String
workspaceId String
pipelineProgresses PipelineProgress[]
/// @TypeGraphQL.omit(input: true, output: true)
deletedAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
PipelineProgress PipelineProgress[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("people")
}
@ -413,6 +426,7 @@ model PipelineStage {
index Int?
pipelineProgresses PipelineProgress[]
///
pipeline Pipeline @relation(fields: [pipelineId], references: [id])
pipelineId String
/// @TypeGraphQL.omit(input: true, output: true)

View File

@ -17,6 +17,11 @@ const globalDefaultFields: DefaultFieldsMap = {
firstName: true,
lastName: true,
},
Person: {
// Needed for displayName resolve field
firstName: true,
lastName: true,
},
};
export const PrismaSelector = createParamDecorator(