Files
twenty_crm/front/src/modules/activities/queries/update.ts
Félix Malfait 10f7b08fdc Add attachments (#733)
* Add attachments v1

* Refacto

* Add Policy checks

* Fix tests

* Remove generated files from git

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2023-07-18 15:24:03 -07:00

100 lines
2.2 KiB
TypeScript

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
}
}
}
`;
export const DELETE_COMMENT_THREAD = gql`
mutation DeleteCommentThread($commentThreadId: String!) {
deleteManyCommentThreads(where: { id: { equals: $commentThreadId } }) {
count
}
}
`;
export const UPDATE_COMMENT_THREAD = 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 }
}
) {
id
body
title
type
}
}
`;
export const UPLOAD_ATTACHMENT = gql`
mutation UploadAttachment($file: Upload!, $activityId: String!) {
uploadAttachment(file: $file, activityId: $activityId)
}
`;