Using this simple extension you can cascade models create, update, delete in repository level.
npm i --save loopback-component-cascade
Change your repository parent class from DefaultCrudRepository
to CascadeRepositoryMixin()()
Change your repository from:
export class UserRepository extends DefaultCrudRepository<
User,
typeof User.prototype.id,
UserRelations
> {
// ...
}
To:
import { CascadeRepositoryMixin } from "loopback-component-cascade";
export class UserRepository extends CascadeRepositoryMixin<
User,
string,
UserRelations
>()() {
// ...
}
This project is licensed under the MIT license.
Copyright (c) KoLiBer (koliberr136a1@gmail.com)