diff --git a/pages/api/index.ts b/pages/api/index.ts index d10c112..bcd17ac 100644 --- a/pages/api/index.ts +++ b/pages/api/index.ts @@ -551,7 +551,8 @@ export async function filterPublishers(selectFields, searchText, filterDate, fet select: { id: true, startTime: true, - endTime: true + endTime: true, + isPublished: true } } }, @@ -854,7 +855,11 @@ async function getCalendarEvents(publisherId, date, availabilities = true, assig }); } if (assignments) { - publisher.assignments?.forEach(item => { + //only published shifts + + publisher.assignments?.filter( + assignment => assignment.shift.isPublished + ).forEach(item => { result.push({ ...item, title: common.getTimeFomatted(new Date(item.shift.startTime)) + "-" + common.getTimeFomatted(new Date(item.shift.endTime)),