Refactor WorkshopSchema: remove imageFileUrl field and update resolver parameters for consistency

This commit is contained in:
2024-11-26 00:42:51 +07:00
parent 0879630195
commit dc2397d73e

View File

@@ -45,9 +45,6 @@ export class WorkshopSchema extends PothosSchema {
imageFileId: t.exposeID('imageFileId', { imageFileId: t.exposeID('imageFileId', {
description: 'The ID of the image file for the workshop.', description: 'The ID of the image file for the workshop.',
}), }),
imageFileUrl: t.exposeString('imageFileUrl', {
description: 'The URL of the image file for the workshop.',
}),
date: t.expose('date', { date: t.expose('date', {
type: 'DateTime', type: 'DateTime',
nullable: true, nullable: true,
@@ -90,7 +87,7 @@ export class WorkshopSchema extends PothosSchema {
type: this.workshop(), type: this.workshop(),
args: this.builder.generator.findUniqueArgs('Workshop'), args: this.builder.generator.findUniqueArgs('Workshop'),
description: 'Retrieve a single workshop by its unique identifier.', description: 'Retrieve a single workshop by its unique identifier.',
resolve: async (query, root, args, ctx, info) => { resolve: async (query, _root, args, _ctx, _info) => {
return await this.prisma.workshop.findUnique({ return await this.prisma.workshop.findUnique({
...query, ...query,
where: args.where, where: args.where,
@@ -103,7 +100,7 @@ export class WorkshopSchema extends PothosSchema {
args: this.builder.generator.findManyArgs('Workshop'), args: this.builder.generator.findManyArgs('Workshop'),
description: description:
'Retrieve a list of workshops with optional filtering, ordering, and pagination.', 'Retrieve a list of workshops with optional filtering, ordering, and pagination.',
resolve: async (query, root, args, ctx, info) => { resolve: async (query, _root, args, _ctx, _info) => {
return await this.prisma.workshop.findMany({ return await this.prisma.workshop.findMany({
...query, ...query,
skip: args.skip ?? undefined, skip: args.skip ?? undefined,
@@ -126,7 +123,7 @@ export class WorkshopSchema extends PothosSchema {
}), }),
}, },
description: 'Create a new workshop.', description: 'Create a new workshop.',
resolve: async (query, root, args, ctx, info) => { resolve: async (query, _root, args, _ctx, _info) => {
return await this.prisma.workshop.create({ return await this.prisma.workshop.create({
...query, ...query,
data: args.input, data: args.input,
@@ -147,7 +144,7 @@ export class WorkshopSchema extends PothosSchema {
}), }),
}, },
description: 'Update an existing workshop.', description: 'Update an existing workshop.',
resolve: async (query, root, args, ctx, info) => { resolve: async (query, _root, args, _ctx, _info) => {
return await this.prisma.workshop.update({ return await this.prisma.workshop.update({
...query, ...query,
where: args.where, where: args.where,