# v367.1 CORI Mail schema JSON build fix

## Purpose

v367.1 is a build-fix package for v367. It keeps the CORI Mail schema-backed storage and Workspace Integrations foundation intact while correcting the TypeScript JSON typing issue reported during the server build.

## What was fixed

The server build failed because Prisma JSON fields were receiving raw `Record<string, unknown>` values. Prisma requires JSON inputs to be typed as safe JSON values, not arbitrary unknown records.

Updated files:

- `src/modules/cori-mail/cori-mail-persistence.service.ts`
- `src/modules/integrations/workspace-integrations.service.ts`

Both files now sanitize staged JSON objects before saving them to Prisma JSON fields.

## Behavior preserved

- CORI Mail provider accounts remain schema-backed.
- CORI Mail drafts remain schema-backed.
- CORI Mail email-to-work actions remain schema-backed.
- CORI Mail send audit records remain schema-backed.
- Workspace Integrations remains available at `/company/integrations`.
- Email, Google Maps API, Twilio, QuickBooks API, Stripe Connect, and Other APIs tabs remain available.
- Custom Domain SMTP remains a supported setup path.

## Prisma impact

No new Prisma schema changes were added in v367.1 beyond the v367 schema already deployed by `npx prisma db push`.

Because the v367 build already ran `npx prisma generate` and `npx prisma db push` successfully before the TypeScript error, the v367.1 command keeps Prisma generate in the sequence for safety but does not need another schema change.
