Merge pull request #6996 from overleaf/tm-expired-project-chat
Add endpoints to chat for deleting expired project chat data GitOrigin-RevId: e4eb7c7a79472bb116b2095a76c870e204590288
This commit is contained in:
@@ -54,6 +54,20 @@ async function findAllThreadRooms(projectId) {
|
||||
.toArray()
|
||||
}
|
||||
|
||||
async function findAllThreadRoomsAndGlobalThread(projectId) {
|
||||
return db.rooms
|
||||
.find(
|
||||
{
|
||||
project_id: ObjectId(projectId.toString()),
|
||||
},
|
||||
{
|
||||
thread_id: 1,
|
||||
resolved: 1,
|
||||
}
|
||||
)
|
||||
.toArray()
|
||||
}
|
||||
|
||||
async function resolveThread(projectId, threadId, userId) {
|
||||
await db.rooms.updateOne(
|
||||
{
|
||||
@@ -93,13 +107,21 @@ async function deleteThread(projectId, threadId) {
|
||||
return room._id
|
||||
}
|
||||
|
||||
async function deleteAllThreadsInProject(projectId) {
|
||||
await db.rooms.deleteMany({
|
||||
project_id: ObjectId(projectId.toString()),
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = ThreadManager = {
|
||||
GLOBAL_THREAD,
|
||||
findOrCreateThread,
|
||||
findAllThreadRooms,
|
||||
findAllThreadRoomsAndGlobalThread,
|
||||
resolveThread,
|
||||
reopenThread,
|
||||
deleteThread,
|
||||
deleteAllThreadsInProject,
|
||||
}
|
||||
;[
|
||||
'findOrCreateThread',
|
||||
|
||||
Reference in New Issue
Block a user