Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(web): call calendar endpoints through the gateway's /calendar route (#6752)

gbirmanc86febf3e30c
diff --git a/apps/web/src/lib/core/constant/servers.ts b/apps/web/src/lib/core/constant/servers.ts
index 2ca0b42594..4e2ac89415 100644
--- a/apps/web/src/lib/core/constant/servers.ts
+++ b/apps/web/src/lib/core/constant/servers.ts
@@ -11,6 +11,11 @@ const serverHostLocal: Servers = {
'unfurl-service': 'http://localhost:8095',
contacts: 'http://localhost:8083',
'email-service': 'http://localhost:8087',
+ // No gateway locally — requests go straight to a service port. email-service
+ // still serves /calendar/* on 8087; switch to calendar_service (8088) once it
+ // joins the local stack. The client drops the /calendar segment, so it is
+ // carried here.
+ 'calendar-service': 'http://localhost:8087/calendar',
'image-proxy-service': 'http://localhost:8097',
'scheduled-action': 'http://localhost:8099',
'agent-harness': 'http://localhost:8101',
@@ -41,6 +46,7 @@ const serverHostRemote = {
'unfurl-service': `${gatewayHost}/unfurl`,
contacts: `${gatewayHost}/contacts`,
'email-service': `${gatewayHost}/email`,
+ 'calendar-service': `${gatewayHost}/calendar`,
'image-proxy-service': `${gatewayHost}/image-proxy`,
'scheduled-action': `${gatewayHost}/scheduled-action`,
'agent-harness': `${gatewayHost}/agent-harness`,
@@ -104,6 +110,11 @@ function proxyServers(): Servers | undefined {
'agent-harness': `${proxyOrigin}/agent-harness`,
contacts: `${proxyOrigin}/contacts`,
'email-service': `${proxyOrigin}/email`,
+ // The proxy has no /calendar route yet (calendar_service is not in the local
+ // inventory), so reach email-service's /calendar/* through its /email prefix,
+ // which the proxy strips. Point at ${proxyOrigin}/calendar once calendar_service
+ // joins the stack.
+ 'calendar-service': `${proxyOrigin}/email/calendar`,
'image-proxy-service': `${proxyOrigin}/image-proxy`,
'scheduled-action': `${proxyOrigin}/scheduled-action`,
};
diff --git a/apps/web/src/lib/service-clients/service-email/client.ts b/apps/web/src/lib/service-clients/service-email/client.ts
index d70f4e65d9..a364483958 100644
--- a/apps/web/src/lib/service-clients/service-email/client.ts
+++ b/apps/web/src/lib/service-clients/service-email/client.ts
@@ -44,6 +44,7 @@ import { CalendarMutationErrorCode } from './generated/schemas/calendarMutationE
import type { EmptyResponse } from './generated/schemas/emptyResponse';
const emailHost: string = SERVER_HOSTS['email-service'];
+const calendarHost: string = SERVER_HOSTS['calendar-service'];
/**
* Header that scopes a mutating email request to a specific inbox. Omitted for
@@ -587,16 +588,13 @@ export const emailClient = {
});
},
async listCalendars() {
- return fetchWithToken<ListCalendarsResponse>(
- `${emailHost}/calendar/calendars`,
- {
- method: 'GET',
- }
- );
+ return fetchWithToken<ListCalendarsResponse>(`${calendarHost}/calendars`, {
+ method: 'GET',
+ });
},
async createCalendarEvent(args: CreateCalendarEventRequest) {
return fetchWithToken<CalendarEvent, CalendarMutationErrorCode>(
- `${emailHost}/calendar/events`,
+ `${calendarHost}/events`,
{
method: 'POST',
body: JSON.stringify(args),
@@ -606,7 +604,7 @@ export const emailClient = {
},
async updateCalendarEvent(eventId: string, args: UpdateCalendarEventRequest) {
return fetchWithToken<CalendarEvent, CalendarMutationErrorCode>(
- `${emailHost}/calendar/events/${eventId}`,
+ `${calendarHost}/events/${eventId}`,
{
method: 'PATCH',
body: JSON.stringify(args),
@@ -634,7 +632,7 @@ export const emailClient = {
}
const query = params.toString();
return fetchWithToken<EmptyResponse, CalendarMutationErrorCode>(
- `${emailHost}/calendar/events/${eventId}${query ? `?${query}` : ''}`,
+ `${calendarHost}/events/${eventId}${query ? `?${query}` : ''}`,
{
method: 'DELETE',
errorResponseHandler: calendarMutationErrorHandler,
@@ -643,7 +641,7 @@ export const emailClient = {
},
async rsvpCalendarEvent(eventId: string, args: RsvpCalendarEventRequest) {
return fetchWithToken<CalendarEvent, CalendarMutationErrorCode>(
- `${emailHost}/calendar/events/${eventId}/rsvp`,
+ `${calendarHost}/events/${eventId}/rsvp`,
{
method: 'PUT',
body: JSON.stringify(args),