My nestjs code like this:
constructor(resource,action, @InjectModel(Role.name) public roleModel?: Model<Role>) {
this.resource = resource;
this.action = action;
}
I got an error if tri use a model
Error:
Role model is not injected yet
at RolesGuard.canActivate (/home/siva/projects/prac360/appointment-api/src/role/role.guard.ts:28:13)
at GuardsConsumer.tryActivate (/home/siva/projects/prac360/appointment-api/node_modules/@nestjs/core/guards/guards-consumer.js:15:34)
How can I access the model?