mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-16 09:39:39 +02:00
Backend: Hono/Bun service on port 3042 with JMAP client for Stalwart, account provisioning (@mana.how addresses on user registration), thread/message/send/label API endpoints, and JWT + service-key auth. Frontend: Mail module with 3-column inbox UI (mailboxes, thread list, detail/compose), local-first encrypted drafts in Dexie, and API-driven thread fetching. Scoped CSS with theme tokens. Integration: Dexie v11 schema, mail pgSchema in mana_platform, mana-auth fire-and-forget hook for account provisioning, getManaMailUrl() in API config, app registry + branding update. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
/**
|
|
* Zod validation schemas for request bodies.
|
|
*/
|
|
|
|
import { z } from 'zod';
|
|
|
|
export const sendEmailSchema = z.object({
|
|
to: z.array(z.object({ email: z.string().email(), name: z.string().optional() })).min(1),
|
|
cc: z.array(z.object({ email: z.string().email(), name: z.string().optional() })).optional(),
|
|
bcc: z.array(z.object({ email: z.string().email(), name: z.string().optional() })).optional(),
|
|
subject: z.string().min(1),
|
|
body: z.string().min(1),
|
|
htmlBody: z.string().optional(),
|
|
inReplyTo: z.string().optional(),
|
|
references: z.array(z.string()).optional(),
|
|
});
|
|
|
|
export const saveDraftSchema = z.object({
|
|
to: z.array(z.object({ email: z.string().email(), name: z.string().optional() })).optional(),
|
|
cc: z.array(z.object({ email: z.string().email(), name: z.string().optional() })).optional(),
|
|
subject: z.string().optional(),
|
|
body: z.string().optional(),
|
|
htmlBody: z.string().optional(),
|
|
inReplyTo: z.string().optional(),
|
|
});
|
|
|
|
export const updateMessageSchema = z.object({
|
|
isRead: z.boolean().optional(),
|
|
isFlagged: z.boolean().optional(),
|
|
mailboxIds: z.record(z.boolean()).optional(),
|
|
});
|
|
|
|
export const updateAccountSchema = z.object({
|
|
displayName: z.string().optional(),
|
|
signature: z.string().optional(),
|
|
});
|
|
|
|
export const onUserCreatedSchema = z.object({
|
|
userId: z.string().min(1),
|
|
email: z.string().email(),
|
|
name: z.string().optional(),
|
|
});
|