nest-autocrud/src/app.module.ts

29 lines
852 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 17:43:17 +00:00
import { ListProcess } from '@autocrud/skeleton/processes/list.process';
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
import { READ_ENTIRE_PROCESS } from '@autocrud/skeleton';
import { PrismaListProcess } from '@autocrud/prisma/processes/list.process';
2024-10-26 08:35:59 +00:00
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:43:17 +00:00
imports: [],
2024-10-26 08:35:59 +00:00
controllers: [AppController],
2024-10-26 17:43:17 +00:00
providers: [
AppService,
PrismaService,
customFactory,
{ provide: READ_ENTIRE_PROCESS, useClass: PrismaListProcess },
],
2024-10-26 08:35:59 +00:00
})
export class AppModule {}