Skip to content

Commit

Permalink
<PRS1> | fixes meeting deletion bug | <Murtaza>
Browse files Browse the repository at this point in the history
  • Loading branch information
Murtaza Personal authored and Murtaza Personal committed Jan 9, 2022
1 parent 5c51574 commit 781240d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
14 changes: 9 additions & 5 deletions Murtaza/meetings_app/services/meetingService.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,19 @@ const dropMeeting = async (userId, meetingIdToBeRemoved) => {

let meetingWithParticipantIds = await MeetingModel.findOne({ meetingId: meetingIdToBeRemoved }, { participants: 1 }).populate("participants");
let updatedParticipants = [];

for await (let participant of meetingWithParticipantIds.participants) {
for (let participant of meetingWithParticipantIds.participants) {
if (participant.id != userId)
updatedParticipants.push(participant);
}

meetingWithParticipantIds.participants = [];
meetingWithParticipantIds.participants.push(...updatedParticipants);
await meetingWithParticipantIds.save();
if (updatedParticipants.length == 0) {
await MeetingModel.findOneAndDelete({_id: meetingWithParticipantIds._id});
} else {
meetingWithParticipantIds.participants = [];
meetingWithParticipantIds.participants.push(...updatedParticipants);
await meetingWithParticipantIds.save();
}
console.log(meetingWithParticipantIds);
};

module.exports = {
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

A team utility app for scheduling meetings

Features:
- Registration
- Login
- Schedule a Meeting
- Edit a Meeting
- Drop off a user from a meeting

## Docker Deployment

Expand Down Expand Up @@ -97,5 +103,3 @@ Start the server
```
auth-token: ""
```


0 comments on commit 781240d

Please sign in to comment.