- added search in topbar - added skeleton search results page - added tests - set personal calendars as default search in and allow to select personal and shared as a search in option --------- Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
import ICAL from "ical.js";
|
||||
import moment from "moment-timezone";
|
||||
import { detectDateTimeFormat } from "../../components/Event/utils/dateTimeHelpers";
|
||||
import { User } from "../../components/Attendees/PeopleSearch";
|
||||
|
||||
function resolveTimezoneId(tzid?: string): string | undefined {
|
||||
if (!tzid) return undefined;
|
||||
@@ -361,3 +362,41 @@ export async function importEventFromFile(id: string, calLink: string) {
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
export async function searchEvent(
|
||||
query: string,
|
||||
filters: {
|
||||
searchIn: string[];
|
||||
keywords: string;
|
||||
organizers: string[];
|
||||
attendees: string[];
|
||||
}
|
||||
) {
|
||||
const { keywords, searchIn, organizers, attendees } = filters;
|
||||
|
||||
const reqParam: {
|
||||
query: string;
|
||||
calendars: { calendarId: string; userId: string }[];
|
||||
organizers?: string[];
|
||||
attendees?: string[];
|
||||
} = {
|
||||
query: !!keywords ? keywords : query,
|
||||
calendars: searchIn.map((calId) => {
|
||||
const [userId, calendarId] = calId.split("/");
|
||||
return { calendarId, userId };
|
||||
}),
|
||||
};
|
||||
if (organizers.length) {
|
||||
reqParam.organizers = organizers;
|
||||
}
|
||||
if (attendees.length) {
|
||||
reqParam.attendees = attendees;
|
||||
}
|
||||
const response = await api
|
||||
.post("calendar/api/events/search?limit=30&offset=0", {
|
||||
body: JSON.stringify(reqParam),
|
||||
})
|
||||
.json();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user