-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.js
58 lines (53 loc) · 1.63 KB
/
db.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
exports.models = function(sequelize,Sequelize)
{
m = new Object;
//var Jadwal = sequelize.define('jadwal',{
//});
var Aktivitas = sequelize.define('Aktivitas',{
kategori: Sequelize.INTEGER,
nama: Sequelize.STRING(45),
zzz: Sequelize.INTEGER
});
var Waktu = sequelize.define('Waktu',{
mulaijam: Sequelize.INTEGER,
mulaimenit: Sequelize.INTEGER,
jenis: Sequelize.STRING(1),
interval: Sequelize.INTEGER
});
var Hari = sequelize.define('Hari',{
nama: Sequelize.STRING(45),
kode: Sequelize.STRING(45),
});
var Jadwal = sequelize.define('Jadwal',{
},
{
instanceMethods: {
acceptTime: function (timeStruct) {
if (this.waktu.jenis == "S") {
timeStruct.mulaijam = this.waktu.mulaijam;
timeStruct.mulaimenit = this.waktu.mulaimenit;
timeStruct.sampaijam = this.waktu.mulaijam;
timeStruct.sampaimenit = this.waktu.mulaimenit + this.waktu.interval;
timeStruct.normalize();
} else if (this.waktu.jenis == "I") {
timeStruct.mulaijam = timeStruct.sampaijam;
timeStruct.mulaimenit = timeStruct.sampaimenit;
timeStruct.sampaijam = timeStruct.mulaijam;
timeStruct.sampaimenit = timeStruct.mulaimenit + this.waktu.interval;
timeStruct.normalize();
}
}
},
getterMethods: {
f1: function() { return "f1";}
}
});
Jadwal.belongsTo(Hari);
Jadwal.belongsTo(Aktivitas);
Jadwal.belongsTo(Waktu);
m.Aktivitas = Aktivitas;
m.Jadwal = Jadwal;
m.Hari = Hari;
m.Waktu = Waktu;
return m;
}