Merge pull request #18374 from overleaf/em-chat-resolved-thread-ids

Add resolved-thread-ids endpoint to chat

GitOrigin-RevId: 211dee88707f2d7fb1c0c8805a1f6ac28dca494d
This commit is contained in:
Eric Mc Sween
2024-05-27 10:22:15 +00:00
committed by Copybot
parent 5af6acde2b
commit 814b085b44
5 changed files with 70 additions and 3 deletions
@@ -109,3 +109,18 @@ export async function deleteAllThreadsInProject(projectId) {
project_id: new ObjectId(projectId.toString()),
})
}
export async function getResolvedThreadIds(projectId) {
const resolvedThreadIds = await db.rooms
.find(
{
project_id: new ObjectId(projectId),
thread_id: { $exists: true },
resolved: { $exists: true },
},
{ projection: { thread_id: 1 } }
)
.map(record => record.thread_id.toString())
.toArray()
return resolvedThreadIds
}