mirror of
https://github.com/aditama-labs/nest-autocrud.git
synced 2024-11-22 03:16:21 +00:00
feat: simplify the providers
This commit is contained in:
parent
231fd12dea
commit
9187f02a23
@ -1,5 +1,12 @@
|
||||
import { READ_ENTIRE_PROCESS } from '@autocrud/skeleton';
|
||||
import { Module } from '@nestjs/common';
|
||||
import { PrismaService } from './prisma.service';
|
||||
import { PrismaListProcess } from './processes/list.process';
|
||||
|
||||
export const configServiceProvider = {
|
||||
provide: READ_ENTIRE_PROCESS,
|
||||
useClass: PrismaListProcess,
|
||||
};
|
||||
|
||||
@Module({
|
||||
providers: [PrismaService],
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { PrismaModule, PrismaService } from '@autocrud/prisma';
|
||||
import {
|
||||
configServiceProvider,
|
||||
PrismaModule,
|
||||
PrismaService,
|
||||
} from '@autocrud/prisma';
|
||||
import { PRISMA_DELEGATE } from '@autocrud/prisma/constants';
|
||||
import { ListProcess } from '@autocrud/skeleton/processes/list.process';
|
||||
import { Module } from '@nestjs/common';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
import { READ_ENTIRE_PROCESS } from '@autocrud/skeleton';
|
||||
import { PrismaListProcess } from '@autocrud/prisma/processes/list.process';
|
||||
|
||||
const customFactory = {
|
||||
provide: PRISMA_DELEGATE,
|
||||
@ -16,13 +17,8 @@ const customFactory = {
|
||||
};
|
||||
|
||||
@Module({
|
||||
imports: [],
|
||||
imports: [PrismaModule],
|
||||
controllers: [AppController],
|
||||
providers: [
|
||||
AppService,
|
||||
PrismaService,
|
||||
customFactory,
|
||||
{ provide: READ_ENTIRE_PROCESS, useClass: PrismaListProcess },
|
||||
],
|
||||
providers: [AppService, customFactory, configServiceProvider],
|
||||
})
|
||||
export class AppModule {}
|
||||
|
Loading…
Reference in New Issue
Block a user