4643 create a pre hook for calendar events (#4666)

* copy message pre hook

* add CalendarQueryHookModule to workspace-pre-query-hook.module

* use CalendarChannelVisibility enum

* add calendarEvent to workspace-pre-query-hook.config

* fix pre-hook

* fix findOne prehook in config

* rename fragments

* fix import

* update findOne prehook and create can-access-calendar-event.provider

* replace provider with service

* fix type

* renaming

* remove unnecessary eslint skip

---------

Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
bosiraphael
2024-03-27 19:44:35 +01:00
committed by GitHub
parent c3cc0f651c
commit d687523e22
13 changed files with 257 additions and 38 deletions

View File

@ -1,20 +0,0 @@
import { gql } from '@apollo/client';
import { attendeeFragment } from '@/activities/calendar/queries/fragments/attendeeFragment';
export const calendarEventFragment = gql`
fragment CalendarEventFragment on TimelineCalendarEvent {
id
title
description
location
startsAt
endsAt
isFullDay
visibility
attendees {
...AttendeeFragment
}
}
${attendeeFragment}
`;

View File

@ -1,7 +1,7 @@
import { gql } from '@apollo/client';
export const attendeeFragment = gql`
fragment AttendeeFragment on TimelineCalendarEventAttendee {
export const timelineCalendarEventAttendeeFragment = gql`
fragment TimelineCalendarEventAttendeeFragment on TimelineCalendarEventAttendee {
personId
workspaceMemberId
firstName

View File

@ -0,0 +1,20 @@
import { gql } from '@apollo/client';
import { timelineCalendarEventAttendeeFragment } from '@/activities/calendar/queries/fragments/timelineCalendarEventAttendeeFragment';
export const timelineCalendarEventFragment = gql`
fragment TimelineCalendarEventFragment on TimelineCalendarEvent {
id
title
description
location
startsAt
endsAt
isFullDay
visibility
attendees {
...TimelineCalendarEventAttendeeFragment
}
}
${timelineCalendarEventAttendeeFragment}
`;

View File

@ -1,13 +1,13 @@
import { gql } from '@apollo/client';
import { calendarEventFragment } from '@/activities/calendar/queries/fragments/calendarEventFragment';
import { timelineCalendarEventFragment } from '@/activities/calendar/queries/fragments/timelineCalendarEventFragment';
export const timelineCalendarEventWithTotalFragment = gql`
fragment TimelineCalendarEventsWithTotalFragment on TimelineCalendarEventsWithTotal {
totalNumberOfCalendarEvents
timelineCalendarEvents {
...CalendarEventFragment
...TimelineCalendarEventFragment
}
}
${calendarEventFragment}
${timelineCalendarEventFragment}
`;

View File

@ -1,6 +1,6 @@
import { gql } from '@apollo/client';
import { timelineCalendarEventWithTotalFragment } from '@/activities/calendar/queries/fragments/calendarEventFragmentWithTotalFragment';
import { timelineCalendarEventWithTotalFragment } from '@/activities/calendar/queries/fragments/timelineCalendarEventWithTotalFragment';
export const getTimelineCalendarEventsFromCompanyId = gql`
query GetTimelineCalendarEventsFromCompanyId(

View File

@ -1,6 +1,6 @@
import { gql } from '@apollo/client';
import { timelineCalendarEventWithTotalFragment } from '@/activities/calendar/queries/fragments/calendarEventFragmentWithTotalFragment';
import { timelineCalendarEventWithTotalFragment } from '@/activities/calendar/queries/fragments/timelineCalendarEventWithTotalFragment';
export const getTimelineCalendarEventsFromPersonId = gql`
query GetTimelineCalendarEventsFromPersonId(