Quantcast
Viewing all articles
Browse latest Browse all 4828

Returning events that have bookings inside

@celo wrote:

Hei guys!

I'm having a bad time! I need return in my route only events with bookings inside, and i'm trying like this:

  setupController(controller, model) {
    controller.set('events', this.store.findAll('event').then((events) => {
      return events.filter((event) => {
        let bookings = this.store.query('booking', {
          'relationships.event.data.id': event.id
        });

        if (bookings.get('length')) {
          return event;
        }
      });
    }));
  }

The problem is: The request is async, so isn't returning anything.

How could i solve this problem?

Thanks guys!

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles