feat: add service to all prisma process

This commit is contained in:
Supan Adit Pratama 2024-11-02 23:06:59 +07:00
parent 55fe243e00
commit d25afafbd3
3 changed files with 6 additions and 15 deletions

View File

@ -1,12 +1,14 @@
import { DefaultProcess } from '@aditama-labs/nest-autocrud/skeleton'; import { DefaultProcess } from '@aditama-labs/nest-autocrud/skeleton';
import { Inject, Injectable } from '@nestjs/common'; import { Inject, Injectable } from '@nestjs/common';
import { PRISMA_DELEGATE } from '../constants'; import { PRISMA_DELEGATE } from '../constants';
import { PrismaService } from '../prisma.service';
@Injectable() @Injectable()
export class PrismaProcess extends DefaultProcess { export class PrismaProcess extends DefaultProcess {
constructor( constructor(
@Inject(PRISMA_DELEGATE) @Inject(PRISMA_DELEGATE)
private delegate, private delegate,
public prisma: PrismaService,
) { ) {
super(); super();
} }

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@aditama-labs/nest-autocrud", "name": "@aditama-labs/nest-autocrud",
"version": "0.1.4", "version": "0.3.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@aditama-labs/nest-autocrud", "name": "@aditama-labs/nest-autocrud",
"version": "0.1.4", "version": "0.3.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@nestjs/common": "^10.0.0", "@nestjs/common": "^10.0.0",

View File

@ -1,21 +1,10 @@
import { import {
PRISMA_DELEGATE, PrismaReadProcess
PrismaReadProcess,
PrismaService,
} from '@aditama-labs/nest-autocrud/prisma'; } from '@aditama-labs/nest-autocrud/prisma';
import { Inject, Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
@Injectable() @Injectable()
export class CustomReadProcess extends PrismaReadProcess { export class CustomReadProcess extends PrismaReadProcess {
constructor(
@Inject(PRISMA_DELEGATE)
delegate,
@Inject()
private prisma: PrismaService,
) {
super(delegate);
}
customResult; customResult;
async before(): Promise<any> { async before(): Promise<any> {