Created
November 14, 2017 16:01
-
-
Save ramneekhanda/b6be609b709de720bb5564896084c6d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
//var https = require("https"); | |
var needle = require("needle"); | |
let drinkSchema = { | |
className: "Drinks", | |
fields: { | |
drinkType: { | |
type: "String" | |
}, | |
drinkName: { | |
type: "String" | |
}, | |
drinkImage: { | |
type: "String" | |
}, | |
barName: { | |
type: "String" | |
}, | |
barId: { | |
type: "String" | |
}, | |
bottlePrice: { | |
type: "String" | |
}, | |
singlePrice: { | |
type: "String" | |
}, | |
doublePrice: { | |
type: "String" | |
}, | |
halfPintPrice: { | |
type: "String" | |
}, | |
pintPrice: { | |
type: "String" | |
}, | |
happyHourPrice: { | |
type: "String" | |
}, | |
boozkDiscount: { | |
type: "String" | |
}, | |
happyHourDiscount: { | |
type: "String" | |
}, | |
isPriceIncludedGST: { | |
type: "Boolean" | |
} | |
} | |
}; | |
let placesSchema = { | |
className: "Places", | |
fields: { | |
name: { | |
type: "String" | |
}, | |
description: { | |
type: "String" | |
}, | |
number: { | |
type: "String" | |
}, | |
country: { | |
type: "String" | |
}, | |
website: { | |
type: "String" | |
}, | |
address: { | |
type: "String" | |
}, | |
phone: { | |
type: "String" | |
}, | |
location: { | |
type: "GeoPoint" | |
}, | |
boozkMultiplier: { | |
type: "Number" | |
}, | |
dateOnboarded: { | |
type: "Date" | |
}, | |
bankName: { | |
type: "String" | |
}, | |
bankBranch: { | |
type: "String" | |
}, | |
bankSwiftCode: { | |
type: "String" | |
}, | |
bankAccountHolder: { | |
type: "String" | |
}, | |
bankAccountNo: { | |
type: "String" | |
}, | |
companyRegistrationNo: { | |
type: "String" | |
}, | |
companyGSTNo: { | |
type: "String" | |
}, | |
companySvcTaxNo: { | |
type: "String" | |
}, | |
sunMorOpen: { | |
type: "String" | |
}, | |
sunMorClose: { | |
type: "String" | |
}, | |
sunEveOpen: { | |
type: "String" | |
}, | |
sunEveClose: { | |
type: "String" | |
}, | |
monMorOpen: { | |
type: "String" | |
}, | |
monMorClose: { | |
type: "String" | |
}, | |
monEveOpen: { | |
type: "String" | |
}, | |
monEveClose: { | |
type: "String" | |
}, | |
tueMorOpen: { | |
type: "String" | |
}, | |
tueMorClose: { | |
type: "String" | |
}, | |
tueEveOpen: { | |
type: "String" | |
}, | |
tueEveClose: { | |
type: "String" | |
}, | |
wedMorOpen: { | |
type: "String" | |
}, | |
wedMorClose: { | |
type: "String" | |
}, | |
wedEveOpen: { | |
type: "String" | |
}, | |
wedEveClose: { | |
type: "String" | |
}, | |
thuMorOpen: { | |
type: "String" | |
}, | |
thuMorClose: { | |
type: "String" | |
}, | |
thuEveOpen: { | |
type: "String" | |
}, | |
thuEveClose: { | |
type: "String" | |
}, | |
friMorOpen: { | |
type: "String" | |
}, | |
friMorClose: { | |
type: "String" | |
}, | |
friEveOpen: { | |
type: "String" | |
}, | |
satMorOpen: { | |
type: "String" | |
}, | |
satMorClose: { | |
type: "String" | |
}, | |
satEveOpen: { | |
type: "String" | |
}, | |
satEveClose: { | |
type: "String" | |
}, | |
placePics: { | |
type: "Array" | |
}, | |
menuPics: { | |
type: "Array" | |
}, | |
barManagerId: { | |
type: "String" | |
}, | |
isBarActive: { | |
type: "Boolean" | |
} | |
} | |
}; | |
let ordersSchema = { | |
className: "Orders", | |
fields: { | |
title: { | |
type: "String" | |
}, | |
userId: { | |
type: "String" | |
}, | |
barId: { | |
type: "String" | |
}, | |
barName: { | |
type: "String" | |
}, | |
drinkId: { | |
type: "String" | |
}, | |
drink: { | |
type: "String" | |
}, | |
quantity: { | |
type: "String" | |
}, | |
tableNo: { | |
type: "String" | |
}, | |
orderTime: { | |
type: "String" | |
}, | |
price: { | |
type: "String" | |
}, | |
boozkDiscount: { | |
type: "String" | |
}, | |
netPrice: { | |
type: "String" | |
}, | |
status: { | |
type: "String" | |
} | |
} | |
}; | |
let stockDrinks = { | |
className: "StockDrinks", | |
fields: { | |
product_name: { | |
type: "String" | |
}, | |
product_content: { | |
type: "String" | |
}, | |
product_spec: { | |
type: "String" | |
}, | |
product_longdesc: { | |
type: "String" | |
}, | |
product_image_link: { | |
type: "String" | |
}, | |
product_image_name: { | |
type: "String" | |
}, | |
product_used: { | |
type: "Boolean" | |
} | |
} | |
}; | |
function createUpdateScema() { | |
var options = { | |
json: true, | |
headers: { | |
"X-Parse-Application-Id": "boozkserver", | |
"X-Parse-Master-Key": "hello12345", | |
} | |
}; | |
needle.post("https://api-test.boozk.co:1333/parse/schemas/Drinks", drinkSchema, options, function(err, resp){ | |
console.log(err); | |
console.log(resp.body); | |
console.log("Got " + resp.bytes + " bytes."); | |
}); | |
needle.post("https://api-test.boozk.co:1333/parse/schemas/Places", placesSchema, options, function (err, resp) { | |
console.log(err); | |
console.log(resp.body); | |
console.log("Got " + resp.bytes + " bytes."); // another nice treat from this handsome fella. | |
}); | |
needle.post("https://api-test.boozk.co:1333/parse/schemas/StockDrinks", stockDrinks, options, function (err, resp) { | |
console.log(err); | |
console.log(resp.body); | |
console.log("Got " + resp.bytes + " bytes."); // another nice treat from this handsome fella. | |
}); | |
needle.post("https://api-test.boozk.co:1333/parse/schemas/Orders", ordersSchema, options, function(err, resp){ | |
console.log(err); | |
console.log(resp.body); | |
console.log("Got " + resp.bytes + " bytes."); | |
}); | |
} | |
createUpdateScema(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment