add recurring calendar events for google cal (#19748)
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
+2
@@ -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(),
|
||||
};
|
||||
|
||||
+13
-3
@@ -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,
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user