Open loicgeek opened 4 years ago
Hey, many thanks for this interceptor.
if all you need to add is the Interceptor you can do this through the @Crud decorator as well, and dont need to overwrite the methods:
@Crud({
model: {
type: Song
},
routes: {
createOneBase: {
interceptors: [mixinCheckOwnerchip(Song, "owner")]
}
)
Hello everyone, nestjsx crud is really helpful. thanks for a great job. I have opened this issue just to show what I have done. So when working with nesjtsx crud , i wanted a way to decorate my methods, so that will check whether the current user is the owner of the resource or not. Here is what I have done :
Usage
Entityclass : It's the current entity we are working on. relationName : it's the property name you have used to make the relation between the entity class and the owner. the default value is "user"
Hope you will integrate it in the library, that is my little contribution to this big work. thanks!