Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Module, MiddlewareConsumer, NestModule
} from '@nestjs/common';
import { AuthService } from './auth.service';
import { JwtStrategy } from './passport/jwt.strategy';
import { AuthController } from './auth.controller';
import { UserSchema } from '../users/schemas/user.schema';
import { EmailVerificationSchema } from '../auth/schemas/emailverification.schema';
import { ForgottenPasswordSchema } from './schemas/forgottenpassword.schema';
import { ConsentRegistrySchema } from './schemas/consentregistry.schema';
import { UsersService } from '../users/users.service';
import { JWTService } from './jwt.service';
import { MongooseModule } from '@nestjs/mongoose';
import { LoggerMiddleware } from '../common/middlewares/logger.middleware';
@Module({
imports: [MongooseModule.forFeature([
{ name: 'User', schema: UserSchema },
{ name: 'EmailVerification', schema: EmailVerificationSchema },
{ name: 'ForgottenPassword', schema: ForgottenPasswordSchema },
{ name: 'ConsentRegistry', schema: ConsentRegistrySchema }
])],
controllers: [AuthController],
providers: [AuthService, UsersService, JWTService, JwtStrategy],
})
export class AuthModule implements NestModule {
public configure(consumer: MiddlewareConsumer) {
consumer
.apply(LoggerMiddleware)
// .exclude(
// { path: 'example', method: RequestMethod.GET },
// )
.forRoutes(AuthController);
import { Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { REPO_MODEL_NAME, RepoSchema } from '@kb-models';
import { ReposController } from './repos.controller';
import { ReposService } from './repos.service';
@Module({
imports: [ MongooseModule.forFeature([ { name: REPO_MODEL_NAME, schema: RepoSchema } ]) ],
providers: [ ReposService ],
controllers: [ ReposController ],
exports: [ ReposService ]
})
export class ReposModule { }
import { Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { FilesModule } from 'files/files.module';
import { UserSchema } from './schemas/user.schema';
import { UserResolver } from './user.resolvers';
import { UserService } from './user.service';
@Module({
imports: [
MongooseModule.forFeature([{ name: 'User', schema: UserSchema }]),
FilesModule,
],
providers: [UserService, UserResolver],
exports: [UserService],
})
export class UsersModule {}
import { Module } from '@nestjs/common';
import { HerosService } from './heros.service';
import { HerosResolver } from './heros.resolvers';
import { MongooseModule } from '@nestjs/mongoose';
import { HerosSchema } from './schema/heros.schema';
import { EmailModule } from '../common/email/email.module';
@Module({
imports: [MongooseModule.forFeature([{ name: 'Heros', schema: HerosSchema }]), EmailModule],
providers: [HerosService, HerosResolver]
})
export class HerosModule {}
import { Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { User } from './models/user.model';
import { UserController } from './user.controller';
import { UserService } from './user.service';
@Module({
imports: [MongooseModule.forFeature([{ name: User.modelName, schema: User.model.schema }])],
providers: [UserService],
controllers: [UserController],
exports: [UserService],
})
export class UserModule {
}
{ name: 'Page', schema: PageSchema },
{ name: 'Photo', schema: PhotoSchema },
{ name: 'Widget', schema: WidgetSchema },
{ name: 'Content', schema: ContentSchema },
{ name: 'Custom', schema: CustomSchema },
];
@Module({
imports: [
MulterModule.registerAsync({
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => ({
dest: configService.get('MULTER_DEST'),
}),
inject: [ConfigService],
}),
MongooseModule.forFeature(models),
],
controllers: [...CmsControllers],
providers: [...CmsServices],
})
export class CmsModule {}
import { Module, forwardRef } from '@nestjs/common';
import { UsersService } from './users.service';
import { MongooseModule } from '@nestjs/mongoose';
import { UserSchema, TodoSchema } from './schemas/user.schema';
import { UsersController } from './users.controller';
import { PasswordModule } from '../../common/password/password.module';
import { AuthModule } from '../auth/auth.module';
@Module({
imports: [
MongooseModule.forFeature([
{ name: 'User', schema: UserSchema },
{ name: 'Todo', schema: TodoSchema },
]),
forwardRef(() => AuthModule),
PasswordModule,
],
providers: [UsersService],
exports: [UsersService],
controllers: [UsersController],
})
export class UsersModule { }
import { UserSchema } from './schemas/user.schema';
import { Module, NestModule, MiddlewaresConsumer, RequestMethod } from '@nestjs/common';
import { CatsController } from './cats.controller';
import { CatsService } from './cats.service';
import { MongooseModule } from '@nestjs/mongoose';
import { RoomSchema } from '../cats/schemas/room.schema';
import { EventsGateway } from '../events.gateway';
import { CorsMiddleware } from './cors.middleware';
@Module({
imports: [MongooseModule.forFeature([{ name: 'Room', schema: RoomSchema }, { name: 'User', schema: UserSchema }])],
controllers: [CatsController],
components: [CatsService, EventsGateway],
exports: [CatsService]
})
export class CatsModule {
configure(consumer: MiddlewaresConsumer): void {
consumer.apply(CorsMiddleware).forRoutes(
{ path: '*', method: RequestMethod.ALL},
);
}
}
import { Module } from '@nestjs/common';
import { LinkService } from './link.service';
import { LinkResolver } from './link.resolvers';
import { MongooseModule } from '@nestjs/mongoose';
import { LinkSchema } from './schema/link.schema';
@Module({
imports: [MongooseModule.forFeature([{ name: 'Links', schema: LinkSchema }])],
providers: [LinkService, LinkResolver]
})
export class LinkModule {}
import { Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { CatsController } from './cats.controller';
import { CatsService } from './cats.service';
import { CatSchema } from './schemas/cat.schema';
@Module({
imports: [MongooseModule.forFeature([{ name: 'Cat', schema: CatSchema }])],
controllers: [CatsController],
providers: [CatsService],
})
export class CatsModule {}