mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-24 08:33:49 +00:00
add locals on MyCalendar app
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {fetchResults} from '../../../../../ChillMainBundle/Resources/public/lib/api/apiMethods';
|
||||
import {datetimeToISO} from '../../../../../ChillMainBundle/Resources/public/chill/js/date';
|
||||
import {User} from '../../../../../ChillMainBundle/Resources/public/types';
|
||||
import {CalendarRange, CalendarRemote} from '../../types';
|
||||
import {CalendarLight, CalendarRange, CalendarRemote} from '../../types';
|
||||
|
||||
// re-export whoami
|
||||
export {whoami} from "../../../../../ChillMainBundle/Resources/public/lib/api/user";
|
||||
@@ -28,3 +28,11 @@ export const fetchCalendarRemoteForUser = (user: User, start: Date, end: Date):
|
||||
|
||||
return fetchResults<CalendarRemote>(uri, {dateFrom, dateTo});
|
||||
}
|
||||
|
||||
export const fetchCalendarLocalForUser = (user: User, start: Date, end: Date): Promise<CalendarLight[]> => {
|
||||
const uri = `/api/1.0/calendar/calendar/by-user/${user.id}.json`;
|
||||
const dateFrom = datetimeToISO(start);
|
||||
const dateTo = datetimeToISO(end);
|
||||
|
||||
return fetchResults<CalendarLight>(uri, {dateFrom, dateTo});
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import {COLORS} from '../const';
|
||||
import {ISOToDatetime} from '../../../../../../ChillMainBundle/Resources/public/chill/js/date';
|
||||
import {DateTime, User} from '../../../../../../ChillMainBundle/Resources/public/types';
|
||||
import {CalendarRange, CalendarRemote} from '../../../types';
|
||||
import {CalendarLight, CalendarRange, CalendarRemote} from '../../../types';
|
||||
import type {EventInputCalendarRange} from '../../../types';
|
||||
import {EventInput} from '@fullcalendar/vue3';
|
||||
|
||||
@@ -90,3 +90,14 @@ export const remoteToFullCalendarEvent = (entity: CalendarRemote): EventInput &
|
||||
is: 'remote',
|
||||
};
|
||||
}
|
||||
|
||||
export const localsToFullCalendarEvent = (entity: CalendarLight): EventInput & {id: string} => {
|
||||
return {
|
||||
id: `local_${entity.id}`,
|
||||
title: entity.persons.map(p => p.text).join(', '),
|
||||
start: entity.startDate.datetime8601,
|
||||
end: entity.endDate.datetime8601,
|
||||
allDay: false,
|
||||
is: 'local',
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user