From b476a7e3f82ef0d248c3e480ea77aee5e0c00025 Mon Sep 17 00:00:00 2001 From: Sinclair Chen Date: Mon, 22 Aug 2022 18:18:51 -0700 Subject: [PATCH] Take descriptions out of LiteMarket (#789) --- docs/docs/api.md | 5 ++--- web/pages/api/v0/_types.ts | 17 +++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/docs/api.md b/docs/docs/api.md index 7b0058c2..c02a5141 100644 --- a/docs/docs/api.md +++ b/docs/docs/api.md @@ -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 = { diff --git a/web/pages/api/v0/_types.ts b/web/pages/api/v0/_types.ts index f0d9c443..968b770e 100644 --- a/web/pages/api/v0/_types.ts +++ b/web/pages/api/v0/_types.ts @@ -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), } }