[dsmp] Add endpoint to retrieve a single message from chat (#28242)

* [dsmp] Add endpoint to retrieve a single message from chat

* use user:null in case is deleted

GitOrigin-RevId: f42360c2e05cfe93fa11230ac3cc311bdb044c1d
This commit is contained in:
Domagoj Kriskovic
2025-09-05 08:06:15 +00:00
committed by Copybot
parent 1fe9277b5b
commit ff0e725935
6 changed files with 94 additions and 2 deletions
@@ -148,9 +148,14 @@ export async function duplicateThread(projectId, threadId) {
}
export async function findThread(projectId, threadId) {
projectId = new ObjectId(projectId.toString())
if (threadId !== GLOBAL_THREAD) {
threadId = new ObjectId(threadId.toString())
}
const room = await db.rooms.findOne({
project_id: new ObjectId(projectId),
thread_id: new ObjectId(threadId),
project_id: projectId,
thread_id: threadId === GLOBAL_THREAD ? { $exists: false } : threadId,
})
if (!room) {
throw new MissingThreadError('Thread not found')