Skip to content

Commit

Permalink
Convert the activity types / calendar_integrations back into lowercas…
Browse files Browse the repository at this point in the history
…e when we pass the data to the API since we get the data in lowercase.
  • Loading branch information
dr-bizz committed Dec 12, 2024
1 parent 0c76edd commit 49896c6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pages/api/graphql-rest.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -993,10 +993,22 @@ class MpdxRestApi extends RESTDataSource {
googleIntegrationId,
googleIntegration,
) {
const attributes = {};
interface GoogleIntegrationAttributes {
overwrite?: boolean;
calendar_id?: string;
calendar_integrations?: string[];
}
const attributes: GoogleIntegrationAttributes = {};
Object.keys(googleIntegration).map((key) => {
attributes[camelToSnake(key)] = googleIntegration[key];
});
if (attributes?.calendar_integrations) {
// Convert to lowercase since we convert them from lowercase to Uppercase
// when we fetch initially from pages/api/Schema/Settings/Integrations/Google/parse.ts
attributes.calendar_integrations = attributes?.calendar_integrations.map(
(integration) => integration.toLowerCase(),
);
}

const { data }: { data: GoogleIntegrationResponse } = await this.put(
`user/google_accounts/${googleAccountId}/google_integrations/${googleIntegrationId}`,
Expand Down

0 comments on commit 49896c6

Please sign in to comment.