Skip to content

Instantly share code, notes, and snippets.

@royib
Last active January 19, 2022 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save royib/792293c7466f9796c777b6d7df36ccb3 to your computer and use it in GitHub Desktop.
Save royib/792293c7466f9796c777b6d7df36ccb3 to your computer and use it in GitHub Desktop.
import { Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { IDataServices } from '../../../core';
import { DATA_BASE_CONFIGURATION } from '../../../configuration';
import {
Author,
AuthorSchema,
Book,
BookSchema,
Genre,
GenreSchema,
} from './model';
import { MongoDataServices } from './mongo-data-services.service';
@Module({
imports: [
MongooseModule.forFeature([
{ name: Author.name, schema: AuthorSchema },
{ name: Book.name, schema: BookSchema },
{ name: Genre.name, schema: GenreSchema },
]),
MongooseModule.forRoot(DATA_BASE_CONFIGURATION.mongoConnectionString),
],
providers: [
{
provide: IDataServices,
useClass: MongoDataServices,
},
],
exports: [IDataServices],
})
export class MongoDataServicesModule {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment