feat: add completedOrders field to Order schema and enhance workshop subscription error handling
- Introduced a new `completedOrders` field in the Order schema to retrieve a list of completed orders for the authenticated user, filtering by order status and schedule dates. - Enhanced error handling in the WorkshopSubscription schema to prevent retrieval in subscription context, improving the robustness of the API. - Updated imports in order.schema.ts to include additional status types from Prisma for better functionality.
This commit is contained in:
@@ -58,7 +58,8 @@ export class WorkshopSubscriptionSchema extends PothosSchema {
|
||||
type: [this.workshopSubscription()],
|
||||
args: this.builder.generator.findManyArgs('WorkshopSubscription'),
|
||||
description: 'Retrieve a list of workshop subscriptions with optional filtering, ordering, and pagination.',
|
||||
resolve: async (query, _root, args) => {
|
||||
resolve: async (query, _root, args, ctx) => {
|
||||
if (ctx.isSubscription) throw new Error('Workshops cannot be retrieved in subscription context')
|
||||
return await this.prisma.workshopSubscription.findMany({
|
||||
...query,
|
||||
skip: args.skip ?? undefined,
|
||||
|
||||
Reference in New Issue
Block a user