src/services/search/search.class.js
// find is the only publically accessible method - the rest are only used internally
find is the only publically accessible method - the rest are only used internally
find is the only publically accessible method - the rest are only used internally
async find(params) {
    const { date, theater, title, maxRating } = params.query;
    const dateQuery = this.createDateQuery(date);
    const query = { ...dateQuery, $populate: ['movie', 'theater'] };
    const initialResults = await this.timesService.find({query});
    return this.filterInitialResults(maxRating, theater, title, initialResults);
  }
async find ( params ) { const { date , theater , title , maxRating } = params . query ; const dateQuery = this . createDateQuery ( date ) ; const query = { ... dateQuery , $populate : [ 'movie' , 'theater' ] } ; const initialResults = await this . timesService . find ( { query } ) ; return this . filterInitialResults ( maxRating , theater , title , initialResults ) ; }
find is the only publically accessible method - the rest are only used internally
find is the only publically accessible method - the rest are only used internally
// get the query parameters from the request // create the date part of the query // create the full query, including a request to "populate" the movie and theater that are referenced // make the query to timesService and get back the results // in the "find" method, you must provide a params and query key within the params // then, filter these intiial results further