Skip to content

NestJs

If you want to reuse a service/repository in another module…

  1. Export the service/repository in the origin module
  2. Import the origin module in the second module

If you want to save a relation along with a parent entity…

  1. Use the save function from the parent-repo
  2. Set cascade: true on the manyToMany relationship of the relation on the parent entity (if you do not set this , you have to save the relations first and then only pass the ids)
  3. Add the  complete relation object to the save function (or only the id’s if cascade : false )
Published inUncategorized

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *