Remove activityType and Id (#1179)

* Remove activityType and Id

* Fix tests

* Fix tests
This commit is contained in:
Charles Bochet
2023-08-12 02:31:54 +02:00
committed by GitHub
parent a30222fe76
commit 35ea6b5a2f
37 changed files with 360 additions and 822 deletions

View File

@ -1,5 +1,58 @@
import { gql } from '@apollo/client';
export const ACTIVITY_QUERY_FRAGMENT = gql`
fragment ActivityQueryFragment on Activity {
id
createdAt
title
body
type
completedAt
dueAt
assignee {
id
firstName
lastName
displayName
avatarUrl
}
author {
id
firstName
lastName
displayName
}
comments {
id
body
createdAt
updatedAt
author {
id
displayName
firstName
lastName
avatarUrl
}
}
activityTargets {
id
companyId
personId
company {
id
name
domainName
}
person {
id
displayName
avatarUrl
}
}
}
`;
export const GET_ACTIVITIES_BY_TARGETS = gql`
query GetActivitiesByTargets(
$activityTargetIds: [String!]!
@ -8,49 +61,17 @@ export const GET_ACTIVITIES_BY_TARGETS = gql`
findManyActivities(
orderBy: $orderBy
where: {
activityTargets: { some: { commentableId: { in: $activityTargetIds } } }
}
) {
id
createdAt
title
body
type
completedAt
dueAt
assignee {
id
firstName
lastName
displayName
avatarUrl
}
author {
id
firstName
lastName
displayName
}
comments {
id
body
createdAt
updatedAt
author {
id
displayName
firstName
lastName
avatarUrl
activityTargets: {
some: {
OR: [
{ personId: { in: $activityTargetIds } }
{ companyId: { in: $activityTargetIds } }
]
}
}
}
activityTargets {
id
commentableType
commentableId
companyId
personId
}
) {
...ActivityQueryFragment
}
}
`;
@ -61,36 +82,7 @@ export const GET_ACTIVITIES = gql`
$orderBy: [ActivityOrderByWithRelationInput!]
) {
findManyActivities(orderBy: $orderBy, where: $where) {
id
createdAt
title
body
type
completedAt
dueAt
assignee {
id
firstName
lastName
displayName
avatarUrl
}
author {
id
firstName
lastName
displayName
}
comments {
id
}
activityTargets {
id
commentableType
commentableId
companyId
personId
}
...ActivityQueryFragment
}
}
`;
@ -98,46 +90,7 @@ export const GET_ACTIVITIES = gql`
export const GET_ACTIVITY = gql`
query GetActivity($activityId: String!) {
findManyActivities(where: { id: { equals: $activityId } }) {
id
createdAt
body
title
type
completedAt
dueAt
assignee {
id
firstName
lastName
displayName
avatarUrl
}
author {
id
firstName
lastName
displayName
}
comments {
id
body
createdAt
updatedAt
author {
id
displayName
firstName
lastName
avatarUrl
}
}
activityTargets {
id
commentableType
commentableId
companyId
personId
}
...ActivityQueryFragment
}
}
`;