From 037628ab1dc5db31860a3cd0fd6f0bac984c9fff Mon Sep 17 00:00:00 2001 From: Charles Bochet Date: Sun, 16 Jul 2023 09:39:52 -0700 Subject: [PATCH] Enable Task creation (#688) --- front/src/generated/graphql.tsx | 440 ++++++++++++++---- .../CommentThreadBodyEditor.tsx | 13 +- .../CommentThreadCreateButton.tsx | 1 - .../CommentThreadTypeDropdown.tsx | 56 ++- .../components/right-drawer/CommentThread.tsx | 17 +- .../create/RightDrawerCreateCommentThread.tsx | 2 +- .../edit/RightDrawerEditCommentThread.tsx | 2 +- .../comments/components/timeline/Timeline.tsx | 17 +- ...penCreateCommentDrawerForSelectedRowIds.ts | 2 + .../hooks/useOpenCreateCommentThreadDrawer.ts | 11 +- front/src/modules/comments/services/create.ts | 3 + front/src/modules/comments/services/select.ts | 2 + front/src/modules/comments/services/update.ts | 35 +- .../components/PeopleCompanyCreateCell.tsx | 3 + .../ui/components/buttons/DropdownButton.tsx | 110 +++-- .../property-box/PropertyBoxItem.tsx | 2 +- .../components/RightDrawerTopBar.tsx | 16 +- .../comment-thread-count-aggregate.input.ts | 15 + .../comment-thread-count-aggregate.output.ts | 15 + ...t-thread-count-order-by-aggregate.input.ts | 15 + ...eate-many-assignee-input-envelope.input.ts | 15 + ...mment-thread-create-many-assignee.input.ts | 47 ++ ...comment-thread-create-many-author.input.ts | 16 + ...ment-thread-create-many-workspace.input.ts | 16 + .../comment-thread-create-many.input.ts | 16 + ...eate-nested-many-without-assignee.input.ts | 27 ++ ...reate-or-connect-without-assignee.input.ts | 17 + ...nt-thread-create-without-assignee.input.ts | 57 +++ ...ment-thread-create-without-author.input.ts | 17 + ...te-without-comment-thread-targets.input.ts | 23 +- ...nt-thread-create-without-comments.input.ts | 23 +- ...t-thread-create-without-workspace.input.ts | 23 +- .../comment-thread-create.input.ts | 23 +- .../comment-thread-group-by.output.ts | 16 + .../comment-thread-max-aggregate.input.ts | 15 + .../comment-thread-max-aggregate.output.ts | 16 + ...ent-thread-max-order-by-aggregate.input.ts | 15 + .../comment-thread-min-aggregate.input.ts | 15 + .../comment-thread-min-aggregate.output.ts | 16 + ...ent-thread-min-order-by-aggregate.input.ts | 15 + ...-thread-order-by-with-aggregation.input.ts | 15 + ...ent-thread-order-by-with-relation.input.ts | 18 + .../comment-thread-scalar-field.enum.ts | 5 + ...read-scalar-where-with-aggregates.input.ts | 16 + .../comment-thread-scalar-where.input.ts | 16 + ...eate-nested-many-without-assignee.input.ts | 27 ++ ...unchecked-create-without-assignee.input.ts | 55 +++ ...d-unchecked-create-without-author.input.ts | 16 + ...te-without-comment-thread-targets.input.ts | 16 + ...unchecked-create-without-comments.input.ts | 16 + ...nchecked-create-without-workspace.input.ts | 16 + .../comment-thread-unchecked-create.input.ts | 16 + ...-without-assigned-comment-threads.input.ts | 48 ++ ...date-many-without-assignee-nested.input.ts | 59 +++ ...-without-authored-comment-threads.input.ts | 48 ++ ...date-many-without-comment-threads.input.ts | 16 + ...ment-thread-unchecked-update-many.input.ts | 16 + ...unchecked-update-without-assignee.input.ts | 56 +++ ...d-unchecked-update-without-author.input.ts | 16 + ...te-without-comment-thread-targets.input.ts | 16 + ...unchecked-update-without-comments.input.ts | 16 + ...nchecked-update-without-workspace.input.ts | 16 + .../comment-thread-unchecked-update.input.ts | 16 + ...mment-thread-update-many-mutation.input.ts | 13 + ...-many-with-where-without-assignee.input.ts | 17 + ...date-many-without-assignee-nested.input.ts | 59 +++ ...ith-where-unique-without-assignee.input.ts | 17 + ...nt-thread-update-without-assignee.input.ts | 58 +++ ...ment-thread-update-without-author.input.ts | 17 + ...te-without-comment-thread-targets.input.ts | 23 +- ...nt-thread-update-without-comments.input.ts | 23 +- ...t-thread-update-without-workspace.input.ts | 23 +- .../comment-thread-update.input.ts | 23 +- ...ith-where-unique-without-assignee.input.ts | 22 + .../comment-thread-where.input.ts | 19 + .../comment-thread/comment-thread.model.ts | 19 + .../@generated/prisma/activity-type.enum.ts | 9 + ...vity-type-field-update-operations.input.ts | 10 + .../prisma/enum-activity-type-filter.input.ts | 20 + ...ivity-type-with-aggregates-filter.input.ts | 31 ++ .../nested-enum-activity-type-filter.input.ts | 19 + ...ivity-type-with-aggregates-filter.input.ts | 30 ++ .../core/@generated/user/user-count.output.ts | 5 +- ...-without-assigned-comment-threads.input.ts | 22 + ...-without-authored-comment-threads.input.ts | 22 + ...-without-assigned-comment-threads.input.ts | 17 + ...-without-authored-comment-threads.input.ts | 17 + ...-without-assigned-comment-threads.input.ts | 94 ++++ ...-without-authored-comment-threads.input.ts | 94 ++++ .../user-create-without-comments.input.ts | 6 +- .../user-create-without-companies.input.ts | 6 +- ...ser-create-without-refresh-tokens.input.ts | 6 +- ...r-create-without-workspace-member.input.ts | 6 +- .../core/@generated/user/user-create.input.ts | 6 +- .../user/user-order-by-with-relation.input.ts | 5 +- ...-without-assigned-comment-threads.input.ts | 94 ++++ ...-without-authored-comment-threads.input.ts | 94 ++++ ...unchecked-create-without-comments.input.ts | 6 +- ...nchecked-create-without-companies.input.ts | 6 +- ...ked-create-without-refresh-tokens.input.ts | 6 +- ...d-create-without-workspace-member.input.ts | 6 +- .../user/user-unchecked-create.input.ts | 6 +- ...-without-assigned-comment-threads.input.ts | 81 ++++ ...-without-authored-comment-threads.input.ts | 81 ++++ ...unchecked-update-without-comments.input.ts | 6 +- ...nchecked-update-without-companies.input.ts | 6 +- ...ked-update-without-refresh-tokens.input.ts | 6 +- ...d-update-without-workspace-member.input.ts | 6 +- .../user/user-unchecked-update.input.ts | 6 +- ...t-authored-comment-threads-nested.input.ts | 32 ++ ...t-assigned-comment-threads-nested.input.ts | 38 ++ ...-without-assigned-comment-threads.input.ts | 81 ++++ ...-without-authored-comment-threads.input.ts | 81 ++++ .../user-update-without-comments.input.ts | 6 +- .../user-update-without-companies.input.ts | 6 +- ...ser-update-without-refresh-tokens.input.ts | 6 +- ...r-update-without-workspace-member.input.ts | 6 +- .../core/@generated/user/user-update.input.ts | 6 +- ...-without-assigned-comment-threads.input.ts | 17 + ...-without-authored-comment-threads.input.ts | 17 + .../core/@generated/user/user-where.input.ts | 5 +- server/src/core/@generated/user/user.model.ts | 5 +- .../resolvers/comment-thread.resolver.ts | 14 + .../20230715235515_task_type/migration.sql | 12 + server/src/database/schema.prisma | 21 +- server/src/database/seeds/comments.ts | 4 + 126 files changed, 3032 insertions(+), 253 deletions(-) create mode 100644 server/src/core/@generated/comment-thread/comment-thread-create-many-assignee-input-envelope.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-create-many-assignee.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-create-nested-many-without-assignee.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-create-or-connect-without-assignee.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-create-without-assignee.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-unchecked-create-nested-many-without-assignee.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-unchecked-create-without-assignee.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-unchecked-update-many-without-assigned-comment-threads.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-unchecked-update-many-without-assignee-nested.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-unchecked-update-many-without-authored-comment-threads.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-unchecked-update-without-assignee.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-update-many-with-where-without-assignee.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-update-many-without-assignee-nested.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-update-with-where-unique-without-assignee.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-update-without-assignee.input.ts create mode 100644 server/src/core/@generated/comment-thread/comment-thread-upsert-with-where-unique-without-assignee.input.ts create mode 100644 server/src/core/@generated/prisma/activity-type.enum.ts create mode 100644 server/src/core/@generated/prisma/enum-activity-type-field-update-operations.input.ts create mode 100644 server/src/core/@generated/prisma/enum-activity-type-filter.input.ts create mode 100644 server/src/core/@generated/prisma/enum-activity-type-with-aggregates-filter.input.ts create mode 100644 server/src/core/@generated/prisma/nested-enum-activity-type-filter.input.ts create mode 100644 server/src/core/@generated/prisma/nested-enum-activity-type-with-aggregates-filter.input.ts create mode 100644 server/src/core/@generated/user/user-create-nested-one-without-assigned-comment-threads.input.ts create mode 100644 server/src/core/@generated/user/user-create-nested-one-without-authored-comment-threads.input.ts create mode 100644 server/src/core/@generated/user/user-create-or-connect-without-assigned-comment-threads.input.ts create mode 100644 server/src/core/@generated/user/user-create-or-connect-without-authored-comment-threads.input.ts create mode 100644 server/src/core/@generated/user/user-create-without-assigned-comment-threads.input.ts create mode 100644 server/src/core/@generated/user/user-create-without-authored-comment-threads.input.ts create mode 100644 server/src/core/@generated/user/user-unchecked-create-without-assigned-comment-threads.input.ts create mode 100644 server/src/core/@generated/user/user-unchecked-create-without-authored-comment-threads.input.ts create mode 100644 server/src/core/@generated/user/user-unchecked-update-without-assigned-comment-threads.input.ts create mode 100644 server/src/core/@generated/user/user-unchecked-update-without-authored-comment-threads.input.ts create mode 100644 server/src/core/@generated/user/user-update-one-required-without-authored-comment-threads-nested.input.ts create mode 100644 server/src/core/@generated/user/user-update-one-without-assigned-comment-threads-nested.input.ts create mode 100644 server/src/core/@generated/user/user-update-without-assigned-comment-threads.input.ts create mode 100644 server/src/core/@generated/user/user-update-without-authored-comment-threads.input.ts create mode 100644 server/src/core/@generated/user/user-upsert-without-assigned-comment-threads.input.ts create mode 100644 server/src/core/@generated/user/user-upsert-without-authored-comment-threads.input.ts create mode 100644 server/src/database/migrations/20230715235515_task_type/migration.sql diff --git a/front/src/generated/graphql.tsx b/front/src/generated/graphql.tsx index b294cf3d3..09bcfd8a9 100644 --- a/front/src/generated/graphql.tsx +++ b/front/src/generated/graphql.tsx @@ -18,6 +18,11 @@ export type Scalars = { Upload: any; }; +export enum ActivityType { + Note = 'Note', + Task = 'Task' +} + export type AffectedRows = { __typename?: 'AffectedRows'; count: Scalars['Int']; @@ -206,33 +211,67 @@ export type CommentScalarWhereInput = { export type CommentThread = { __typename?: 'CommentThread'; + assignee?: Maybe; + assigneeId?: Maybe; author: User; authorId: Scalars['String']; body?: Maybe; commentThreadTargets?: Maybe>; comments?: Maybe>; + completedAt?: Maybe; createdAt: Scalars['DateTime']; + dueAt?: Maybe; id: Scalars['ID']; + reminderAt?: Maybe; title?: Maybe; + type: ActivityType; updatedAt: Scalars['DateTime']; }; export type CommentThreadCreateInput = { - author: UserCreateNestedOneWithoutCommentThreadInput; + assignee?: InputMaybe; + author: UserCreateNestedOneWithoutAuthoredCommentThreadsInput; body?: InputMaybe; commentThreadTargets?: InputMaybe; comments?: InputMaybe; + completedAt?: InputMaybe; createdAt?: InputMaybe; + dueAt?: InputMaybe; id?: InputMaybe; + reminderAt?: InputMaybe; title?: InputMaybe; + type?: InputMaybe; updatedAt?: InputMaybe; }; -export type CommentThreadCreateManyAuthorInput = { +export type CommentThreadCreateManyAssigneeInput = { + authorId: Scalars['String']; body?: InputMaybe; + completedAt?: InputMaybe; createdAt?: InputMaybe; + dueAt?: InputMaybe; id?: InputMaybe; + reminderAt?: InputMaybe; title?: InputMaybe; + type?: InputMaybe; + updatedAt?: InputMaybe; +}; + +export type CommentThreadCreateManyAssigneeInputEnvelope = { + data: Array; + skipDuplicates?: InputMaybe; +}; + +export type CommentThreadCreateManyAuthorInput = { + assigneeId?: InputMaybe; + body?: InputMaybe; + completedAt?: InputMaybe; + createdAt?: InputMaybe; + dueAt?: InputMaybe; + id?: InputMaybe; + reminderAt?: InputMaybe; + title?: InputMaybe; + type?: InputMaybe; updatedAt?: InputMaybe; }; @@ -242,11 +281,16 @@ export type CommentThreadCreateManyAuthorInputEnvelope = { }; export type CommentThreadCreateManyWorkspaceInput = { + assigneeId?: InputMaybe; authorId: Scalars['String']; body?: InputMaybe; + completedAt?: InputMaybe; createdAt?: InputMaybe; + dueAt?: InputMaybe; id?: InputMaybe; + reminderAt?: InputMaybe; title?: InputMaybe; + type?: InputMaybe; updatedAt?: InputMaybe; }; @@ -255,6 +299,13 @@ export type CommentThreadCreateManyWorkspaceInputEnvelope = { skipDuplicates?: InputMaybe; }; +export type CommentThreadCreateNestedManyWithoutAssigneeInput = { + connect?: InputMaybe>; + connectOrCreate?: InputMaybe>; + create?: InputMaybe>; + createMany?: InputMaybe; +}; + export type CommentThreadCreateNestedManyWithoutAuthorInput = { connect?: InputMaybe>; connectOrCreate?: InputMaybe>; @@ -266,6 +317,11 @@ export type CommentThreadCreateNestedOneWithoutCommentsInput = { connect?: InputMaybe; }; +export type CommentThreadCreateOrConnectWithoutAssigneeInput = { + create: CommentThreadCreateWithoutAssigneeInput; + where: CommentThreadWhereUniqueInput; +}; + export type CommentThreadCreateOrConnectWithoutAuthorInput = { create: CommentThreadCreateWithoutAuthorInput; where: CommentThreadWhereUniqueInput; @@ -281,34 +337,64 @@ export type CommentThreadCreateOrConnectWithoutWorkspaceInput = { where: CommentThreadWhereUniqueInput; }; -export type CommentThreadCreateWithoutAuthorInput = { +export type CommentThreadCreateWithoutAssigneeInput = { + author: UserCreateNestedOneWithoutAuthoredCommentThreadsInput; body?: InputMaybe; commentThreadTargets?: InputMaybe; comments?: InputMaybe; + completedAt?: InputMaybe; createdAt?: InputMaybe; + dueAt?: InputMaybe; id?: InputMaybe; + reminderAt?: InputMaybe; title?: InputMaybe; + type?: InputMaybe; + updatedAt?: InputMaybe; +}; + +export type CommentThreadCreateWithoutAuthorInput = { + assignee?: InputMaybe; + body?: InputMaybe; + commentThreadTargets?: InputMaybe; + comments?: InputMaybe; + completedAt?: InputMaybe; + createdAt?: InputMaybe; + dueAt?: InputMaybe; + id?: InputMaybe; + reminderAt?: InputMaybe; + title?: InputMaybe; + type?: InputMaybe; updatedAt?: InputMaybe; }; export type CommentThreadCreateWithoutCommentsInput = { - author: UserCreateNestedOneWithoutCommentThreadInput; + assignee?: InputMaybe; + author: UserCreateNestedOneWithoutAuthoredCommentThreadsInput; body?: InputMaybe; commentThreadTargets?: InputMaybe; + completedAt?: InputMaybe; createdAt?: InputMaybe; + dueAt?: InputMaybe; id?: InputMaybe; + reminderAt?: InputMaybe; title?: InputMaybe; + type?: InputMaybe; updatedAt?: InputMaybe; }; export type CommentThreadCreateWithoutWorkspaceInput = { - author: UserCreateNestedOneWithoutCommentThreadInput; + assignee?: InputMaybe; + author: UserCreateNestedOneWithoutAuthoredCommentThreadsInput; body?: InputMaybe; commentThreadTargets?: InputMaybe; comments?: InputMaybe; + completedAt?: InputMaybe; createdAt?: InputMaybe; + dueAt?: InputMaybe; id?: InputMaybe; + reminderAt?: InputMaybe; title?: InputMaybe; + type?: InputMaybe; updatedAt?: InputMaybe; }; @@ -323,14 +409,20 @@ export type CommentThreadOrderByRelationAggregateInput = { }; export type CommentThreadOrderByWithRelationInput = { + assignee?: InputMaybe; + assigneeId?: InputMaybe; author?: InputMaybe; authorId?: InputMaybe; body?: InputMaybe; commentThreadTargets?: InputMaybe; comments?: InputMaybe; + completedAt?: InputMaybe; createdAt?: InputMaybe; + dueAt?: InputMaybe; id?: InputMaybe; + reminderAt?: InputMaybe; title?: InputMaybe; + type?: InputMaybe; updatedAt?: InputMaybe; }; @@ -340,12 +432,17 @@ export type CommentThreadRelationFilter = { }; export enum CommentThreadScalarFieldEnum { + AssigneeId = 'assigneeId', AuthorId = 'authorId', Body = 'body', + CompletedAt = 'completedAt', CreatedAt = 'createdAt', DeletedAt = 'deletedAt', + DueAt = 'dueAt', Id = 'id', + ReminderAt = 'reminderAt', Title = 'title', + Type = 'type', UpdatedAt = 'updatedAt', WorkspaceId = 'workspaceId' } @@ -354,11 +451,16 @@ export type CommentThreadScalarWhereInput = { AND?: InputMaybe>; NOT?: InputMaybe>; OR?: InputMaybe>; + assigneeId?: InputMaybe; authorId?: InputMaybe; body?: InputMaybe; + completedAt?: InputMaybe; createdAt?: InputMaybe; + dueAt?: InputMaybe; id?: InputMaybe; + reminderAt?: InputMaybe; title?: InputMaybe; + type?: InputMaybe; updatedAt?: InputMaybe; }; @@ -489,24 +591,38 @@ export type CommentThreadTargetWhereUniqueInput = { }; export type CommentThreadUpdateInput = { - author?: InputMaybe; + assignee?: InputMaybe; + author?: InputMaybe; body?: InputMaybe; commentThreadTargets?: InputMaybe; comments?: InputMaybe; + completedAt?: InputMaybe; createdAt?: InputMaybe; + dueAt?: InputMaybe; id?: InputMaybe; + reminderAt?: InputMaybe; title?: InputMaybe; + type?: InputMaybe; updatedAt?: InputMaybe; }; export type CommentThreadUpdateManyMutationInput = { body?: InputMaybe; + completedAt?: InputMaybe; createdAt?: InputMaybe; + dueAt?: InputMaybe; id?: InputMaybe; + reminderAt?: InputMaybe; title?: InputMaybe; + type?: InputMaybe; updatedAt?: InputMaybe; }; +export type CommentThreadUpdateManyWithWhereWithoutAssigneeInput = { + data: CommentThreadUpdateManyMutationInput; + where: CommentThreadScalarWhereInput; +}; + export type CommentThreadUpdateManyWithWhereWithoutAuthorInput = { data: CommentThreadUpdateManyMutationInput; where: CommentThreadScalarWhereInput; @@ -517,6 +633,20 @@ export type CommentThreadUpdateManyWithWhereWithoutWorkspaceInput = { where: CommentThreadScalarWhereInput; }; +export type CommentThreadUpdateManyWithoutAssigneeNestedInput = { + connect?: InputMaybe>; + connectOrCreate?: InputMaybe>; + create?: InputMaybe>; + createMany?: InputMaybe; + delete?: InputMaybe>; + deleteMany?: InputMaybe>; + disconnect?: InputMaybe>; + set?: InputMaybe>; + update?: InputMaybe>; + updateMany?: InputMaybe>; + upsert?: InputMaybe>; +}; + export type CommentThreadUpdateManyWithoutAuthorNestedInput = { connect?: InputMaybe>; connectOrCreate?: InputMaybe>; @@ -553,6 +683,11 @@ export type CommentThreadUpdateOneRequiredWithoutCommentsNestedInput = { upsert?: InputMaybe; }; +export type CommentThreadUpdateWithWhereUniqueWithoutAssigneeInput = { + data: CommentThreadUpdateWithoutAssigneeInput; + where: CommentThreadWhereUniqueInput; +}; + export type CommentThreadUpdateWithWhereUniqueWithoutAuthorInput = { data: CommentThreadUpdateWithoutAuthorInput; where: CommentThreadWhereUniqueInput; @@ -563,37 +698,73 @@ export type CommentThreadUpdateWithWhereUniqueWithoutWorkspaceInput = { where: CommentThreadWhereUniqueInput; }; -export type CommentThreadUpdateWithoutAuthorInput = { +export type CommentThreadUpdateWithoutAssigneeInput = { + author?: InputMaybe; body?: InputMaybe; commentThreadTargets?: InputMaybe; comments?: InputMaybe; + completedAt?: InputMaybe; createdAt?: InputMaybe; + dueAt?: InputMaybe; id?: InputMaybe; + reminderAt?: InputMaybe; title?: InputMaybe; + type?: InputMaybe; + updatedAt?: InputMaybe; +}; + +export type CommentThreadUpdateWithoutAuthorInput = { + assignee?: InputMaybe; + body?: InputMaybe; + commentThreadTargets?: InputMaybe; + comments?: InputMaybe; + completedAt?: InputMaybe; + createdAt?: InputMaybe; + dueAt?: InputMaybe; + id?: InputMaybe; + reminderAt?: InputMaybe; + title?: InputMaybe; + type?: InputMaybe; updatedAt?: InputMaybe; }; export type CommentThreadUpdateWithoutCommentsInput = { - author?: InputMaybe; + assignee?: InputMaybe; + author?: InputMaybe; body?: InputMaybe; commentThreadTargets?: InputMaybe; + completedAt?: InputMaybe; createdAt?: InputMaybe; + dueAt?: InputMaybe; id?: InputMaybe; + reminderAt?: InputMaybe; title?: InputMaybe; + type?: InputMaybe; updatedAt?: InputMaybe; }; export type CommentThreadUpdateWithoutWorkspaceInput = { - author?: InputMaybe; + assignee?: InputMaybe; + author?: InputMaybe; body?: InputMaybe; commentThreadTargets?: InputMaybe; comments?: InputMaybe; + completedAt?: InputMaybe; createdAt?: InputMaybe; + dueAt?: InputMaybe; id?: InputMaybe; + reminderAt?: InputMaybe; title?: InputMaybe; + type?: InputMaybe; updatedAt?: InputMaybe; }; +export type CommentThreadUpsertWithWhereUniqueWithoutAssigneeInput = { + create: CommentThreadCreateWithoutAssigneeInput; + update: CommentThreadUpdateWithoutAssigneeInput; + where: CommentThreadWhereUniqueInput; +}; + export type CommentThreadUpsertWithWhereUniqueWithoutAuthorInput = { create: CommentThreadCreateWithoutAuthorInput; update: CommentThreadUpdateWithoutAuthorInput; @@ -615,14 +786,20 @@ export type CommentThreadWhereInput = { AND?: InputMaybe>; NOT?: InputMaybe>; OR?: InputMaybe>; + assignee?: InputMaybe; + assigneeId?: InputMaybe; author?: InputMaybe; authorId?: InputMaybe; body?: InputMaybe; commentThreadTargets?: InputMaybe; comments?: InputMaybe; + completedAt?: InputMaybe; createdAt?: InputMaybe; + dueAt?: InputMaybe; id?: InputMaybe; + reminderAt?: InputMaybe; title?: InputMaybe; + type?: InputMaybe; updatedAt?: InputMaybe; }; @@ -1089,6 +1266,17 @@ export type DateTimeNullableFilter = { notIn?: InputMaybe>; }; +export type EnumActivityTypeFieldUpdateOperationsInput = { + set?: InputMaybe; +}; + +export type EnumActivityTypeFilter = { + equals?: InputMaybe; + in?: InputMaybe>; + not?: InputMaybe; + notIn?: InputMaybe>; +}; + export type EnumCommentableTypeFieldUpdateOperationsInput = { set?: InputMaybe; }; @@ -1347,6 +1535,13 @@ export type NestedDateTimeNullableFilter = { notIn?: InputMaybe>; }; +export type NestedEnumActivityTypeFilter = { + equals?: InputMaybe; + in?: InputMaybe>; + not?: InputMaybe; + notIn?: InputMaybe>; +}; + export type NestedEnumCommentableTypeFilter = { equals?: InputMaybe; in?: InputMaybe>; @@ -2634,7 +2829,8 @@ export type Telemetry = { export type User = { __typename?: 'User'; - CommentThread?: Maybe>; + assignedCommentThreads?: Maybe>; + authoredCommentThreads?: Maybe>; avatarUrl?: Maybe; comments?: Maybe>; companies?: Maybe>; @@ -2654,10 +2850,16 @@ export type User = { workspaceMember?: Maybe; }; -export type UserCreateNestedOneWithoutCommentThreadInput = { +export type UserCreateNestedOneWithoutAssignedCommentThreadsInput = { connect?: InputMaybe; - connectOrCreate?: InputMaybe; - create?: InputMaybe; + connectOrCreate?: InputMaybe; + create?: InputMaybe; +}; + +export type UserCreateNestedOneWithoutAuthoredCommentThreadsInput = { + connect?: InputMaybe; + connectOrCreate?: InputMaybe; + create?: InputMaybe; }; export type UserCreateNestedOneWithoutCommentsInput = { @@ -2674,8 +2876,13 @@ export type UserCreateNestedOneWithoutWorkspaceMemberInput = { create?: InputMaybe; }; -export type UserCreateOrConnectWithoutCommentThreadInput = { - create: UserCreateWithoutCommentThreadInput; +export type UserCreateOrConnectWithoutAssignedCommentThreadsInput = { + create: UserCreateWithoutAssignedCommentThreadsInput; + where: UserWhereUniqueInput; +}; + +export type UserCreateOrConnectWithoutAuthoredCommentThreadsInput = { + create: UserCreateWithoutAuthoredCommentThreadsInput; where: UserWhereUniqueInput; }; @@ -2689,7 +2896,27 @@ export type UserCreateOrConnectWithoutWorkspaceMemberInput = { where: UserWhereUniqueInput; }; -export type UserCreateWithoutCommentThreadInput = { +export type UserCreateWithoutAssignedCommentThreadsInput = { + authoredCommentThreads?: InputMaybe; + avatarUrl?: InputMaybe; + comments?: InputMaybe; + companies?: InputMaybe; + createdAt?: InputMaybe; + disabled?: InputMaybe; + email: Scalars['String']; + emailVerified?: InputMaybe; + firstName?: InputMaybe; + id?: InputMaybe; + lastName?: InputMaybe; + lastSeen?: InputMaybe; + locale: Scalars['String']; + metadata?: InputMaybe; + phoneNumber?: InputMaybe; + updatedAt?: InputMaybe; +}; + +export type UserCreateWithoutAuthoredCommentThreadsInput = { + assignedCommentThreads?: InputMaybe; avatarUrl?: InputMaybe; comments?: InputMaybe; companies?: InputMaybe; @@ -2708,7 +2935,8 @@ export type UserCreateWithoutCommentThreadInput = { }; export type UserCreateWithoutCommentsInput = { - CommentThread?: InputMaybe; + assignedCommentThreads?: InputMaybe; + authoredCommentThreads?: InputMaybe; avatarUrl?: InputMaybe; companies?: InputMaybe; createdAt?: InputMaybe; @@ -2726,7 +2954,8 @@ export type UserCreateWithoutCommentsInput = { }; export type UserCreateWithoutWorkspaceMemberInput = { - CommentThread?: InputMaybe; + assignedCommentThreads?: InputMaybe; + authoredCommentThreads?: InputMaybe; avatarUrl?: InputMaybe; comments?: InputMaybe; companies?: InputMaybe; @@ -2750,7 +2979,8 @@ export type UserExists = { }; export type UserOrderByWithRelationInput = { - CommentThread?: InputMaybe; + assignedCommentThreads?: InputMaybe; + authoredCommentThreads?: InputMaybe; avatarUrl?: InputMaybe; comments?: InputMaybe; companies?: InputMaybe; @@ -2792,7 +3022,8 @@ export enum UserScalarFieldEnum { } export type UserUpdateInput = { - CommentThread?: InputMaybe; + assignedCommentThreads?: InputMaybe; + authoredCommentThreads?: InputMaybe; avatarUrl?: InputMaybe; comments?: InputMaybe; companies?: InputMaybe; @@ -2810,12 +3041,12 @@ export type UserUpdateInput = { updatedAt?: InputMaybe; }; -export type UserUpdateOneRequiredWithoutCommentThreadNestedInput = { +export type UserUpdateOneRequiredWithoutAuthoredCommentThreadsNestedInput = { connect?: InputMaybe; - connectOrCreate?: InputMaybe; - create?: InputMaybe; - update?: InputMaybe; - upsert?: InputMaybe; + connectOrCreate?: InputMaybe; + create?: InputMaybe; + update?: InputMaybe; + upsert?: InputMaybe; }; export type UserUpdateOneRequiredWithoutCommentsNestedInput = { @@ -2834,11 +3065,41 @@ export type UserUpdateOneRequiredWithoutWorkspaceMemberNestedInput = { upsert?: InputMaybe; }; +export type UserUpdateOneWithoutAssignedCommentThreadsNestedInput = { + connect?: InputMaybe; + connectOrCreate?: InputMaybe; + create?: InputMaybe; + delete?: InputMaybe; + disconnect?: InputMaybe; + update?: InputMaybe; + upsert?: InputMaybe; +}; + export type UserUpdateOneWithoutCompaniesNestedInput = { connect?: InputMaybe; }; -export type UserUpdateWithoutCommentThreadInput = { +export type UserUpdateWithoutAssignedCommentThreadsInput = { + authoredCommentThreads?: InputMaybe; + avatarUrl?: InputMaybe; + comments?: InputMaybe; + companies?: InputMaybe; + createdAt?: InputMaybe; + disabled?: InputMaybe; + email?: InputMaybe; + emailVerified?: InputMaybe; + firstName?: InputMaybe; + id?: InputMaybe; + lastName?: InputMaybe; + lastSeen?: InputMaybe; + locale?: InputMaybe; + metadata?: InputMaybe; + phoneNumber?: InputMaybe; + updatedAt?: InputMaybe; +}; + +export type UserUpdateWithoutAuthoredCommentThreadsInput = { + assignedCommentThreads?: InputMaybe; avatarUrl?: InputMaybe; comments?: InputMaybe; companies?: InputMaybe; @@ -2857,7 +3118,8 @@ export type UserUpdateWithoutCommentThreadInput = { }; export type UserUpdateWithoutCommentsInput = { - CommentThread?: InputMaybe; + assignedCommentThreads?: InputMaybe; + authoredCommentThreads?: InputMaybe; avatarUrl?: InputMaybe; companies?: InputMaybe; createdAt?: InputMaybe; @@ -2875,7 +3137,8 @@ export type UserUpdateWithoutCommentsInput = { }; export type UserUpdateWithoutWorkspaceMemberInput = { - CommentThread?: InputMaybe; + assignedCommentThreads?: InputMaybe; + authoredCommentThreads?: InputMaybe; avatarUrl?: InputMaybe; comments?: InputMaybe; companies?: InputMaybe; @@ -2893,9 +3156,14 @@ export type UserUpdateWithoutWorkspaceMemberInput = { updatedAt?: InputMaybe; }; -export type UserUpsertWithoutCommentThreadInput = { - create: UserCreateWithoutCommentThreadInput; - update: UserUpdateWithoutCommentThreadInput; +export type UserUpsertWithoutAssignedCommentThreadsInput = { + create: UserCreateWithoutAssignedCommentThreadsInput; + update: UserUpdateWithoutAssignedCommentThreadsInput; +}; + +export type UserUpsertWithoutAuthoredCommentThreadsInput = { + create: UserCreateWithoutAuthoredCommentThreadsInput; + update: UserUpdateWithoutAuthoredCommentThreadsInput; }; export type UserUpsertWithoutCommentsInput = { @@ -2910,9 +3178,10 @@ export type UserUpsertWithoutWorkspaceMemberInput = { export type UserWhereInput = { AND?: InputMaybe>; - CommentThread?: InputMaybe; NOT?: InputMaybe>; OR?: InputMaybe>; + assignedCommentThreads?: InputMaybe; + authoredCommentThreads?: InputMaybe; avatarUrl?: InputMaybe; comments?: InputMaybe; companies?: InputMaybe; @@ -3169,13 +3438,14 @@ export type CreateCommentThreadMutationVariables = Exact<{ commentThreadId: Scalars['String']; body?: InputMaybe; title?: InputMaybe; + type: ActivityType; authorId: Scalars['String']; createdAt: Scalars['DateTime']; commentThreadTargetArray: Array | CommentThreadTargetCreateManyCommentThreadInput; }>; -export type CreateCommentThreadMutation = { __typename?: 'Mutation', createOneCommentThread: { __typename?: 'CommentThread', id: string, createdAt: string, updatedAt: string, authorId: string, commentThreadTargets?: Array<{ __typename?: 'CommentThreadTarget', id: string, createdAt: string, updatedAt: string, commentThreadId: string, commentableType: CommentableType, commentableId: string }> | null, comments?: Array<{ __typename?: 'Comment', id: string, createdAt: string, updatedAt: string, body: string, author: { __typename?: 'User', id: string } }> | null } }; +export type CreateCommentThreadMutation = { __typename?: 'Mutation', createOneCommentThread: { __typename?: 'CommentThread', id: string, createdAt: string, updatedAt: string, authorId: string, type: ActivityType, commentThreadTargets?: Array<{ __typename?: 'CommentThreadTarget', id: string, createdAt: string, updatedAt: string, commentThreadId: string, commentableType: CommentableType, commentableId: string }> | null, comments?: Array<{ __typename?: 'Comment', id: string, createdAt: string, updatedAt: string, body: string, author: { __typename?: 'User', id: string } }> | null } }; export type GetCommentThreadsByTargetsQueryVariables = Exact<{ commentThreadTargetIds: Array | Scalars['String']; @@ -3183,14 +3453,14 @@ export type GetCommentThreadsByTargetsQueryVariables = Exact<{ }>; -export type GetCommentThreadsByTargetsQuery = { __typename?: 'Query', findManyCommentThreads: Array<{ __typename?: 'CommentThread', id: string, createdAt: string, title?: string | null, body?: string | null, 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 }, 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, 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 }, 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']; @@ -3218,21 +3488,15 @@ export type DeleteCommentThreadMutationVariables = Exact<{ export type DeleteCommentThreadMutation = { __typename?: 'Mutation', deleteManyCommentThreads: { __typename?: 'AffectedRows', count: number } }; -export type UpdateCommentThreadTitleMutationVariables = Exact<{ - commentThreadId: Scalars['String']; - commentThreadTitle?: InputMaybe; +export type UpdateCommentThreadMutationVariables = Exact<{ + id: Scalars['String']; + body?: InputMaybe; + title?: InputMaybe; + type?: InputMaybe; }>; -export type UpdateCommentThreadTitleMutation = { __typename?: 'Mutation', updateOneCommentThread: { __typename?: 'CommentThread', id: string, title?: string | null } }; - -export type UpdateCommentThreadBodyMutationVariables = Exact<{ - commentThreadId: Scalars['String']; - commentThreadBody?: InputMaybe; -}>; - - -export type UpdateCommentThreadBodyMutation = { __typename?: 'Mutation', updateOneCommentThread: { __typename?: 'CommentThread', id: string, body?: string | null } }; +export type UpdateCommentThreadMutation = { __typename?: 'Mutation', updateOneCommentThread: { __typename?: 'CommentThread', id: string, body?: string | null, title?: string | null, type: ActivityType } }; export type GetCompaniesQueryVariables = Exact<{ orderBy?: InputMaybe | CompanyOrderByWithRelationInput>; @@ -3874,14 +4138,15 @@ export type CreateCommentMutationHookResult = ReturnType; export type CreateCommentMutationOptions = Apollo.BaseMutationOptions; export const CreateCommentThreadDocument = gql` - mutation CreateCommentThread($commentThreadId: String!, $body: String, $title: String, $authorId: String!, $createdAt: DateTime!, $commentThreadTargetArray: [CommentThreadTargetCreateManyCommentThreadInput!]!) { + mutation CreateCommentThread($commentThreadId: String!, $body: String, $title: String, $type: ActivityType!, $authorId: String!, $createdAt: DateTime!, $commentThreadTargetArray: [CommentThreadTargetCreateManyCommentThreadInput!]!) { createOneCommentThread( - data: {id: $commentThreadId, createdAt: $createdAt, updatedAt: $createdAt, author: {connect: {id: $authorId}}, body: $body, title: $title, commentThreadTargets: {createMany: {data: $commentThreadTargetArray, skipDuplicates: true}}} + data: {id: $commentThreadId, createdAt: $createdAt, updatedAt: $createdAt, author: {connect: {id: $authorId}}, body: $body, title: $title, type: $type, commentThreadTargets: {createMany: {data: $commentThreadTargetArray, skipDuplicates: true}}} ) { id createdAt updatedAt authorId + type commentThreadTargets { id createdAt @@ -3920,6 +4185,7 @@ export type CreateCommentThreadMutationFn = Apollo.MutationFunction; export type DeleteCommentThreadMutationResult = Apollo.MutationResult; export type DeleteCommentThreadMutationOptions = Apollo.BaseMutationOptions; -export const UpdateCommentThreadTitleDocument = gql` - mutation UpdateCommentThreadTitle($commentThreadId: String!, $commentThreadTitle: String) { +export const UpdateCommentThreadDocument = gql` + mutation UpdateCommentThread($id: String!, $body: String, $title: String, $type: ActivityType) { updateOneCommentThread( - where: {id: $commentThreadId} - data: {title: {set: $commentThreadTitle}} - ) { - id - title - } -} - `; -export type UpdateCommentThreadTitleMutationFn = Apollo.MutationFunction; - -/** - * __useUpdateCommentThreadTitleMutation__ - * - * To run a mutation, you first call `useUpdateCommentThreadTitleMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useUpdateCommentThreadTitleMutation` 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 [updateCommentThreadTitleMutation, { data, loading, error }] = useUpdateCommentThreadTitleMutation({ - * variables: { - * commentThreadId: // value for 'commentThreadId' - * commentThreadTitle: // value for 'commentThreadTitle' - * }, - * }); - */ -export function useUpdateCommentThreadTitleMutation(baseOptions?: Apollo.MutationHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useMutation(UpdateCommentThreadTitleDocument, options); - } -export type UpdateCommentThreadTitleMutationHookResult = ReturnType; -export type UpdateCommentThreadTitleMutationResult = Apollo.MutationResult; -export type UpdateCommentThreadTitleMutationOptions = Apollo.BaseMutationOptions; -export const UpdateCommentThreadBodyDocument = gql` - mutation UpdateCommentThreadBody($commentThreadId: String!, $commentThreadBody: String) { - updateOneCommentThread( - where: {id: $commentThreadId} - data: {body: {set: $commentThreadBody}} + where: {id: $id} + data: {body: {set: $body}, title: {set: $title}, type: {set: $type}} ) { id body + title + type } } `; -export type UpdateCommentThreadBodyMutationFn = Apollo.MutationFunction; +export type UpdateCommentThreadMutationFn = Apollo.MutationFunction; /** - * __useUpdateCommentThreadBodyMutation__ + * __useUpdateCommentThreadMutation__ * - * To run a mutation, you first call `useUpdateCommentThreadBodyMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useUpdateCommentThreadBodyMutation` returns a tuple that includes: + * To run a mutation, you first call `useUpdateCommentThreadMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useUpdateCommentThreadMutation` 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 [updateCommentThreadBodyMutation, { data, loading, error }] = useUpdateCommentThreadBodyMutation({ + * const [updateCommentThreadMutation, { data, loading, error }] = useUpdateCommentThreadMutation({ * variables: { - * commentThreadId: // value for 'commentThreadId' - * commentThreadBody: // value for 'commentThreadBody' + * id: // value for 'id' + * body: // value for 'body' + * title: // value for 'title' + * type: // value for 'type' * }, * }); */ -export function useUpdateCommentThreadBodyMutation(baseOptions?: Apollo.MutationHookOptions) { +export function useUpdateCommentThreadMutation(baseOptions?: Apollo.MutationHookOptions) { const options = {...defaultOptions, ...baseOptions} - return Apollo.useMutation(UpdateCommentThreadBodyDocument, options); + return Apollo.useMutation(UpdateCommentThreadDocument, options); } -export type UpdateCommentThreadBodyMutationHookResult = ReturnType; -export type UpdateCommentThreadBodyMutationResult = Apollo.MutationResult; -export type UpdateCommentThreadBodyMutationOptions = Apollo.BaseMutationOptions; +export type UpdateCommentThreadMutationHookResult = ReturnType; +export type UpdateCommentThreadMutationResult = Apollo.MutationResult; +export type UpdateCommentThreadMutationOptions = Apollo.BaseMutationOptions; export const GetCompaniesDocument = gql` query GetCompanies($orderBy: [CompanyOrderByWithRelationInput!], $where: CompanyWhereInput) { companies: findManyCompany(orderBy: $orderBy, where: $where) { diff --git a/front/src/modules/comments/components/comment-thread/CommentThreadBodyEditor.tsx b/front/src/modules/comments/components/comment-thread/CommentThreadBodyEditor.tsx index 8e7283cad..fc46a0cb0 100644 --- a/front/src/modules/comments/components/comment-thread/CommentThreadBodyEditor.tsx +++ b/front/src/modules/comments/components/comment-thread/CommentThreadBodyEditor.tsx @@ -9,7 +9,7 @@ import { BlockEditor } from '@/ui/components/editor/BlockEditor'; import { debounce } from '@/utils/debounce'; import { CommentThread, - useUpdateCommentThreadBodyMutation, + useUpdateCommentThreadMutation, } from '~/generated/graphql'; const BlockNoteStyledContainer = styled.div` @@ -22,8 +22,7 @@ type OwnProps = { }; export function CommentThreadBodyEditor({ commentThread, onChange }: OwnProps) { - const [updateCommentThreadBodyMutation] = - useUpdateCommentThreadBodyMutation(); + const [updateCommentThreadMutation] = useUpdateCommentThreadMutation(); const [body, setBody] = useState(null); @@ -36,10 +35,10 @@ export function CommentThreadBodyEditor({ commentThread, onChange }: OwnProps) { const debounceOnChange = useMemo(() => { function onInternalChange(commentThreadBody: string) { setBody(commentThreadBody); - updateCommentThreadBodyMutation({ + updateCommentThreadMutation({ variables: { - commentThreadId: commentThread.id, - commentThreadBody: commentThreadBody, + id: commentThread.id, + body: commentThreadBody, }, refetchQueries: [ getOperationName(GET_COMMENT_THREADS_BY_TARGETS) ?? '', @@ -48,7 +47,7 @@ export function CommentThreadBodyEditor({ commentThread, onChange }: OwnProps) { } return debounce(onInternalChange, 200); - }, [commentThread, updateCommentThreadBodyMutation, setBody]); + }, [commentThread, updateCommentThreadMutation, setBody]); const editor: BlockNoteEditor | null = useBlockNote({ initialContent: commentThread.body diff --git a/front/src/modules/comments/components/comment-thread/CommentThreadCreateButton.tsx b/front/src/modules/comments/components/comment-thread/CommentThreadCreateButton.tsx index 8d1375968..3051275c6 100644 --- a/front/src/modules/comments/components/comment-thread/CommentThreadCreateButton.tsx +++ b/front/src/modules/comments/components/comment-thread/CommentThreadCreateButton.tsx @@ -26,7 +26,6 @@ export function CommentThreadCreateButton({