Skip to content

Commit

Permalink
Update stripeController.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Jun 11, 2024
1 parent 0a3b70a commit 2b41c15
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/src/controllers/stripeController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as env from '../config/env.config'
import * as helper from '../common/helper'
import Booking from '../models/Booking'
import User from '../models/User'
import Property from '../models/Property'
import * as bookingController from './bookingController'

/**
Expand Down Expand Up @@ -130,6 +131,9 @@ export const checkCheckoutSession = async (req: Request, res: Response) => {
booking.status = movininTypes.BookingStatus.Paid
await booking.save()

// Mark property as unavailable
await Property.updateOne({ _id: booking.property }, { available: false })

// Send confirmation email
const user = await User.findById(booking.renter)
if (!user) {
Expand Down

0 comments on commit 2b41c15

Please sign in to comment.