-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDB_ORM2.js
84 lines (83 loc) · 1.78 KB
/
DB_ORM2.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* Created by zhy on 16/7/13.
*/
module.exports.createOrmConnection = function (app) {
var orm = require('orm');
app.use(orm.express("mysql://root:1234root5678@localhost:3306/Nourriture", {
define: function (db, models) {
// models.Order = db.define('order', {
// id: Number,
// user_id: Number,
// shop_id: Number,
// create_date: Date,
// price: Number,
// finish_date: Date,
// menus: String
// });
models.menu = db.define('menu', {
id: Number,
name: String,
img: String,
price: Number,
description: String,
type: String,
score: Number,
del: Number
});
models.menu_material = db.define('menu_material', {
menu_id: Number,
material_id: Number
});
models.menu_shop_user = db.define('menu_shop_user', {
menu_id: Number,
user_id: Number,
shop_id: Number
});
models.menu_evaluate = db.define('menu_evaluate', {
menu_id: Number,
user_id: Number,
evaluate: String,
score: Number
});
models.material = db.define('material', {
id: Number,
name: String,
img: String,
nutrition_value: String,
del: Number
});
models.user = db.define('user', {
id: Number,
name: String,
password: String,
sex: String,
birthday: String,
phone: String,
mail: String,
longitude: Number,
latitude: Number,
reg_date: String,
del: Number
});
models.shop = db.define('shop', {
id: Number,
name: String,
password: String,
phone: String,
address: String,
certificate: String,
img: String,
longitude: Number,
latitude: Number,
description: String,
ads: String,
reg_date: String,
del: Number
});
models.admin = db.define('admin', {
id: Number,
password: String
});
}
}))
};