teableio/teable

View on GitHub
apps/nestjs-backend/src/cache/cache.module.ts

Summary

Maintainability
A
0 mins
Test Coverage
/* eslint-disable @typescript-eslint/naming-convention */
import { ConfigurableModuleBuilder, type DynamicModule, Module } from '@nestjs/common';
import { CacheProvider } from './cache.provider';

export interface CacheModuleOptions {
  global?: boolean;
}

export const { ConfigurableModuleClass: CacheModuleClass, OPTIONS_TYPE } =
  new ConfigurableModuleBuilder<CacheModuleOptions>().build();

@Module({
  providers: [CacheProvider],
  exports: [CacheProvider],
})
export class CacheModule extends CacheModuleClass {
  static register(options: typeof OPTIONS_TYPE): DynamicModule {
    return {
      global: options.global,
      ...super.register(options),
    };
  }
}