Finished relation picker for companies (#305)

* Finished relation picker for companies

* Minor fixes
This commit is contained in:
Lucas Bordeau
2023-06-15 16:53:59 +02:00
committed by GitHub
parent f0910b3fbb
commit d28a762661
10 changed files with 741 additions and 63 deletions

View File

@ -26,6 +26,7 @@ export const GET_COMMENT_THREADS_BY_TARGETS = gql`
}
}
commentThreadTargets {
id
commentableId
commentableType
}

View File

@ -0,0 +1,62 @@
import { gql } from '@apollo/client';
export const ADD_COMMENT_THREAD_TARGET = gql`
mutation AddCommentThreadTargetOnCommentThread(
$commentThreadId: String!
$commentThreadTargetCreationDate: DateTime!
$commentThreadTargetId: String!
$commentableEntityId: String!
$commentableEntityType: CommentableType!
) {
updateOneCommentThread(
where: { id: $commentThreadId }
data: {
commentThreadTargets: {
connectOrCreate: {
create: {
id: $commentThreadTargetId
createdAt: $commentThreadTargetCreationDate
commentableType: $commentableEntityType
commentableId: $commentableEntityId
}
where: { id: $commentThreadTargetId }
}
}
}
) {
id
createdAt
updatedAt
commentThreadTargets {
id
createdAt
updatedAt
commentableType
commentableId
}
}
}
`;
export const REMOVE_COMMENT_THREAD_TARGET = gql`
mutation RemoveCommentThreadTargetOnCommentThread(
$commentThreadId: String!
$commentThreadTargetId: String!
) {
updateOneCommentThread(
where: { id: $commentThreadId }
data: { commentThreadTargets: { delete: { id: $commentThreadTargetId } } }
) {
id
createdAt
updatedAt
commentThreadTargets {
id
createdAt
updatedAt
commentableType
commentableId
}
}
}
`;