title: NestJs: How can I import one repository into another?
body: <p>I apologize for what is likely a very amateur question. Coming from Laravel, this is still quite confusing to me and I just don't understand what is needed.</p>
  <p>I have a <code>user.repository.ts</code> file and a <code>location.repository.ts</code> file. Each have their own modules, controllers and services. I have successfully created CRUD operations for each entity but now am trying to work towards a Many to Many relationship.</p>
  <p>In my <code>user.repository.ts</code> file, I am trying to save a related (many to many) repository:</p>
  <pre><code>// user.repository.ts
  
  user.locations = await this.locationRepository.findByIds(locations);
  ...
  
  await user.save();
  </code></pre>
  <p>I am not sure how to inject or import the <code>location.repository.ts</code> file. I have tried numerous variations of importing the service into each module. Or importing each module <em>into</em> the other module. I have tried different versions of this:</p>
  <pre><code>@EntityRepository(User)
  @EntityRepository(Location)
  </code></pre>
  <p>Or importing the <code>LocationService</code> into the <code>UserService</code>.</p>
  <p>In Laravel, this would be as &quot;simple&quot; as <code>$model-&gt;sync($relationship);</code></p>
  <p>How can I import/inject the <code>locationRepository</code> into my <code>userRepository</code>? Thank you for any suggestions!</p>