up0dating tldr very simple without a whole modal

This commit is contained in:
Arjun Patel
2022-02-06 17:24:14 -08:00
parent 383e5b4e37
commit 2282ec27cd
3 changed files with 125 additions and 4 deletions
+2
View File
@@ -19,6 +19,8 @@ export default class Conversation {
createdDate: Timestamp = Timestamp.now();
createdByUserId: string;
lastUpdatedBy?: string; // some sort of security data collection whenever updating convo
constructor(
_createdByUserId: string,
_name: string,
@@ -166,4 +166,20 @@ export default class ConversationService {
);
});
}
async updateTldr(convoId: string, newTldr: string, updateUserId: string) {
// todo make sure that this user is allowed to update it
const docRef = doc(this.db, Collections.conversations, convoId);
await setDoc(
docRef,
{
tldr: newTldr,
lastActivityDate: serverTimestamp(),
lastUpdatedBy: updateUserId,
},
{ merge: true }
);
return false;
}
}