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

@@ -22,6 +22,7 @@ export class PaymentSchema extends PothosSchema {
@PothosRef()
payment() {
return this.builder.prismaObject('Payment', {
description: 'A payment in the system.',
fields: (t) => ({
id: t.exposeID('id'),
amount: t.exposeFloat('amount'),
@@ -42,6 +43,7 @@ export class PaymentSchema extends PothosSchema {
this.builder.queryFields((t) => ({
payment: t.prismaField({
type: this.payment(),
description: 'Retrieve a single payment by its unique identifier.',
args: this.builder.generator.findUniqueArgs('Payment'),
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.payment.findUnique({
@@ -53,6 +55,8 @@ export class PaymentSchema extends PothosSchema {
payments: t.prismaField({
type: [this.payment()],
args: this.builder.generator.findManyArgs('Payment'),
description:
'Retrieve a list of payments with optional filtering, ordering, and pagination.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.payment.findMany({
...query,