update modal cleaner now and see the data and all

This commit is contained in:
Arjun Patel
2022-01-17 17:11:34 -08:00
parent 5c931211b2
commit 37747b6ac0
5 changed files with 38 additions and 9 deletions
+11 -5
View File
@@ -13,11 +13,17 @@ import { Collections } from "./collections";
export default class RoomService {
private db: Firestore = getFirestore();
async createRoom(room: Room) {
const roomDocRef = await addDoc(collection(this.db, Collections.rooms), {
...room,
createdDate: serverTimestamp(),
});
async createOrUpdateRoom(room: Room) {
if (room.id) {
//update
await this.updateRoom(room);
} else {
//create
const roomDocRef = await addDoc(collection(this.db, Collections.rooms), {
...room,
createdDate: serverTimestamp(),
});
}
}
async updateMembersInRoom(roomId: string, newMembersInRoom: string[]) {