Skip to main content

Configuration

This is a NestJS module that serves as the core of a content management platform, supporting basic features such as article versioning and categorization. The storage of article content uses Quadrats as the core storage system and requires TypeORM for database interfacing. Of course, you are free to define the necessary Entity Columns on all stored tables.

First, you need to configure it using forRoot in your root module. If you need to pre-load other modules, forRootAsync might be your choice.

src/app.module.ts
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { CMSBaseModule } from '@rytass/cms-base-nestjs-module';

@Module({
imports: [
TypeOrmModule.forRoot({
type: 'postgres',
host: 'localhost',
username: 'cms',
password: 'password',
database: 'cms',
schema: 'cms',
synchronize: true,
autoLoadEntities: true,
uuidExtension: 'uuid-ossp',
}),
CMSBaseModule.forRoot(),
],
})
export class AppModule {}

References

Methods

forRoot()

static forRoot(options?: CMSBaseModuleOptionsDto);

Parameters:

NameTypeDefaultDescription
multipleLanguageModebooleanfalseEnable multiple language support
allowMultipleParentCategoriesbooleanfalseAllow category has multiple parent categories
allowCircularCategoriesbooleanfalseAllow category parent loop hierarchy
fullTextSearchModebooleanfalseSearch term in article content with node-rs/jieba
signatureModebooleanfalseEnable signature mode
signatureLevelsstring[] | Entity[][]When signature mode enabled, multiple signature configuration
articleEntityTypeORM EntityundefinedCustom ArticleEntity
articleVersionEntityTypeORM EntityundefinedCustom ArticleVersionEntity
articleVersionContentEntityTypeORM EntityundefinedCustom ArticleVersionContentEntity
categoryEntityTypeORM EntityundefinedCustom CategoryEntity
categoryMultiLanguageNameEntityTypeORM EntityundefinedCustom BaseCategoryMultiLanguageNameEntity
signatureLevelEntityTypeORM EntityundefinedCustom BaseSignatureLevelEntity

forRootAsync()

static forRootAsync(options: CMSBaseModuleAsyncOptionsDto);

Parameters:

NameTypeDefaultDescription
importsDynamicModule[][]Imported module before CMS module
useFactory(...args: any[]) => CMSBaseModuleOptionsDtoundefinedFactory method to generate async options
injectsany[][]Inject symbol for useFactory method
useClassType<CMSBaseModuleOptionFactory>undefinedOptions provider class
useExistingType<CMSBaseModuleOptionFactory>undefinedOptions provider class symbol