Take descriptions out of LiteMarket (#789)

This commit is contained in:
Sinclair Chen 2022-08-22 18:18:51 -07:00 committed by GitHub
parent baa27a3c85
commit b476a7e3f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -97,7 +97,6 @@ Requires no authorization.
"creatorAvatarUrl":"https://lh3.googleusercontent.com/a-/AOh14GiZyl1lBehuBMGyJYJhZd-N-mstaUtgE4xdI22lLw=s96-c",
"closeTime":1653893940000,
"question":"Will I write a new blog post today?",
"description":"I'm supposed to, or else Beeminder charges me $90.\nTentative topic ideas:\n- \"Manifold funding, a history\"\n- \"Markets and bounties allow trades through time\"\n- \"equity vs money vs time\"\n\nClose date updated to 2022-05-29 11:59 pm",
"tags":[
"personal",
"commitments"
@ -135,8 +134,6 @@ 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: 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.
@ -398,6 +395,8 @@ Requires no authorization.
bets: Bet[]
comments: Comment[]
answers?: Answer[]
description: JSONContent // Rich text content. See https://tiptap.dev/guide/output#option-1-json
textDescription: string // string description without formatting, images, or embeds
}
type Bet = {

View File

@ -22,8 +22,6 @@ export type LiteMarket = {
// Market attributes. All times are in milliseconds since epoch
closeTime?: number
question: string
description: string | JSONContent
textDescription: string // string version of description
tags: string[]
url: string
outcomeType: string
@ -54,6 +52,8 @@ export type FullMarket = LiteMarket & {
bets: Bet[]
comments: Comment[]
answers?: ApiAnswer[]
description: string | JSONContent
textDescription: string // string version of description
}
export type ApiError = {
@ -81,7 +81,6 @@ export function toLiteMarket(contract: Contract): LiteMarket {
creatorAvatarUrl,
closeTime,
question,
description,
tags,
slug,
pool,
@ -118,11 +117,6 @@ export function toLiteMarket(contract: Contract): LiteMarket {
? Math.min(resolutionTime, closeTime)
: closeTime,
question,
description,
textDescription:
typeof description === 'string'
? description
: richTextToString(description),
tags,
url: `https://manifold.markets/${creatorUsername}/${slug}`,
pool,
@ -158,11 +152,18 @@ export function toFullMarket(
)
: undefined
const { description } = contract
return {
...liteMarket,
answers,
comments,
bets,
description,
textDescription:
typeof description === 'string'
? description
: richTextToString(description),
}
}