Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
added notification
Browse files Browse the repository at this point in the history
  • Loading branch information
larryboymi committed Oct 23, 2016
1 parent d9079a0 commit 2dff0f6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions services/shelters/clearReservation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const getById = require('./getById')
const putDoc = require('../clients/putDoc')
const db = 'shelters'
const sendEmail = require('./sendEmail')

const notify = require('../sms/notifyOfAvailability')
module.exports = ({ shelterId, clientName, checkedIn }) => {
console.log('user checked in? or was the reservation canceled?', checkedIn)
// todo email the person who made the reservation (found in shelterDoc.reservations2.requestor.email (and .name)
Expand All @@ -13,8 +13,9 @@ module.exports = ({ shelterId, clientName, checkedIn }) => {
if (existingReservation && existingReservation.requestor && existingReservation.requestor.email) {
sendEmail(existingReservation)
}
shelterDoc.reservations2 = shelterDoc.reservations2.filter((reservation) => reservation.clientName != clientName)
shelterDoc.reservations2 = shelterDoc.reservations2.filter((reservation) => reservation.clientName !== clientName)
return putDoc(db, shelterDoc)
.then((res) => notify(shelterId))
})
.then(() => getById(shelterId))
// todo free up the beds that were reserved
Expand Down

0 comments on commit 2dff0f6

Please sign in to comment.