push code push code

This commit is contained in:
2024-10-17 15:02:25 +07:00
parent 053fb38273
commit 59923b02cb
18 changed files with 106 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ export class ServiceSchema extends PothosSchema {
@PothosRef()
service() {
return this.builder.prismaObject('Service', {
description: 'A service offered by a center.',
fields: (t) => ({
id: t.exposeID('id'),
name: t.exposeString('name'),
@@ -54,6 +55,8 @@ export class ServiceSchema extends PothosSchema {
init() {
this.builder.queryFields((t) => ({
services: t.prismaField({
description:
'Retrieve a list of services with optional filtering, ordering, and pagination.',
type: [this.service()],
args: this.builder.generator.findManyArgs('Service'),
resolve: async (query, root, args, ctx, info) => {
@@ -67,6 +70,7 @@ export class ServiceSchema extends PothosSchema {
},
}),
service: t.prismaField({
description: 'Retrieve a single service by its unique identifier.',
type: this.service(),
args: {
input: t.arg({
@@ -86,6 +90,7 @@ export class ServiceSchema extends PothosSchema {
// Mutation section
this.builder.mutationFields((t) => ({
createService: t.prismaField({
description: 'Create a new service.',
type: this.service(),
args: {
input: t.arg({
@@ -100,6 +105,7 @@ export class ServiceSchema extends PothosSchema {
},
}),
updateService: t.prismaField({
description: 'Update an existing service.',
type: this.service(),
args: {
input: t.arg({
@@ -120,6 +126,7 @@ export class ServiceSchema extends PothosSchema {
},
}),
deleteService: t.prismaField({
description: 'Delete an existing service.',
type: this.service(),
args: {
where: t.arg({