nest-autocrud/src/app.module.ts

21 lines
561 B
TypeScript
Raw Normal View History

2024-10-26 17:15:22 +00:00
import { PrismaModule, PrismaService } from '@autocrud/prisma';
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:15:22 +00:00
const delegateFactory = {
provide: PRISMA_DELEGATE,
useFactory: (prisma: PrismaService) => {
return prisma.user;
},
inject: [PrismaService],
};
2024-10-26 08:35:59 +00:00
@Module({
imports: [PrismaModule],
2024-10-26 08:35:59 +00:00
controllers: [AppController],
2024-10-26 17:15:22 +00:00
providers: [AppService, delegateFactory],
2024-10-26 08:35:59 +00:00
})
export class AppModule {}