Add company and person on update and create
This commit is contained in:
@@ -6,6 +6,7 @@ import { GET_PEOPLE } from '@/people/queries';
|
||||
import {
|
||||
Activity,
|
||||
ActivityTarget,
|
||||
CommentableType,
|
||||
useAddActivityTargetsOnActivityMutation,
|
||||
useRemoveActivityTargetsOnActivityMutation,
|
||||
} from '~/generated/graphql';
|
||||
@@ -65,6 +66,10 @@ export function useHandleCheckableActivityTargetChange({
|
||||
createdAt: new Date().toISOString(),
|
||||
commentableType: entity.entityType,
|
||||
commentableId: entity.id,
|
||||
companyId:
|
||||
entity.entityType === CommentableType.Company ? entity.id : null,
|
||||
personId:
|
||||
entity.entityType === CommentableType.Person ? entity.id : null,
|
||||
})),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -9,7 +9,11 @@ import { useRightDrawer } from '@/ui/right-drawer/hooks/useRightDrawer';
|
||||
import { RightDrawerHotkeyScope } from '@/ui/right-drawer/types/RightDrawerHotkeyScope';
|
||||
import { RightDrawerPages } from '@/ui/right-drawer/types/RightDrawerPages';
|
||||
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
|
||||
import { ActivityType, useCreateActivityMutation } from '~/generated/graphql';
|
||||
import {
|
||||
ActivityType,
|
||||
CommentableType,
|
||||
useCreateActivityMutation,
|
||||
} from '~/generated/graphql';
|
||||
|
||||
import { GET_ACTIVITIES_BY_TARGETS, GET_ACTIVITY } from '../queries';
|
||||
import { commentableEntityArrayState } from '../states/commentableEntityArrayState';
|
||||
@@ -41,6 +45,9 @@ export function useOpenCreateActivityDrawer() {
|
||||
{
|
||||
commentableId: entity.id,
|
||||
commentableType: entity.type,
|
||||
companyId:
|
||||
entity.type === CommentableType.Company ? entity.id : null,
|
||||
personId: entity.type === CommentableType.Person ? entity.id : null,
|
||||
id: v4(),
|
||||
createdAt: new Date().toISOString(),
|
||||
},
|
||||
|
||||
@@ -54,6 +54,8 @@ export function useOpenCreateActivityDrawerForSelectedRowIds() {
|
||||
activityTargetArray: commentableEntityArray.map((entity) => ({
|
||||
commentableId: entity.id,
|
||||
commentableType: entity.type,
|
||||
companyId: entity.type === CommentableType.Company ? entity.id : null,
|
||||
personId: entity.type === CommentableType.Person ? entity.id : null,
|
||||
id: v4(),
|
||||
createdAt: new Date().toISOString(),
|
||||
})),
|
||||
|
||||
@@ -68,6 +68,8 @@ export const CREATE_ACTIVITY_WITH_COMMENT = gql`
|
||||
activityId
|
||||
commentableType
|
||||
commentableId
|
||||
companyId
|
||||
personId
|
||||
}
|
||||
comments {
|
||||
id
|
||||
|
||||
@@ -48,6 +48,8 @@ export const GET_ACTIVITIES_BY_TARGETS = gql`
|
||||
id
|
||||
commentableType
|
||||
commentableId
|
||||
companyId
|
||||
personId
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,6 +88,8 @@ export const GET_ACTIVITIES = gql`
|
||||
id
|
||||
commentableType
|
||||
commentableId
|
||||
companyId
|
||||
personId
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,6 +135,8 @@ export const GET_ACTIVITY = gql`
|
||||
id
|
||||
commentableType
|
||||
commentableId
|
||||
companyId
|
||||
personId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ export const ADD_ACTIVITY_TARGETS = gql`
|
||||
updatedAt
|
||||
commentableType
|
||||
commentableId
|
||||
companyId
|
||||
personId
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,6 +45,8 @@ export const REMOVE_ACTIVITY_TARGETS = gql`
|
||||
updatedAt
|
||||
commentableType
|
||||
commentableId
|
||||
companyId
|
||||
personId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user