Backend - Movies - Add Event Pipeline builder

I'm not 100% on the implementation in python but this is a sick ass design pattern and 100% recommend we use for the advanced search. I'll give a rough explanation on how it works:

First we will have a MoviesPipelineBuilder class, this will be static - we will then have one public method in this build, it takes in the opts param:

public build(opts: Object<any>): Object[]

Then inside this method we will have calls to multiple private methods which will push specific queries to the pipeline. This is a bit annoying to visualise so here's an example pseudocode class:

export class MoviePipelineBuilder() {
  private pipeline: Object[] = []
    
  public build(opts: Object): Object[] {
    name(opts);
    rating(opts);

    return pipeline;
  }

  private name(opts: Object): void {
    if (opts.name) {
      this.pipeline.push({
         name: {$match: opts.name},
      }
    }
  };

  private rating(opts: Object): void {
    if (opts.rating) {
      this.pipeline.push({
         rating {$match: opts.rating},
      }
    }
  };

  ....
}

// To use now just call:
new MoviePipelineBuilder().build(opts)

fyi @2842838m @2896440d @2905031s @2955053f

Edited by Liam Mcmanus