-
Notifications
You must be signed in to change notification settings - Fork 3
/
database.js
49 lines (42 loc) · 1.08 KB
/
database.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var database = firebase.database();
function writeUserData(userId, name, email, role) {
firebase.database().ref('users/' + userId).set({
username: name,
email: email,
role: role
});
}
function writeAddress(addressId, street, postalcode, city, county, country) {
firebase.database().ref('address/' + addressId).set({
street: street,
code: postalcode,
city: city,
county: county,
country: country
});
}
function writeContact(Id, addressId) {
firebase.database().ref('contact/' + userId).set({
address: addressId
});
}
function writeProduct(productId, name, price, locationId) {
firebase.database().ref('product/' + productId).set({
name: name,
price: price,
locationId: locationId
});
}
function writeOrder(orderId, userId, addressId, qunatity, price) {
firebase.database().ref('order/' + orderId).set({
user: userId,
addressId:addressId,
quantity:quantity,
price:price
});
}
function writeWharehouse(wharehouseId, locationId) {
firebase.database().ref('product/' + productId).set({
locationId: locationId,
});
}