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 WorkshopSchema extends PothosSchema {
@PothosRef()
workshop() {
return this.builder.prismaObject('Workshop', {
description: 'A workshop in the system.',
fields: (t) => ({
id: t.exposeID('id'),
title: t.exposeString('title'),
@@ -54,6 +55,7 @@ export class WorkshopSchema extends PothosSchema {
workshop: t.prismaField({
type: this.workshop(),
args: this.builder.generator.findUniqueArgs('Workshop'),
description: 'Retrieve a single workshop by its unique identifier.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.workshop.findUnique({
...query,
@@ -65,6 +67,8 @@ export class WorkshopSchema extends PothosSchema {
workshops: t.prismaField({
type: [this.workshop()],
args: this.builder.generator.findManyArgs('Workshop'),
description:
'Retrieve a list of workshops with optional filtering, ordering, and pagination.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.workshop.findMany({
...query,
@@ -87,6 +91,7 @@ export class WorkshopSchema extends PothosSchema {
required: true,
}),
},
description: 'Create a new workshop.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.workshop.create({
...query,
@@ -107,6 +112,7 @@ export class WorkshopSchema extends PothosSchema {
required: true,
}),
},
description: 'Update an existing workshop.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.workshop.update({
...query,