refactor source code
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { AdminNoteSchema } from './adminnote.schema';
|
||||
import { Module } from '@nestjs/common';
|
||||
import { AdminNoteSchema } from './adminnote.schema'
|
||||
import { Module } from '@nestjs/common'
|
||||
|
||||
@Module({
|
||||
providers: [AdminNoteSchema],
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable } from '@nestjs/common'
|
||||
import {
|
||||
Pothos,
|
||||
PothosRef,
|
||||
PothosSchema,
|
||||
SchemaBuilderToken,
|
||||
} from '@smatch-corp/nestjs-pothos';
|
||||
import { Builder } from '../Graphql/graphql.builder';
|
||||
import { PrismaService } from '../Prisma/prisma.service';
|
||||
} from '@smatch-corp/nestjs-pothos'
|
||||
import { Builder } from '../Graphql/graphql.builder'
|
||||
import { PrismaService } from '../Prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class AdminNoteSchema extends PothosSchema {
|
||||
@@ -14,7 +14,7 @@ export class AdminNoteSchema extends PothosSchema {
|
||||
@Inject(SchemaBuilderToken) private readonly builder: Builder,
|
||||
private readonly prisma: PrismaService,
|
||||
) {
|
||||
super();
|
||||
super()
|
||||
}
|
||||
|
||||
@PothosRef()
|
||||
@@ -71,7 +71,7 @@ export class AdminNoteSchema extends PothosSchema {
|
||||
description: 'The resume the admin note is associated with.',
|
||||
}),
|
||||
}),
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
@Pothos()
|
||||
@@ -81,18 +81,18 @@ export class AdminNoteSchema extends PothosSchema {
|
||||
type: this.adminNote(),
|
||||
args: this.builder.generator.findUniqueArgs('AdminNote'),
|
||||
description: 'Retrieve a single admin note by its unique identifier.',
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
resolve: async (query, _root, args, _ctx, _info) => {
|
||||
return await this.prisma.adminNote.findUnique({
|
||||
...query,
|
||||
where: args.where,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
adminNotes: t.prismaField({
|
||||
type: [this.adminNote()],
|
||||
args: this.builder.generator.findManyArgs('AdminNote'),
|
||||
description: 'Retrieve a list of admin notes.',
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
resolve: async (query, _root, args, _ctx, _info) => {
|
||||
return await this.prisma.adminNote.findMany({
|
||||
...query,
|
||||
where: args.filter ?? undefined,
|
||||
@@ -100,10 +100,10 @@ export class AdminNoteSchema extends PothosSchema {
|
||||
cursor: args.cursor ?? undefined,
|
||||
skip: args.skip ?? undefined,
|
||||
take: args.take ?? undefined,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
}));
|
||||
}))
|
||||
|
||||
// Mutations
|
||||
this.builder.mutationFields((t) => ({
|
||||
@@ -115,11 +115,11 @@ export class AdminNoteSchema extends PothosSchema {
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
resolve: async (query, _root, args, _ctx, _info) => {
|
||||
return await this.prisma.adminNote.create({
|
||||
...query,
|
||||
data: args.input,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -135,12 +135,12 @@ export class AdminNoteSchema extends PothosSchema {
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
resolve: async (query, _root, args, _ctx, _info) => {
|
||||
return await this.prisma.adminNote.update({
|
||||
...query,
|
||||
where: args.where,
|
||||
data: args.data,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -152,13 +152,13 @@ export class AdminNoteSchema extends PothosSchema {
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
resolve: async (query, _root, args, _ctx, _info) => {
|
||||
return await this.prisma.adminNote.delete({
|
||||
...query,
|
||||
where: args.where,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
}));
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user