Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion services/api/src/encoders/decision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ export const proposalAttachmentEncoder = createSelectSchema(proposalAttachments)
* - `json`: TipTap document fetched from collaboration service
* - `html`: Legacy HTML/plain text description from proposalData
*/
const documentContentEncoder = z.discriminatedUnion('type', [
export const documentContentEncoder = z.discriminatedUnion('type', [
z.object({
type: z.literal('json'),
content: z.array(z.unknown()),
Expand Down
3 changes: 3 additions & 0 deletions services/api/src/encoders/legacyDecision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { createSelectSchema } from 'drizzle-zod';
import { z } from 'zod';

import { attachmentWithUrlEncoder } from './attachments';
import { documentContentEncoder } from './decision';
import { baseProfileEncoder } from './profiles';

// JSON Schema types
Expand Down Expand Up @@ -243,6 +244,8 @@ export const legacyProposalEncoder = createSelectSchema(proposals)
voteCount: z.number().optional(),
// Allocated amount (for results)
allocated: z.string().nullable().optional(),
// Document content (TipTap JSON or legacy HTML)
documentContent: documentContentEncoder.optional(),
});

// Decision Encoder
Expand Down
Loading