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
|
// Market attributes. All times are in milliseconds since epoch
|
||||||
closeTime?: number // Min of creator's chosen date, and resolutionTime
|
closeTime?: number // Min of creator's chosen date, and resolutionTime
|
||||||
question: string
|
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.
|
// 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.
|
// 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 { removeUndefinedProps } from 'common/util/object'
|
||||||
import { ENV_CONFIG } from 'common/envs/constants'
|
import { ENV_CONFIG } from 'common/envs/constants'
|
||||||
import { JSONContent } from '@tiptap/core'
|
import { JSONContent } from '@tiptap/core'
|
||||||
|
import { richTextToString } from 'common/lib/util/parse'
|
||||||
|
|
||||||
export type LiteMarket = {
|
export type LiteMarket = {
|
||||||
// Unique identifer for this market
|
// Unique identifer for this market
|
||||||
|
@ -22,6 +23,7 @@ export type LiteMarket = {
|
||||||
closeTime?: number
|
closeTime?: number
|
||||||
question: string
|
question: string
|
||||||
description: string | JSONContent
|
description: string | JSONContent
|
||||||
|
textDescription: string // string version of description
|
||||||
tags: string[]
|
tags: string[]
|
||||||
url: string
|
url: string
|
||||||
outcomeType: string
|
outcomeType: string
|
||||||
|
@ -117,6 +119,10 @@ export function toLiteMarket(contract: Contract): LiteMarket {
|
||||||
: closeTime,
|
: closeTime,
|
||||||
question,
|
question,
|
||||||
description,
|
description,
|
||||||
|
textDescription:
|
||||||
|
typeof description === 'string'
|
||||||
|
? description
|
||||||
|
: richTextToString(description),
|
||||||
tags,
|
tags,
|
||||||
url: `https://manifold.markets/${creatorUsername}/${slug}`,
|
url: `https://manifold.markets/${creatorUsername}/${slug}`,
|
||||||
pool,
|
pool,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user