mirror of
https://github.com/aditama-labs/nest-autocrud.git
synced 2024-11-22 11:26:23 +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 { Module } from '@nestjs/common';
|
||||||
import { PrismaService } from './prisma.service';
|
import { PrismaService } from './prisma.service';
|
||||||
|
import { PrismaListProcess } from './processes/list.process';
|
||||||
|
|
||||||
|
export const configServiceProvider = {
|
||||||
|
provide: READ_ENTIRE_PROCESS,
|
||||||
|
useClass: PrismaListProcess,
|
||||||
|
};
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [PrismaService],
|
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 { PRISMA_DELEGATE } from '@autocrud/prisma/constants';
|
||||||
import { ListProcess } from '@autocrud/skeleton/processes/list.process';
|
|
||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { AppController } from './app.controller';
|
import { AppController } from './app.controller';
|
||||||
import { AppService } from './app.service';
|
import { AppService } from './app.service';
|
||||||
import { READ_ENTIRE_PROCESS } from '@autocrud/skeleton';
|
|
||||||
import { PrismaListProcess } from '@autocrud/prisma/processes/list.process';
|
|
||||||
|
|
||||||
const customFactory = {
|
const customFactory = {
|
||||||
provide: PRISMA_DELEGATE,
|
provide: PRISMA_DELEGATE,
|
||||||
@ -16,13 +17,8 @@ const customFactory = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [],
|
imports: [PrismaModule],
|
||||||
controllers: [AppController],
|
controllers: [AppController],
|
||||||
providers: [
|
providers: [AppService, customFactory, configServiceProvider],
|
||||||
AppService,
|
|
||||||
PrismaService,
|
|
||||||
customFactory,
|
|
||||||
{ provide: READ_ENTIRE_PROCESS, useClass: PrismaListProcess },
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
Loading…
Reference in New Issue
Block a user