big gift
This commit is contained in:
@@ -41,7 +41,9 @@ export class ServiceSchema extends PothosSchema {
|
||||
price: t.exposeFloat('price', {
|
||||
description: 'The price of the service.',
|
||||
}),
|
||||
rating: t.exposeFloat('rating', {
|
||||
rating: t.expose('rating', {
|
||||
type: 'Float',
|
||||
nullable: true,
|
||||
description: 'The rating of the service.',
|
||||
}),
|
||||
imageFile: t.relation('imageFile', {
|
||||
@@ -100,6 +102,25 @@ export class ServiceSchema extends PothosSchema {
|
||||
@Pothos()
|
||||
init() {
|
||||
this.builder.queryFields((t) => ({
|
||||
testServices: t.prismaConnection(
|
||||
{
|
||||
description: 'A test connection for services',
|
||||
type: this.service(),
|
||||
cursor: 'id',
|
||||
args: this.builder.generator.findManyArgs('Service'),
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
return await this.prisma.service.findMany({
|
||||
...query,
|
||||
});
|
||||
},
|
||||
totalCount: (query) => {
|
||||
return this.prisma.service.count({
|
||||
...query,
|
||||
});
|
||||
},
|
||||
},
|
||||
{},
|
||||
),
|
||||
services: t.prismaField({
|
||||
description:
|
||||
'Retrieve a list of services with optional filtering, ordering, and pagination.',
|
||||
@@ -129,6 +150,9 @@ export class ServiceSchema extends PothosSchema {
|
||||
return await this.prisma.service.findUnique({
|
||||
...query,
|
||||
where: args.input,
|
||||
include: {
|
||||
feedbacks: true,
|
||||
},
|
||||
});
|
||||
},
|
||||
}),
|
||||
@@ -147,6 +171,7 @@ export class ServiceSchema extends PothosSchema {
|
||||
},
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
return await this.prisma.service.create({
|
||||
...query,
|
||||
data: args.input,
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user