forked from microsoft/BotBuilder-Samples
-
Notifications
You must be signed in to change notification settings - Fork 6
/
store.js
26 lines (22 loc) · 1013 Bytes
/
store.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var Promise = require('bluebird');
module.exports = {
searchHotels: function (destination, checkInDate, checkOutDate) {
return new Promise(function (resolve) {
// Filling the hotels results manually just for demo purposes
var hotels = [];
for (var i = 1; i <= 5; i++) {
hotels.push({
name: destination + ' Hotel ' + i,
location: destination,
rating: Math.ceil(Math.random() * 5),
numberOfReviews: Math.floor(Math.random() * 5000) + 1,
priceStarting: Math.floor(Math.random() * 450) + 80,
image: 'https://placeholdit.imgix.net/~text?txtsize=35&txt=Hotel+' + i + '&w=500&h=260'
});
}
hotels.sort((a, b) => a.priceStarting - b.priceStarting);
// complete promise with a timer to simulate async response
setTimeout(() => resolve(hotels), 1000);
});
}
};