MCPcopy Create free account
hub / github.com/bewcloud/bewcloud / get

Function get

pages/calendars.ts:11–35  ·  view source on GitHub ↗
({ request, user, match, session, isRunningLocally }: RequestHandlerParams)

Source from the content-addressed store, hash-verified

9const titlePrefix = 'Calendars';
10
11async function get({ request, user, match, session, isRunningLocally }: RequestHandlerParams): Promise<Response> {
12 const calendarConfig = await AppConfig.getCalendarConfig();
13
14 if (!calendarConfig.enableCalDavServer) {
15 throw new Error('CalDAV server is not enabled');
16 }
17
18 if (!(await AppConfig.isAppEnabled('calendar'))) {
19 throw new Error('Calendar app is not enabled');
20 }
21
22 const userCalendars = await CalendarModel.list(user!.id);
23
24 const htmlContent = defaultHtmlContent({ userCalendars });
25
26 return basicLayoutResponse(htmlContent, {
27 currentPath: match.pathname.input,
28 titlePrefix,
29 match,
30 request,
31 user,
32 session,
33 isRunningLocally,
34 });
35}
36
37function defaultHtmlContent({ userCalendars }: { userCalendars: Calendar[] }) {
38 return html`

Callers

nothing calls this directly

Calls 5

basicLayoutResponseFunction · 0.90
getCalendarConfigMethod · 0.80
isAppEnabledMethod · 0.80
defaultHtmlContentFunction · 0.70
listMethod · 0.45

Tested by

no test coverage detected