added motion detection
This commit is contained in:
parent
f1426431e2
commit
74658eb4c8
8322
notes/route.json
Normal file
8322
notes/route.json
Normal file
File diff suppressed because it is too large
Load Diff
22
package-lock.json
generated
22
package-lock.json
generated
@ -6286,6 +6286,23 @@
|
||||
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
|
||||
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
|
||||
},
|
||||
"jsonfile": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-5.0.0.tgz",
|
||||
"integrity": "sha512-NQRZ5CRo74MhMMC3/3r5g2k4fjodJ/wh8MxjFbCViWKFjxrnudWSY5vomh+23ZaXzAS7J3fBZIR2dV6WbmfM0w==",
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.6",
|
||||
"universalify": "^0.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"graceful-fs": {
|
||||
"version": "4.1.15",
|
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
|
||||
"integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==",
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"jsonify": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
|
||||
@ -11569,6 +11586,11 @@
|
||||
"integrity": "sha1-1ZpKdUJ0R9mqbJHnAmP40mpLEEs=",
|
||||
"dev": true
|
||||
},
|
||||
"universalify": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
||||
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="
|
||||
},
|
||||
"unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
|
@ -33,6 +33,7 @@
|
||||
"hh-mm-ss": "^1.2.0",
|
||||
"humanize-duration": "^3.13.0",
|
||||
"jquery": "^3.3.1",
|
||||
"jsonfile": "^5.0.0",
|
||||
"leaflet": "^1.3.1",
|
||||
"lodash": "^4.17.5",
|
||||
"log4js": "^2.5.3",
|
||||
|
@ -159,6 +159,7 @@ app.get('/nearbydetail', cache('15 minutes'), (req, res) => {
|
||||
rightbyme.doGetMoreDetail(req.query.id)
|
||||
.then((d) => {
|
||||
res.set('Cache-Control', 'public, max-age=900');
|
||||
logger.debug('nearbydetail', d);
|
||||
res.send(d);
|
||||
}).catch((e) => {
|
||||
logger.error(e);
|
||||
|
@ -7,7 +7,7 @@ const client = yelp.client('YlF_b6D149xr_xnrrYudlSnpn1A53b67vALlIK2HnD0ymBXQocRv
|
||||
|
||||
const { get, isEmpty, has } = require('lodash');
|
||||
|
||||
const { reduceExplore, reduceYelp, reduceFullFS, reduceTwitter } = require('./reducers/rightbyme');
|
||||
const { reduceExplore, reduceYelp, reduceFullFS, reduceTwitter, reducePhotos } = require('./reducers/rightbyme');
|
||||
|
||||
const twitterClient = new Twitter({
|
||||
'consumer_key': 'bJvwgjA9O52j7rC6mqoeefPLO',
|
||||
@ -156,6 +156,40 @@ function doFSGetFullVenue(data = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
function doFSGetPhotos(data = {}) {
|
||||
const payLoad = Object.assign({}, data);
|
||||
logger.debug('>> doFSGetPhotos');
|
||||
|
||||
// https://api.foursquare.com/v2/venues/4c5ff51213791b8d0d5c4eaf?client_id=IXXFUGW3NC3DEVS2V5EU4NV4CL5E12AYGUPIR2D3U3B5DX4B&client_secret=MZRIJDCEKUMVERA1OKVAIZI0TYAEBD3W2A2AGPTPI5TOLL1D&v=20180224
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!isEmpty(payLoad)) {
|
||||
// stuff
|
||||
// more
|
||||
const id = payLoad.id;
|
||||
foursquare.venues.photos(id, { 'limit':16 }, function(err, fsData) {
|
||||
if (err)
|
||||
return reject(err);
|
||||
else {
|
||||
// console.log(JSON.stringify(fsData));
|
||||
logger.debug('fsData', JSON.stringify(fsData));
|
||||
const initPayload = (has(payLoad, 'name')) ? {} : reduceExplore(get(fsData, 'response.venue'));
|
||||
const partPayload = reducePhotos(fsData);
|
||||
const newPayload = Object.assign(payLoad, initPayload, partPayload);
|
||||
|
||||
// payLoad.images = partPayload;
|
||||
|
||||
logger.debug('GetPhotos', partPayload);
|
||||
|
||||
return resolve(newPayload);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
return resolve(payLoad);
|
||||
});
|
||||
}
|
||||
|
||||
function doTweetSearch(data = {}) {
|
||||
const payLoad = Object.assign({}, data);
|
||||
logger.debug('>> doTweetSearch');
|
||||
@ -256,6 +290,10 @@ function doGetMoreDetail(id) {
|
||||
// return doYelpSearch(d)
|
||||
return doTweetSearch(d);
|
||||
})
|
||||
.then((d) => {
|
||||
// return doYelpSearch(d)
|
||||
return doFSGetPhotos(d);
|
||||
})
|
||||
.catch((e) => {
|
||||
logger.error(e);
|
||||
|
||||
|
@ -78,6 +78,63 @@ function reduceFullFS(data) {
|
||||
const photosCount = (typeof(photoItems) !== 'undefined' && photoItems !== null) ? photoItems.length : 0;
|
||||
const tipsCount = get(localObj, 'tips.count', 0);
|
||||
|
||||
/* if (photosCount > 0)
|
||||
|
||||
obj.images = photoItems.map(item => {
|
||||
const prefix = get(item, 'prefix', '');
|
||||
const suffix = get(item, 'suffix', '');
|
||||
const width = get(item, 'width', 640);
|
||||
const height = get(item, 'height', 480);
|
||||
|
||||
const ratio = width / 640;
|
||||
let ratioHeight = ~~(height / ratio);
|
||||
if (ratioHeight <= 0) ratioHeight = 640;
|
||||
console.log(`${width}, ${height} => ${640}, ${ratioHeight}`);
|
||||
|
||||
return `${prefix}${640}x${ratioHeight}${suffix}`;
|
||||
});*/
|
||||
|
||||
if (tipsCount > 0) {
|
||||
const tipItems = get(localObj, 'tips.groups[0].items');
|
||||
obj.tips = tipItems.map(item => {
|
||||
return get(item, 'text', '');
|
||||
});
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function reduceTwitter(data) {
|
||||
const urlReg = /(http|ftp|https):\/\/([\w+?\.\w+])+([a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?/;
|
||||
let obj = [];
|
||||
if (data.length > 0)
|
||||
obj = data.map(item => {
|
||||
let text = get(item, 'text');
|
||||
const urlTest = urlReg.exec(text);
|
||||
|
||||
if (urlTest !== null) {
|
||||
const newUrl = `<a hef='${urlTest[0]}'>${urlTest[0]}</a>`;
|
||||
console.log(newUrl);
|
||||
text = text.replace(urlTest[0], newUrl);
|
||||
}
|
||||
|
||||
return text;
|
||||
});
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function reducePhotos(data) {
|
||||
const obj = {};
|
||||
if (typeof data === 'undefined' || isEmpty(data)) return obj;
|
||||
const localObj = Object.assign({}, data);
|
||||
const photoBlob = get(localObj, 'response.photos');
|
||||
let photoItems;
|
||||
|
||||
photoItems = photoBlob.items;
|
||||
|
||||
const photosCount = (typeof(photoItems) !== 'undefined' && photoItems !== null) ? photoItems.length : 0;
|
||||
|
||||
if (photosCount > 0)
|
||||
|
||||
obj.images = photoItems.map(item => {
|
||||
@ -94,24 +151,7 @@ function reduceFullFS(data) {
|
||||
return `${prefix}${640}x${ratioHeight}${suffix}`;
|
||||
});
|
||||
|
||||
if (tipsCount > 0) {
|
||||
const tipItems = get(localObj, 'tips.groups[0].items');
|
||||
obj.tips = tipItems.map(item => {
|
||||
return get(item, 'text', '');
|
||||
});
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function reduceTwitter(data) {
|
||||
let obj = [];
|
||||
if (data.length > 0)
|
||||
obj = data.map(item => {
|
||||
return get(item, 'text');
|
||||
});
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
module.exports = { reduceExplore, reduceYelp, reduceFullFS, reduceTwitter };
|
||||
module.exports = { reduceExplore, reduceYelp, reduceFullFS, reduceTwitter, reducePhotos };
|
||||
|
@ -11,7 +11,7 @@
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
const CACHE_VERSION = { 'version': '0.0.986' };
|
||||
const CACHE_VERSION = { 'version': '0.0.990' };
|
||||
const PRECACHE = `jubileeData-${CACHE_VERSION.version}`;
|
||||
const RUNTIME = 'runtime';
|
||||
|
||||
|
16
src/v1/js/libs/dummyLocation.js
Normal file
16
src/v1/js/libs/dummyLocation.js
Normal file
@ -0,0 +1,16 @@
|
||||
const EventEmitter = require('events');
|
||||
const jsonfile = require('jsonfile');
|
||||
|
||||
class DummyLocation extends EventEmitter {
|
||||
|
||||
constructor(options = {}) {
|
||||
this.options = Object.assign({}, options);
|
||||
|
||||
console.log('options', this.options);
|
||||
|
||||
if (typeof this.options.file !== 'undefined' && this.options.file !== null)
|
||||
this.file = jsonfile.reaFileSync(this.options.file);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DummyLocation;
|
492
test/data/photos/photo001.json
Normal file
492
test/data/photos/photo001.json
Normal file
@ -0,0 +1,492 @@
|
||||
{
|
||||
"meta": {
|
||||
"code": 200,
|
||||
"requestId": "5be4299cdb04f50b42b394c5"
|
||||
},
|
||||
"notifications": [
|
||||
{
|
||||
"type": "notificationTray",
|
||||
"item": {
|
||||
"unreadCount": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"response": {
|
||||
"photos": {
|
||||
"count": 12,
|
||||
"items": [
|
||||
{
|
||||
"id": "5bbd123a38f216002562c5ee",
|
||||
"createdAt": 1539117626,
|
||||
"source": {
|
||||
"name": "Swarm for iOS",
|
||||
"url": "https:\/\/www.swarmapp.com"
|
||||
},
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/general\/",
|
||||
"suffix": "\/1948074_vPwEHeg5do6Ee-er4kuZyduHV-vd-Q6J-65vn_ku3LQ.jpg",
|
||||
"width": 1440,
|
||||
"height": 1920,
|
||||
"user": {
|
||||
"id": "1948074",
|
||||
"firstName": "Melissa",
|
||||
"lastName": "Augustine",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/KOLGARLUQIV5CZBT.jpg"
|
||||
}
|
||||
},
|
||||
"checkin": {
|
||||
"id": "5bbd12350868a200393f7862",
|
||||
"createdAt": 1539117621,
|
||||
"type": "checkin",
|
||||
"timeZoneOffset": 60
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "5b898849b72a660025254016",
|
||||
"createdAt": 1535739977,
|
||||
"source": {
|
||||
"name": "Swarm for Android",
|
||||
"url": "https:\/\/www.swarmapp.com"
|
||||
},
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/general\/",
|
||||
"suffix": "\/436240_lf_O0Vb0OIow6QEsgzBO3I9duEs38jPXQJvv9RD9y9Q.jpg",
|
||||
"width": 1425,
|
||||
"height": 1900,
|
||||
"user": {
|
||||
"id": "436240",
|
||||
"firstName": "Julia",
|
||||
"lastName": "Sandler",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/2XVEZTSR1U30QYX4.jpg"
|
||||
}
|
||||
},
|
||||
"checkin": {
|
||||
"id": "5b89718b029a55002c4ee859",
|
||||
"createdAt": 1535734155,
|
||||
"type": "checkin",
|
||||
"timeZoneOffset": 60,
|
||||
"with": [
|
||||
{
|
||||
"id": "146873429",
|
||||
"firstName": "Martin",
|
||||
"lastName": "Sandler",
|
||||
"gender": "male",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/146873429-XCTWJCWDDGOOI24B.jpg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "9567008",
|
||||
"firstName": "Dee",
|
||||
"lastName": "Sandler",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/9567008-JFKYBIQVFQEX4430.jpg"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "5b8987f4f62e0900398f4474",
|
||||
"createdAt": 1535739892,
|
||||
"source": {
|
||||
"name": "Swarm for Android",
|
||||
"url": "https:\/\/www.swarmapp.com"
|
||||
},
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/general\/",
|
||||
"suffix": "\/436240_Y5RkVVP5n24lq4ecN8ugzRgxHAQKvOlmoSJylrbn6Ps.jpg",
|
||||
"width": 1425,
|
||||
"height": 1900,
|
||||
"user": {
|
||||
"id": "436240",
|
||||
"firstName": "Julia",
|
||||
"lastName": "Sandler",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/2XVEZTSR1U30QYX4.jpg"
|
||||
}
|
||||
},
|
||||
"checkin": {
|
||||
"id": "5b89718b029a55002c4ee859",
|
||||
"createdAt": 1535734155,
|
||||
"type": "checkin",
|
||||
"timeZoneOffset": 60,
|
||||
"with": [
|
||||
{
|
||||
"id": "146873429",
|
||||
"firstName": "Martin",
|
||||
"lastName": "Sandler",
|
||||
"gender": "male",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/146873429-XCTWJCWDDGOOI24B.jpg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "9567008",
|
||||
"firstName": "Dee",
|
||||
"lastName": "Sandler",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/9567008-JFKYBIQVFQEX4430.jpg"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "5b8987b42f97ec002cd07566",
|
||||
"createdAt": 1535739828,
|
||||
"source": {
|
||||
"name": "Swarm for Android",
|
||||
"url": "https:\/\/www.swarmapp.com"
|
||||
},
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/general\/",
|
||||
"suffix": "\/436240_ssnIV5giiAVgdAzC-wLu3eO7uO-aUQ2Cwxn4XYFyGXg.jpg",
|
||||
"width": 1425,
|
||||
"height": 1900,
|
||||
"user": {
|
||||
"id": "436240",
|
||||
"firstName": "Julia",
|
||||
"lastName": "Sandler",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/2XVEZTSR1U30QYX4.jpg"
|
||||
}
|
||||
},
|
||||
"checkin": {
|
||||
"id": "5b89718b029a55002c4ee859",
|
||||
"createdAt": 1535734155,
|
||||
"type": "checkin",
|
||||
"timeZoneOffset": 60,
|
||||
"with": [
|
||||
{
|
||||
"id": "146873429",
|
||||
"firstName": "Martin",
|
||||
"lastName": "Sandler",
|
||||
"gender": "male",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/146873429-XCTWJCWDDGOOI24B.jpg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "9567008",
|
||||
"firstName": "Dee",
|
||||
"lastName": "Sandler",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/9567008-JFKYBIQVFQEX4430.jpg"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "5b8987b1f00a70002c124762",
|
||||
"createdAt": 1535739825,
|
||||
"source": {
|
||||
"name": "Swarm for Android",
|
||||
"url": "https:\/\/www.swarmapp.com"
|
||||
},
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/general\/",
|
||||
"suffix": "\/436240_urUZKDPWGff2wrbkkA0nnDAwMa9lRoKXpnF9MOUfhWg.jpg",
|
||||
"width": 1425,
|
||||
"height": 1900,
|
||||
"user": {
|
||||
"id": "436240",
|
||||
"firstName": "Julia",
|
||||
"lastName": "Sandler",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/2XVEZTSR1U30QYX4.jpg"
|
||||
}
|
||||
},
|
||||
"checkin": {
|
||||
"id": "5b89718b029a55002c4ee859",
|
||||
"createdAt": 1535734155,
|
||||
"type": "checkin",
|
||||
"timeZoneOffset": 60,
|
||||
"with": [
|
||||
{
|
||||
"id": "146873429",
|
||||
"firstName": "Martin",
|
||||
"lastName": "Sandler",
|
||||
"gender": "male",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/146873429-XCTWJCWDDGOOI24B.jpg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "9567008",
|
||||
"firstName": "Dee",
|
||||
"lastName": "Sandler",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/9567008-JFKYBIQVFQEX4430.jpg"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "5b68c52835d3fc002c16f7f6",
|
||||
"createdAt": 1533592872,
|
||||
"source": {
|
||||
"name": "Foursquare for iOS",
|
||||
"url": "https:\/\/foursquare.com\/download\/#\/iphone"
|
||||
},
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/general\/",
|
||||
"suffix": "\/51219901_GqEDfQTgqsYk1MM2L8BrJaw2ie7XG6slHO7VksIkyAs.jpg",
|
||||
"width": 1440,
|
||||
"height": 1920,
|
||||
"user": {
|
||||
"id": "51219901",
|
||||
"firstName": "Carlos",
|
||||
"lastName": "Parra",
|
||||
"gender": "male",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/14AXOE0O0CEKGXXT.jpg"
|
||||
}
|
||||
},
|
||||
"tip": {
|
||||
"id": "5b68c5266fd626002d07ef7e",
|
||||
"createdAt": 1533592870,
|
||||
"text": "Not that good except for the plantain with queso fresco",
|
||||
"type": "user",
|
||||
"canonicalUrl": "https:\/\/foursquare.com\/item\/5b68c5266fd626002d07ef7e",
|
||||
"likes": {
|
||||
"count": 0,
|
||||
"groups": []
|
||||
},
|
||||
"like": false,
|
||||
"logView": true,
|
||||
"agreeCount": 0,
|
||||
"disagreeCount": 0,
|
||||
"todo": {
|
||||
"count": 0
|
||||
}
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "5b184c9f53159300393f0e1d",
|
||||
"createdAt": 1528319135,
|
||||
"source": {
|
||||
"name": "Swarm for iOS",
|
||||
"url": "https:\/\/www.swarmapp.com"
|
||||
},
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/general\/",
|
||||
"suffix": "\/38350236_XF4cfY2mnz6EheplrEtL1Y-SCyI0aoCe-uRzIabo-dY.jpg",
|
||||
"width": 1440,
|
||||
"height": 1920,
|
||||
"user": {
|
||||
"id": "38350236",
|
||||
"firstName": "Anastasia",
|
||||
"lastName": "Romanova",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/38350236_rVPWalqK_OS0Xk7Oe8yrjSnSCIiSoGIN2KiBlyh_9vOlllAgpAEL2R2NLoWZejcGUfWC0zwIH.jpg"
|
||||
}
|
||||
},
|
||||
"checkin": {
|
||||
"id": "5b184c9bc4404e001c0b0007",
|
||||
"createdAt": 1528319131,
|
||||
"type": "checkin",
|
||||
"timeZoneOffset": 60
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "5b007ceb67e5f2002cd2622b",
|
||||
"createdAt": 1526758635,
|
||||
"source": {
|
||||
"name": "Swarm for iOS",
|
||||
"url": "https:\/\/www.swarmapp.com"
|
||||
},
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/general\/",
|
||||
"suffix": "\/21628811_olqZV44Reqhog_IGDKmYK6oAhHU0PmwctViuGPN8ZQg.jpg",
|
||||
"width": 1440,
|
||||
"height": 1920,
|
||||
"user": {
|
||||
"id": "21628811",
|
||||
"firstName": "Sophia",
|
||||
"lastName": "V",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/21628811-QIRARK355AGYY10U.jpg"
|
||||
}
|
||||
},
|
||||
"checkin": {
|
||||
"id": "5b007cdc5c6838002d27dac5",
|
||||
"createdAt": 1526758620,
|
||||
"type": "checkin",
|
||||
"timeZoneOffset": 60,
|
||||
"with": [
|
||||
{
|
||||
"id": "146112235",
|
||||
"firstName": "Nicos",
|
||||
"lastName": "Savva",
|
||||
"gender": "male",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/146112235-4DL42UNW5GSJMFLW.jpg"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "5a91ef748fb09e386ec677f3",
|
||||
"createdAt": 1519513460,
|
||||
"source": {
|
||||
"name": "Foursquare for iOS",
|
||||
"url": "https:\/\/foursquare.com\/download\/#\/iphone"
|
||||
},
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/general\/",
|
||||
"suffix": "\/148002631_UPWDGBODb9O-HLFVAybu2lfzTCkUGablGj1RmFMSSCo.jpg",
|
||||
"width": 1440,
|
||||
"height": 1920,
|
||||
"user": {
|
||||
"id": "148002631",
|
||||
"firstName": "Miso",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/148002631_wYBesBrT_kXGtyu8p7snO84kyZ5NmHq-pk2GklIOovDbzWCWboqq4NuALSKwoxeU_wTsQisND.jpg"
|
||||
}
|
||||
},
|
||||
"tip": {
|
||||
"id": "5a7f8118f1fdaf5e43c6f1d5",
|
||||
"createdAt": 1518305560,
|
||||
"text": "You barely notice the grasshoppers, especially with crunchy tortillas...not sure what it adds other than curiosity!",
|
||||
"type": "user",
|
||||
"canonicalUrl": "https:\/\/foursquare.com\/item\/5a7f8118f1fdaf5e43c6f1d5",
|
||||
"likes": {
|
||||
"count": 0,
|
||||
"groups": []
|
||||
},
|
||||
"like": false,
|
||||
"logView": true,
|
||||
"agreeCount": 0,
|
||||
"disagreeCount": 0,
|
||||
"todo": {
|
||||
"count": 0
|
||||
}
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "5a91d5b10f013c06c58324bb",
|
||||
"createdAt": 1519506865,
|
||||
"source": {
|
||||
"name": "Foursquare for iOS",
|
||||
"url": "https:\/\/foursquare.com\/download\/#\/iphone"
|
||||
},
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/general\/",
|
||||
"suffix": "\/148002631_Ck3lC-u3xNtb5uh3ObDk-_Zpkauh6EGGFZ-eD6x6Q9k.jpg",
|
||||
"width": 1920,
|
||||
"height": 1440,
|
||||
"user": {
|
||||
"id": "148002631",
|
||||
"firstName": "Miso",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/148002631_wYBesBrT_kXGtyu8p7snO84kyZ5NmHq-pk2GklIOovDbzWCWboqq4NuALSKwoxeU_wTsQisND.jpg"
|
||||
}
|
||||
},
|
||||
"tip": {
|
||||
"id": "5a91d59ff4b52533fc2a7aeb",
|
||||
"createdAt": 1519506847,
|
||||
"text": "My favourite Mexican place in London. Cheerful, cosy place. Really well done classic dishe, great flavour, great vegetarian options too.",
|
||||
"type": "user",
|
||||
"canonicalUrl": "https:\/\/foursquare.com\/item\/5a91d59ff4b52533fc2a7aeb",
|
||||
"likes": {
|
||||
"count": 0,
|
||||
"groups": []
|
||||
},
|
||||
"like": false,
|
||||
"logView": true,
|
||||
"agreeCount": 1,
|
||||
"disagreeCount": 0,
|
||||
"lastVoteText": "Upvoted Sep 22",
|
||||
"lastUpvoteTimestamp": 1537619761,
|
||||
"todo": {
|
||||
"count": 0
|
||||
}
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "5a7f80ac1fa7634a4c2c24ec",
|
||||
"createdAt": 1518305452,
|
||||
"source": {
|
||||
"name": "Foursquare for iOS",
|
||||
"url": "https:\/\/foursquare.com\/download\/#\/iphone"
|
||||
},
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/general\/",
|
||||
"suffix": "\/148002631_h3I_rCAEk5-F-L_iXFTgnKK36wCWsPzXPCgGuLI6Qlo.jpg",
|
||||
"width": 1920,
|
||||
"height": 1440,
|
||||
"user": {
|
||||
"id": "148002631",
|
||||
"firstName": "Miso",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/148002631_wYBesBrT_kXGtyu8p7snO84kyZ5NmHq-pk2GklIOovDbzWCWboqq4NuALSKwoxeU_wTsQisND.jpg"
|
||||
}
|
||||
},
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"id": "5a7f80a21953f35cd34e394a",
|
||||
"createdAt": 1518305442,
|
||||
"source": {
|
||||
"name": "Foursquare for iOS",
|
||||
"url": "https:\/\/foursquare.com\/download\/#\/iphone"
|
||||
},
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/general\/",
|
||||
"suffix": "\/148002631_RN-bs3l4WpIlAHKe7imqalCRG2gWupWrGOerFQn9nTk.jpg",
|
||||
"width": 1440,
|
||||
"height": 1920,
|
||||
"user": {
|
||||
"id": "148002631",
|
||||
"firstName": "Miso",
|
||||
"gender": "female",
|
||||
"photo": {
|
||||
"prefix": "https:\/\/fastly.4sqi.net\/img\/user\/",
|
||||
"suffix": "\/148002631_wYBesBrT_kXGtyu8p7snO84kyZ5NmHq-pk2GklIOovDbzWCWboqq4NuALSKwoxeU_wTsQisND.jpg"
|
||||
}
|
||||
},
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"dupesRemoved": 0
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
|
||||
const { reduceExplore, reduceYelp, reduceFullFS } = require('../server/reducers/rightbyme');
|
||||
const { reduceExplore, reduceYelp, reduceFullFS, reducePhotos } = require('../server/reducers/rightbyme');
|
||||
|
||||
const expect = require('expect.js');
|
||||
const jsonfile = require('jsonfile');
|
||||
|
||||
const exploreFS = {
|
||||
'id': '4c233b549a67a5937ea7dd87',
|
||||
@ -533,6 +534,21 @@ const goodFS = {
|
||||
'tips': ['Bring your O2 or Vodafone phone so you can actually get a signal to check in!', 'a good exscuse for a check in!']
|
||||
};
|
||||
|
||||
const photos = jsonfile.readFileSync('test/data/photos/photo001.json');
|
||||
const photosResult = { 'images':
|
||||
[ 'https://fastly.4sqi.net/img/general/640x853/1948074_vPwEHeg5do6Ee-er4kuZyduHV-vd-Q6J-65vn_ku3LQ.jpg',
|
||||
'https://fastly.4sqi.net/img/general/640x853/436240_lf_O0Vb0OIow6QEsgzBO3I9duEs38jPXQJvv9RD9y9Q.jpg',
|
||||
'https://fastly.4sqi.net/img/general/640x853/436240_Y5RkVVP5n24lq4ecN8ugzRgxHAQKvOlmoSJylrbn6Ps.jpg',
|
||||
'https://fastly.4sqi.net/img/general/640x853/436240_ssnIV5giiAVgdAzC-wLu3eO7uO-aUQ2Cwxn4XYFyGXg.jpg',
|
||||
'https://fastly.4sqi.net/img/general/640x853/436240_urUZKDPWGff2wrbkkA0nnDAwMa9lRoKXpnF9MOUfhWg.jpg',
|
||||
'https://fastly.4sqi.net/img/general/640x853/51219901_GqEDfQTgqsYk1MM2L8BrJaw2ie7XG6slHO7VksIkyAs.jpg',
|
||||
'https://fastly.4sqi.net/img/general/640x853/38350236_XF4cfY2mnz6EheplrEtL1Y-SCyI0aoCe-uRzIabo-dY.jpg',
|
||||
'https://fastly.4sqi.net/img/general/640x853/21628811_olqZV44Reqhog_IGDKmYK6oAhHU0PmwctViuGPN8ZQg.jpg',
|
||||
'https://fastly.4sqi.net/img/general/640x853/148002631_UPWDGBODb9O-HLFVAybu2lfzTCkUGablGj1RmFMSSCo.jpg',
|
||||
'https://fastly.4sqi.net/img/general/640x480/148002631_Ck3lC-u3xNtb5uh3ObDk-_Zpkauh6EGGFZ-eD6x6Q9k.jpg',
|
||||
'https://fastly.4sqi.net/img/general/640x480/148002631_h3I_rCAEk5-F-L_iXFTgnKK36wCWsPzXPCgGuLI6Qlo.jpg',
|
||||
'https://fastly.4sqi.net/img/general/640x853/148002631_RN-bs3l4WpIlAHKe7imqalCRG2gWupWrGOerFQn9nTk.jpg' ] };
|
||||
|
||||
describe('Right By Me', () => {
|
||||
describe('Explore', () => {
|
||||
it('should gracefully handle no data', done => {
|
||||
@ -580,6 +596,14 @@ describe('Right By Me', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Convert photos', () => {
|
||||
it('should process data correctly', done => {
|
||||
expect(reducePhotos(photos)).to.eql(photosResult);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Merging', () => {
|
||||
it('should gracefully handle no data', done => {
|
||||
const m = Object.assign(reduceExplore(), reduceFullFS());
|
||||
|
15372
tools/convert.js
15372
tools/convert.js
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user