full flow of zapping or pinning and unpinning cold full run

This commit is contained in:
talksik
2022-06-25 15:00:09 -05:00
parent 9bc2e186fd
commit cb92b9a932
7 changed files with 109 additions and 12 deletions
+14 -1
View File
@@ -1,4 +1,5 @@
import Conversation from '@nirvana/core/models/conversation.model';
import Conversation, { MemberState } from '@nirvana/core/models/conversation.model';
import { ObjectId } from 'mongodb';
import { collections } from './database.service';
@@ -65,4 +66,16 @@ export default class ConversationService {
return null;
}
static async updateUserConversationPriority(
conversationId: ObjectId,
memberId: ObjectId,
newState: MemberState,
) {
const query = { _id: conversationId, 'members._id': memberId };
return await collections.conversations?.findOneAndUpdate(query, {
$set: { 'members.$.memberState': newState },
});
}
}