add recurring calendar events for google cal (#19748)

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
neo773
2026-04-29 19:36:57 +05:30
committed by GitHub
parent 46ba5fd16c
commit 11628d19a3
17 changed files with 631 additions and 66 deletions
@@ -16,6 +16,7 @@ import { TimelineCalendarEventService } from './timeline-calendar-event.service'
type MockWorkspaceRepository = Partial<
WorkspaceRepository<CalendarEventWorkspaceEntity>
> & {
count: jest.Mock;
find: jest.Mock;
findAndCount: jest.Mock;
};
@@ -40,6 +41,7 @@ describe('TimelineCalendarEventService', () => {
beforeEach(async () => {
mockCalendarEventRepository = {
count: jest.fn().mockResolvedValue(1),
find: jest.fn(),
findAndCount: jest.fn(),
};
@@ -55,6 +55,16 @@ export class TimelineCalendarEventService {
'calendarEvent',
);
const totalNumberOfCalendarEvents = await calendarEventRepository.count(
{
where: {
calendarEventParticipants: {
personId: Any(personIds),
},
},
},
);
const calendarEventIds = await calendarEventRepository.find({
where: {
calendarEventParticipants: {
@@ -76,12 +86,12 @@ export class TimelineCalendarEventService {
if (ids.length <= 0) {
return {
totalNumberOfCalendarEvents: 0,
totalNumberOfCalendarEvents,
timelineCalendarEvents: [],
};
}
const [events, total] = await calendarEventRepository.findAndCount({
const [events] = await calendarEventRepository.findAndCount({
where: {
id: Any(ids),
},
@@ -241,7 +251,7 @@ export class TimelineCalendarEventService {
});
return {
totalNumberOfCalendarEvents: total,
totalNumberOfCalendarEvents,
timelineCalendarEvents,
};
},