MCPcopy Create free account
hub / github.com/dev-mastery/comments-api / findReplies

Function findReplies

src/data-access/comments-db.js:45–55  ·  view source on GitHub ↗
({ commentId, publishedOnly = true })

Source from the content-addressed store, hash-verified

43 }))
44 }
45 async function findReplies ({ commentId, publishedOnly = true }) {
46 const db = await makeDb()
47 const query = publishedOnly
48 ? { published: true, replyToId: commentId }
49 : { replyToId: commentId }
50 const result = await db.collection('comments').find(query)
51 return (await result.toArray()).map(({ _id: id, ...found }) => ({
52 id,
53 ...found
54 }))
55 }
56 async function insert ({ id: _id = Id.makeId(), ...commentInfo }) {
57 const db = await makeDb()
58 const result = await db

Callers

nothing calls this directly

Calls 1

makeDbFunction · 0.70

Tested by

no test coverage detected