title: How can I use service in a helper class in nest.js?
body: <p>I import the redis module in <code>app.module.ts</code> file:</p>
  
  <pre><code>@Module({
    imports: [
      TypegooseModule.forRoot('mongodb://mongo:27017/test', {
        useNewUrlParser: true,
        useUnifiedTopology: true,
        useCreateIndex: true,
      }),
      RedisModule.register({ url: 'redis://sessions' }),
      UsersModule,
      AuthModule,
    ],
    controllers: [],
    providers: [],
  })
  export class AppModule {}
  </code></pre>
  
  <p>I would like to create a helper class <code>SessionManager</code> that would manage user's sessions (store, update, delete them in Redis), e.g something like this:</p>
  
  <pre><code>import { RedisService } from 'nestjs-redis';
  import { User } from 'src/users/schemas/user.schema';
  import { IUserSessions } from '../interfaces/Session.interface';
  
  class SessionManager {
    constructor(private redisService: RedisService) {}
  
    saveUserSession(user: User, userAgent: string) {}
  
    static getSessionsByUserId(userId: string): IUserSessions {
      const client = this.redisService.getClient()
      const sessions = client.hmgetall(userId)
  
      return sessions
    }
  }
  
  export default SessionManager
  </code></pre>
  
  <p>and use it in my <code>auth.service.ts</code>. How do I do that? Does it have to be represented as some Nest.js entity (module or provider)?</p>