(content)
| 36 | } |
| 37 | |
| 38 | function normalizePostContent(content) { |
| 39 | if (!content) { |
| 40 | return content; |
| 41 | } |
| 42 | return { |
| 43 | ...content, |
| 44 | id: content.id?.toString(), |
| 45 | parentId: (content.parentId ?? content.parent_id)?.toString(), |
| 46 | tags: normalizeTags(content.tags), |
| 47 | like_count: content.like_count ?? 0, |
| 48 | liked: Boolean(content.liked), |
| 49 | is_deleted: Boolean(content.is_deleted), |
| 50 | }; |
| 51 | } |
| 52 | |
| 53 | export async function getPosts(query = {}) { |
| 54 | const postsResult = await apiJson(LIST_POSTS_API); |
no test coverage detected