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({
|
2024-10-26 14:35:16 +00:00
|
|
|
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 {}
|