-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroller_day.js
137 lines (125 loc) · 3.11 KB
/
controller_day.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
const dataDays = require("./data_rosary_days");
class ControllerDay {
/* All the 7 days */
// getting Sunday data
async getSundayData() {
return new Promise((resolve, reject) => {
// get the data
let sundayData = dataDays.filter(function(SundayIn) {
return SundayIn.date == "Sunday";
});
// console.log(sundayData);
if (sundayData) {
// return the data
resolve(sundayData);
} else {
// return an error
reject(`Sunday object not found `);
}
});
}
// getting Monday data
async getMondayData() {
return new Promise((resolve, reject) => {
// get the data
let mondayData = dataDays.filter(function(MondayIn) {
return MondayIn.date == "Monday";
});
// console.log(mondayData);
if (mondayData) {
// return the data
resolve(mondayData);
} else {
// return an error
reject(`Monday object not found `);
}
});
}
// getting Tuesday data
async getTuesdayData() {
return new Promise((resolve, reject) => {
// get the data
let tuesdayData = dataDays.filter(function(TuesdayIn) {
return TuesdayIn.date == "Tuesday";
});
// console.log(tuesdayData);
if (tuesdayData) {
// return the data
resolve(tuesdayData);
} else {
// return an error
reject(`Tuesday object not found `);
}
});
}
// getting Wednesday data
async getWednesdayData() {
return new Promise((resolve, reject) => {
// get the data
let wednesdayData = dataDays.filter(function(WednesdayIn) {
return WednesdayIn.date == "Wednesday";
});
// console.log(wednesdayData);
if (wednesdayData) {
// return the data
resolve(wednesdayData);
} else {
// return an error
reject(`Wednesday object not found `);
}
});
}
// getting Thursday data
async getThursdayData() {
return new Promise((resolve, reject) => {
// get the data
let thursdayData = dataDays.filter(function(ThursdayIn) {
return ThursdayIn.date == "Thursday";
});
// console.log(thursdayData);
if (thursdayData) {
// return the data
resolve(thursdayData);
} else {
// return an error
reject(`Thursday object not found `);
}
});
}
// getting Friday data
async getFridayData() {
return new Promise((resolve, reject) => {
// get the data
let fridayData = dataDays.filter(function(FridayIn) {
return FridayIn.date == "Friday";
});
// console.log(fridayData);
if (fridayData) {
// return the data
resolve(fridayData);
} else {
// return an error
reject(`Friday object not found `);
}
});
}
// getting Saturday data
async getSaturdayData() {
return new Promise((resolve, reject) => {
// get the data
let saturdayData = dataDays.filter(function(SaturdayIn) {
return SaturdayIn.date == "Saturday";
});
// console.log(saturdayData);
if (saturdayData) {
// return the data
resolve(saturdayData);
} else {
// return an error
reject(`Saturday object not found `);
}
});
}
// add above
}
module.exports = ControllerDay;