update refund ticket
This commit is contained in:
@@ -43,6 +43,9 @@ export class OrderSchema extends PothosSchema {
|
||||
schedule: t.relation('schedule', {
|
||||
description: 'The schedule of the order.',
|
||||
}),
|
||||
disbursed: t.exposeBoolean('disbursed', {
|
||||
description: 'Whether the order has been disbursed.',
|
||||
}),
|
||||
chatRoomId: t.exposeID('chatRoomId', {
|
||||
description: 'The ID of the chat room.',
|
||||
}),
|
||||
|
||||
@@ -56,6 +56,22 @@ export class RefundTicketSchema extends PothosSchema {
|
||||
@Pothos()
|
||||
init(): void {
|
||||
this.builder.queryFields((t) => ({
|
||||
refundTicket: t.prismaField({
|
||||
type: this.refundTicket(),
|
||||
description: 'Retrieve a refund ticket by ID.',
|
||||
args: {
|
||||
id: t.arg({ type: 'String', required: true }),
|
||||
},
|
||||
resolve: async (query, _root, args, ctx, _info) => {
|
||||
if (ctx.isSubscription) {
|
||||
throw new Error('Subscription is not allowed')
|
||||
}
|
||||
if (ctx.http.me?.role !== Role.MODERATOR) {
|
||||
throw new Error('Only moderators can retrieve refund tickets')
|
||||
}
|
||||
return await this.prisma.refundTicket.findUnique({ ...query, where: { id: args.id } })
|
||||
},
|
||||
}),
|
||||
refundTickets: t.prismaField({
|
||||
type: [this.refundTicket()],
|
||||
description: 'Retrieve a list of refund tickets with optional filtering, ordering, and pagination.',
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user