title: How to access/inject the database in a nest.js Auth Guard?
body: <p>I have a nestjs app that currently has a user and company entity and each company has an owner user.
  In my case, I want to write a custom decorator to use in each controller method to see if the user is the owner of that company or not.<br>
  so I start writing custom Guard like this:</p>
  
  <pre><code>@Injectable()
  export class CompanyGuard implements CanActivate {
      constructor() { }
      canActivate(context: ExecutionContext) {
          const request = context.switchToHttp().getRequest();
          const user = request.user;
          if (user) {
              console.log(user);
              return true;
          } else {
              throw new HttpException('you have no access to this company', HttpStatus.UNAUTHORIZED)
          }
      }
  }
  </code></pre>
  
  <p>and I use it like this:</p>
  
  <pre><code>@UseGuards(JwtAuthGuard, CompanyGuard)
  @Post('get-data/:companyId/')
  getData(@Req() request){}
  </code></pre>
  
  <p>i want to access mongoose database in CompanyGuard and check the access in database how can i do that?</p>