nest-autocrud/src/app.module.ts

25 lines
610 B
TypeScript
Raw Normal View History

2024-10-26 17:50:15 +00:00
import {
configServiceProvider,
PrismaModule,
PrismaService,
} from '@autocrud/prisma';
2024-10-26 17:15:22 +00:00
import { PRISMA_DELEGATE } from '@autocrud/prisma/constants';
2024-10-26 08:35:59 +00:00
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
2024-10-26 17:43:17 +00:00
const customFactory = {
2024-10-26 17:15:22 +00:00
provide: PRISMA_DELEGATE,
useFactory: (prisma: PrismaService) => {
return prisma.user;
},
inject: [PrismaService],
};
2024-10-26 08:35:59 +00:00
@Module({
2024-10-26 17:50:15 +00:00
imports: [PrismaModule],
2024-10-26 08:35:59 +00:00
controllers: [AppController],
2024-10-26 17:50:15 +00:00
providers: [AppService, customFactory, configServiceProvider],
2024-10-26 08:35:59 +00:00
})
export class AppModule {}