|
|
@@ -246,5 +246,63 @@ module.exports = {
|
|
246
|
246
|
});
|
|
247
|
247
|
}
|
|
248
|
248
|
});
|
|
|
249
|
+ },
|
|
|
250
|
+
|
|
|
251
|
+ get_all_accepted_events: function (auth, complete) {
|
|
|
252
|
+ var self = this;
|
|
|
253
|
+ user_controller.get_user_from_auth(auth, function (username) {
|
|
|
254
|
+ if (username) {
|
|
|
255
|
+ user_controller.get_public_user_info(username, function (data) {
|
|
|
256
|
+ var accepted_events = data.accepted_events;
|
|
|
257
|
+ var accepted_events_objs = [];
|
|
|
258
|
+ accepted_events.map(function (event_id) {
|
|
|
259
|
+ self.get_event(event_id, "", function (response) {
|
|
|
260
|
+ response.event.id = event_id;
|
|
|
261
|
+ accepted_events_objs.push(response.event);
|
|
|
262
|
+ if (accepted_events_objs.length === accepted_events.length) {
|
|
|
263
|
+ complete({
|
|
|
264
|
+ "accepted_events": accepted_events_objs,
|
|
|
265
|
+ "error": 0
|
|
|
266
|
+ });
|
|
|
267
|
+ }
|
|
|
268
|
+ }, true);
|
|
|
269
|
+ });
|
|
|
270
|
+ });
|
|
|
271
|
+ } else {
|
|
|
272
|
+ complete({
|
|
|
273
|
+ "accepted_events": [],
|
|
|
274
|
+ "error": 1
|
|
|
275
|
+ });
|
|
|
276
|
+ }
|
|
|
277
|
+ });
|
|
|
278
|
+ },
|
|
|
279
|
+
|
|
|
280
|
+ get_all_declined_events: function (auth, complete) {
|
|
|
281
|
+ var self = this;
|
|
|
282
|
+ user_controller.get_user_from_auth(auth, function (username) {
|
|
|
283
|
+ if (username) {
|
|
|
284
|
+ user_controller.get_public_user_info(username, function (data) {
|
|
|
285
|
+ var declined_events = data.declined_events;
|
|
|
286
|
+ var declined_events_objs = [];
|
|
|
287
|
+ declined_events.map(function (event_id) {
|
|
|
288
|
+ self.get_event(event_id, "", function (response) {
|
|
|
289
|
+ response.event.id = event_id;
|
|
|
290
|
+ declined_events_objs.push(response.event);
|
|
|
291
|
+ if (declined_events_objs.length === declined_events.length) {
|
|
|
292
|
+ complete({
|
|
|
293
|
+ "declined_events": declined_events_objs,
|
|
|
294
|
+ "error": 0
|
|
|
295
|
+ });
|
|
|
296
|
+ }
|
|
|
297
|
+ }, true);
|
|
|
298
|
+ });
|
|
|
299
|
+ });
|
|
|
300
|
+ } else {
|
|
|
301
|
+ complete({
|
|
|
302
|
+ "declined_events": [],
|
|
|
303
|
+ "error": 1
|
|
|
304
|
+ });
|
|
|
305
|
+ }
|
|
|
306
|
+ });
|
|
249
|
307
|
}
|
|
250
|
308
|
}
|