diff --git a/front/src/generated/graphql.tsx b/front/src/generated/graphql.tsx index fc47353bb..d7dfe7c9c 100644 --- a/front/src/generated/graphql.tsx +++ b/front/src/generated/graphql.tsx @@ -117,8 +117,8 @@ export type ActivityTarget = { __typename?: 'ActivityTarget'; activity: Activity; activityId: Scalars['String']; - commentableId: Scalars['String']; - commentableType: CommentableType; + commentableId?: Maybe; + commentableType?: Maybe; company?: Maybe; companyId?: Maybe; createdAt: Scalars['DateTime']; @@ -129,8 +129,8 @@ export type ActivityTarget = { }; export type ActivityTargetCreateManyActivityInput = { - commentableId: Scalars['String']; - commentableType: CommentableType; + commentableId?: InputMaybe; + commentableType?: InputMaybe; companyId?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; @@ -145,8 +145,8 @@ export type ActivityTargetCreateManyActivityInputEnvelope = { export type ActivityTargetCreateManyCompanyInput = { activityId: Scalars['String']; - commentableId: Scalars['String']; - commentableType: CommentableType; + commentableId?: InputMaybe; + commentableType?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; personId?: InputMaybe; @@ -160,8 +160,8 @@ export type ActivityTargetCreateManyCompanyInputEnvelope = { export type ActivityTargetCreateManyPersonInput = { activityId: Scalars['String']; - commentableId: Scalars['String']; - commentableType: CommentableType; + commentableId?: InputMaybe; + commentableType?: InputMaybe; companyId?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; @@ -175,8 +175,8 @@ export type ActivityTargetCreateManyPersonInputEnvelope = { export type ActivityTargetCreateManyWorkspaceInput = { activityId: Scalars['String']; - commentableId: Scalars['String']; - commentableType: CommentableType; + commentableId?: InputMaybe; + commentableType?: InputMaybe; companyId?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; @@ -231,8 +231,8 @@ export type ActivityTargetCreateOrConnectWithoutWorkspaceInput = { }; export type ActivityTargetCreateWithoutActivityInput = { - commentableId: Scalars['String']; - commentableType: CommentableType; + commentableId?: InputMaybe; + commentableType?: InputMaybe; company?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; @@ -242,8 +242,8 @@ export type ActivityTargetCreateWithoutActivityInput = { export type ActivityTargetCreateWithoutCompanyInput = { activity: ActivityCreateNestedOneWithoutActivityTargetsInput; - commentableId: Scalars['String']; - commentableType: CommentableType; + commentableId?: InputMaybe; + commentableType?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; person?: InputMaybe; @@ -252,8 +252,8 @@ export type ActivityTargetCreateWithoutCompanyInput = { export type ActivityTargetCreateWithoutPersonInput = { activity: ActivityCreateNestedOneWithoutActivityTargetsInput; - commentableId: Scalars['String']; - commentableType: CommentableType; + commentableId?: InputMaybe; + commentableType?: InputMaybe; company?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; @@ -262,8 +262,8 @@ export type ActivityTargetCreateWithoutPersonInput = { export type ActivityTargetCreateWithoutWorkspaceInput = { activity: ActivityCreateNestedOneWithoutActivityTargetsInput; - commentableId: Scalars['String']; - commentableType: CommentableType; + commentableId?: InputMaybe; + commentableType?: InputMaybe; company?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; @@ -286,8 +286,8 @@ export type ActivityTargetScalarWhereInput = { NOT?: InputMaybe>; OR?: InputMaybe>; activityId?: InputMaybe; - commentableId?: InputMaybe; - commentableType?: InputMaybe; + commentableId?: InputMaybe; + commentableType?: InputMaybe; companyId?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; @@ -345,8 +345,8 @@ export type ActivityTargetWhereInput = { OR?: InputMaybe>; activity?: InputMaybe; activityId?: InputMaybe; - commentableId?: InputMaybe; - commentableType?: InputMaybe; + commentableId?: InputMaybe; + commentableType?: InputMaybe; company?: InputMaybe; companyId?: InputMaybe; createdAt?: InputMaybe; @@ -559,20 +559,22 @@ export enum ColorScheme { export type Comment = { __typename?: 'Comment'; - activity: Activity; - activityId: Scalars['String']; + activity?: Maybe; + activityId?: Maybe; author: User; authorId: Scalars['String']; body: Scalars['String']; + commentThreadId?: Maybe; createdAt: Scalars['DateTime']; id: Scalars['ID']; updatedAt: Scalars['DateTime']; }; export type CommentCreateInput = { - activity: ActivityCreateNestedOneWithoutCommentsInput; + activity?: InputMaybe; author: UserCreateNestedOneWithoutCommentsInput; body: Scalars['String']; + commentThreadId?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; updatedAt?: InputMaybe; @@ -615,10 +617,11 @@ export type CommentWhereInput = { NOT?: InputMaybe>; OR?: InputMaybe>; activity?: InputMaybe; - activityId?: InputMaybe; + activityId?: InputMaybe; author?: InputMaybe; authorId?: InputMaybe; body?: InputMaybe; + commentThreadId?: InputMaybe; createdAt?: InputMaybe; id?: InputMaybe; updatedAt?: InputMaybe; @@ -814,10 +817,10 @@ export type EnumColorSchemeFilter = { notIn?: InputMaybe>; }; -export type EnumCommentableTypeFilter = { +export type EnumCommentableTypeNullableFilter = { equals?: InputMaybe; in?: InputMaybe>; - not?: InputMaybe; + not?: InputMaybe; notIn?: InputMaybe>; }; @@ -1112,10 +1115,10 @@ export type NestedEnumColorSchemeFilter = { notIn?: InputMaybe>; }; -export type NestedEnumCommentableTypeFilter = { +export type NestedEnumCommentableTypeNullableFilter = { equals?: InputMaybe; in?: InputMaybe>; - not?: InputMaybe; + not?: InputMaybe; notIn?: InputMaybe>; }; @@ -2205,7 +2208,7 @@ export type CreateCommentMutationVariables = Exact<{ }>; -export type CreateCommentMutation = { __typename?: 'Mutation', createOneComment: { __typename?: 'Comment', id: string, createdAt: string, body: string, activityId: string, author: { __typename?: 'User', id: string, displayName: string, firstName?: string | null, lastName?: string | null, avatarUrl?: string | null } } }; +export type CreateCommentMutation = { __typename?: 'Mutation', createOneComment: { __typename?: 'Comment', id: string, createdAt: string, body: string, activityId?: string | null, author: { __typename?: 'User', id: string, displayName: string, firstName?: string | null, lastName?: string | null, avatarUrl?: string | null } } }; export type CreateActivityMutationVariables = Exact<{ activityId: Scalars['String']; @@ -2218,7 +2221,7 @@ export type CreateActivityMutationVariables = Exact<{ }>; -export type CreateActivityMutation = { __typename?: 'Mutation', createOneActivity: { __typename?: 'Activity', id: string, createdAt: string, updatedAt: string, authorId: string, type: ActivityType, activityTargets?: Array<{ __typename?: 'ActivityTarget', id: string, createdAt: string, updatedAt: string, activityId: 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 CreateActivityMutation = { __typename?: 'Mutation', createOneActivity: { __typename?: 'Activity', id: string, createdAt: string, updatedAt: string, authorId: string, type: ActivityType, activityTargets?: Array<{ __typename?: 'ActivityTarget', id: string, createdAt: string, updatedAt: string, activityId: string, commentableType?: CommentableType | null, commentableId?: string | null }> | null, comments?: Array<{ __typename?: 'Comment', id: string, createdAt: string, updatedAt: string, body: string, author: { __typename?: 'User', id: string } }> | null } }; export type GetActivitiesByTargetsQueryVariables = Exact<{ activityTargetIds: Array | Scalars['String']; @@ -2226,14 +2229,14 @@ export type GetActivitiesByTargetsQueryVariables = Exact<{ }>; -export type GetActivitiesByTargetsQuery = { __typename?: 'Query', findManyActivities: Array<{ __typename?: 'Activity', id: string, createdAt: string, title?: string | null, body?: string | null, type: ActivityType, completedAt?: string | null, 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, activityTargets?: Array<{ __typename?: 'ActivityTarget', id: string, commentableType: CommentableType, commentableId: string }> | null }> }; +export type GetActivitiesByTargetsQuery = { __typename?: 'Query', findManyActivities: Array<{ __typename?: 'Activity', id: string, createdAt: string, title?: string | null, body?: string | null, type: ActivityType, completedAt?: string | null, 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, activityTargets?: Array<{ __typename?: 'ActivityTarget', id: string, commentableType?: CommentableType | null, commentableId?: string | null }> | null }> }; export type GetActivityQueryVariables = Exact<{ activityId: Scalars['String']; }>; -export type GetActivityQuery = { __typename?: 'Query', findManyActivities: Array<{ __typename?: 'Activity', id: string, createdAt: string, body?: string | null, title?: string | null, type: ActivityType, completedAt?: string | null, 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, activityTargets?: Array<{ __typename?: 'ActivityTarget', id: string, commentableType: CommentableType, commentableId: string }> | null }> }; +export type GetActivityQuery = { __typename?: 'Query', findManyActivities: Array<{ __typename?: 'Activity', id: string, createdAt: string, body?: string | null, title?: string | null, type: ActivityType, completedAt?: string | null, 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, activityTargets?: Array<{ __typename?: 'ActivityTarget', id: string, commentableType?: CommentableType | null, commentableId?: string | null }> | null }> }; export type AddActivityTargetsOnActivityMutationVariables = Exact<{ activityId: Scalars['String']; @@ -2241,7 +2244,7 @@ export type AddActivityTargetsOnActivityMutationVariables = Exact<{ }>; -export type AddActivityTargetsOnActivityMutation = { __typename?: 'Mutation', updateOneActivity: { __typename?: 'Activity', id: string, createdAt: string, updatedAt: string, activityTargets?: Array<{ __typename?: 'ActivityTarget', id: string, createdAt: string, updatedAt: string, commentableType: CommentableType, commentableId: string }> | null } }; +export type AddActivityTargetsOnActivityMutation = { __typename?: 'Mutation', updateOneActivity: { __typename?: 'Activity', id: string, createdAt: string, updatedAt: string, activityTargets?: Array<{ __typename?: 'ActivityTarget', id: string, createdAt: string, updatedAt: string, commentableType?: CommentableType | null, commentableId?: string | null }> | null } }; export type RemoveActivityTargetsOnActivityMutationVariables = Exact<{ activityId: Scalars['String']; @@ -2249,7 +2252,7 @@ export type RemoveActivityTargetsOnActivityMutationVariables = Exact<{ }>; -export type RemoveActivityTargetsOnActivityMutation = { __typename?: 'Mutation', updateOneActivity: { __typename?: 'Activity', id: string, createdAt: string, updatedAt: string, activityTargets?: Array<{ __typename?: 'ActivityTarget', id: string, createdAt: string, updatedAt: string, commentableType: CommentableType, commentableId: string }> | null } }; +export type RemoveActivityTargetsOnActivityMutation = { __typename?: 'Mutation', updateOneActivity: { __typename?: 'Activity', id: string, createdAt: string, updatedAt: string, activityTargets?: Array<{ __typename?: 'ActivityTarget', id: string, createdAt: string, updatedAt: string, commentableType?: CommentableType | null, commentableId?: string | null }> | null } }; export type DeleteActivityMutationVariables = Exact<{ activityId: Scalars['String']; diff --git a/front/src/pages/companies/__stories__/Company.stories.tsx b/front/src/pages/companies/__stories__/Company.stories.tsx index 6efd7faff..c5fa6306d 100644 --- a/front/src/pages/companies/__stories__/Company.stories.tsx +++ b/front/src/pages/companies/__stories__/Company.stories.tsx @@ -91,7 +91,7 @@ export const EditNote: Story = { graphql.query(getOperationName(GET_ACTIVITY) ?? '', (req, res, ctx) => { return res( ctx.data({ - findManyActivitys: [mockedActivities[0]], + findManyActivities: [mockedActivities[0]], }), ); }), diff --git a/server/src/database/migrations/20230728063528_make_comment_thread_id_optional/migration.sql b/server/src/database/migrations/20230728063528_make_comment_thread_id_optional/migration.sql new file mode 100644 index 000000000..8b75896dd --- /dev/null +++ b/server/src/database/migrations/20230728063528_make_comment_thread_id_optional/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "comments" ALTER COLUMN "commentThreadId" DROP NOT NULL; diff --git a/server/src/database/schema.prisma b/server/src/database/schema.prisma index 8f2d37a0b..e4c87ddba 100644 --- a/server/src/database/schema.prisma +++ b/server/src/database/schema.prisma @@ -361,7 +361,7 @@ model Comment { authorId String activity Activity? @relation(fields: [activityId], references: [id], onDelete: Cascade) activityId String? - commentThreadId String + commentThreadId String? /// @TypeGraphQL.omit(input: true, output: true) workspace Workspace @relation(fields: [workspaceId], references: [id]) /// @TypeGraphQL.omit(input: true, output: true)