Return a string description in market API
This commit is contained in:
parent
af5477e11e
commit
7db3f045a5
|
@ -113,7 +113,8 @@ Requires no authorization.
|
|||
// Market attributes. All times are in milliseconds since epoch
|
||||
closeTime?: number // Min of creator's chosen date, and resolutionTime
|
||||
question: string
|
||||
description: string
|
||||
description: JSONContent // Rich text content. See https://tiptap.dev/guide/output#option-1-json
|
||||
textDescription: string // string description without formatting, images, or embeds
|
||||
|
||||
// A list of tags on each market. Any user can add tags to any market.
|
||||
// This list also includes the predefined categories shown as filters on the home page.
|
||||
|
|
|
@ -7,6 +7,7 @@ import { User } from 'common/user'
|
|||
import { removeUndefinedProps } from 'common/util/object'
|
||||
import { ENV_CONFIG } from 'common/envs/constants'
|
||||
import { JSONContent } from '@tiptap/core'
|
||||
import { richTextToString } from 'common/lib/util/parse'
|
||||
|
||||
export type LiteMarket = {
|
||||
// Unique identifer for this market
|
||||
|
@ -22,6 +23,7 @@ export type LiteMarket = {
|
|||
closeTime?: number
|
||||
question: string
|
||||
description: string | JSONContent
|
||||
textDescription: string // string version of description
|
||||
tags: string[]
|
||||
url: string
|
||||
outcomeType: string
|
||||
|
@ -117,6 +119,10 @@ export function toLiteMarket(contract: Contract): LiteMarket {
|
|||
: closeTime,
|
||||
question,
|
||||
description,
|
||||
textDescription:
|
||||
typeof description === 'string'
|
||||
? description
|
||||
: richTextToString(description),
|
||||
tags,
|
||||
url: `https://manifold.markets/${creatorUsername}/${slug}`,
|
||||
pool,
|
||||
|
|
Loading…
Reference in New Issue
Block a user