How to use the nestjs-typegoose.TypegooseModule.forFeature function in nestjs-typegoose

To help you get started, we’ve selected a few nestjs-typegoose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github surmon-china / nodepress / src / modules / tag / tag.module.ts View on Github external
* @module module/tag/module
 * @author Surmon 
 */

import { Module } from '@nestjs/common';
import { TypegooseModule } from 'nestjs-typegoose';
import { SitemapModule } from '@app/modules/sitemap/sitemap.module';
import { Article } from '@app/modules/article/article.model';
import { TagController } from './tag.controller';
import { TagService } from './tag.service';
import { Tag } from './tag.model';

@Module({
  imports: [
    SitemapModule,
    TypegooseModule.forFeature([Tag, Article]),
    // TypegooseModule.forFeature(Article),
  ],
  controllers: [TagController],
  providers: [TagService],
  exports: [TagService],
})
export class TagModule {}
github surmon-china / nodepress / src / modules / category / category.module.ts View on Github external
* @module module/category/module
 * @author Surmon 
 */

import { Module } from '@nestjs/common';
import { TypegooseModule } from 'nestjs-typegoose';
import { SitemapModule } from '@app/modules/sitemap/sitemap.module';
import { Article } from '@app/modules/article/article.model';
import { CategoryController } from './category.controller';
import { CategoryService } from './category.service';
import { Category } from './category.model';

@Module({
  imports: [
    SitemapModule,
    TypegooseModule.forFeature([Article, Category]),
    // TypegooseModule.forFeature([Category]),
  ],
  controllers: [CategoryController],
  providers: [CategoryService],
  exports: [CategoryService],
})
export class CategoryModule {}
github topfullstack / topfullstack / server / libs / db / src / db.module.ts View on Github external
import { Module, Global } from '@nestjs/common';
import { DbService } from './db.service';
import { TypegooseModule } from 'nestjs-typegoose';
import { User } from './models/user.model';
import { Course } from './models/course.model';
import { Episode } from './models/episode.model';

const models = TypegooseModule.forFeature([User, Course, Episode]);

@Global()
@Module({
  imports: [
    TypegooseModule.forRootAsync({
      useFactory() {
        return {
          uri: process.env.DB,
          useNewUrlParser: true,
          useUnifiedTopology: true,
          useCreateIndex: true,
          useFindAndModify: false,
        };
      },
    }),
    // TypegooseModule.forRoot(process.env.DB, {
github surmon-china / nodepress / src / modules / sitemap / sitemap.module.ts View on Github external
* @file Sitemap 模块
 * @module module/sitemap/module
 * @author Surmon 
 */

import { Module } from '@nestjs/common';
import { TypegooseModule } from 'nestjs-typegoose';
import { SitemapController } from './sitemap.controller';
import { SitemapService } from './sitemap.service';
import { Category } from '@app/modules/category/category.model';
import { Article } from '@app/modules/article/article.model';
import { Tag } from '@app/modules/tag/tag.model';

@Module({
  imports: [
    TypegooseModule.forFeature([Tag, Article, Category]),
    // TypegooseModule.forFeature(Article),
    // TypegooseModule.forFeature(Category),
  ],
  controllers: [SitemapController],
  providers: [SitemapService],
  exports: [SitemapService],
})
export class SitemapModule {}
github surmon-china / nodepress / src / modules / comment / comment.module.ts View on Github external
* @module module/comment/module
 * @author Surmon 
 */

import { Module } from '@nestjs/common';
import { TypegooseModule } from 'nestjs-typegoose';
import { SitemapModule } from '@app/modules/sitemap/sitemap.module';
import { CommentController } from './comment.controller';
import { CommentService } from './comment.service';
import { Comment } from './comment.model';
import { Option } from '@app/modules/option/option.model';
import { Article } from '@app/modules/article/article.model';

@Module({
  imports: [
    TypegooseModule.forFeature([Option, Article, Comment]),
    // TypegooseModule.forFeature([Article]),
    // TypegooseModule.forFeature([Comment]),
    SitemapModule,
  ],
  controllers: [CommentController],
  providers: [CommentService],
  exports: [CommentService],
})
export class CommentModule {}
github surmon-china / nodepress / src / modules / option / option.module.ts View on Github external
/**
 * Option module.
 * @file 设置模块
 * @module module/option/module
 * @author Surmon 
 */

import { Module } from '@nestjs/common';
import { TypegooseModule } from 'nestjs-typegoose';
import { OptionController } from './option.controller';
import { OptionService } from './option.service';
import { Option } from './option.model';

@Module({
  imports: [
    TypegooseModule.forFeature([Option]),
  ],
  controllers: [OptionController],
  providers: [OptionService],
  exports: [OptionService],
})
export class OptionModule {}
github surmon-china / nodepress / src / modules / announcement / announcement.module.ts View on Github external
/**
 * Announcement module.
 * @file 公告模块
 * @module module/announcement/module
 * @author Surmon 
 */

import { Module } from '@nestjs/common';
import { TypegooseModule } from 'nestjs-typegoose';
import { Announcement } from './announcement.model';
import { AnnouncementService } from './announcement.service';
import { AnnouncementController } from './announcement.controller';

@Module({
  imports: [
    TypegooseModule.forFeature([Announcement]),
  ],
  controllers: [AnnouncementController],
  providers: [AnnouncementService],
  exports: [AnnouncementService],
})
export class AnnouncementModule {}
github surmon-china / nodepress / src / modules / article / article.module.ts View on Github external
import { Module } from '@nestjs/common';
import { TypegooseModule } from 'nestjs-typegoose';
import { TagModule } from '@app/modules/tag/tag.module';
import { CategoryModule } from '@app/modules/category/category.module';
import { SitemapModule } from '@app/modules/sitemap/sitemap.module';
import { ArticleController } from './article.controller';
import { ArticleService } from './article.service';
import { Article } from './article.model';

@Module({
  imports: [
    TagModule,
    CategoryModule,
    SitemapModule,
    TypegooseModule.forFeature([{
      typegooseClass: Article,
      schemaOptions: {
        toObject: { getters: true },
      },
    }]),
  ],
  controllers: [ArticleController],
  providers: [ArticleService],
  exports: [ArticleService],
})
export class ArticleModule {}

nestjs-typegoose

A nestjs module wrapper for typegoose

MIT
Latest version published 4 years ago

Package Health Score

53 / 100
Full package analysis