diff --git a/src/Order/order.schema.ts b/src/Order/order.schema.ts index 855eca0..367fcfe 100644 --- a/src/Order/order.schema.ts +++ b/src/Order/order.schema.ts @@ -228,6 +228,15 @@ export class OrderSchema extends PothosSchema { paymentCode: paymentData.paymentLinkId, }, }) + + // update orderId for schedule dates + await this.prisma.scheduleDate.updateMany({ + where: { scheduleId: args.data.schedule.connect?.id ?? '' }, + data: { + orderId: order.id, + }, + }) + // refetch order return await this.prisma.order.findUnique({ where: { id: order.id }, diff --git a/src/User/user.schema.ts b/src/User/user.schema.ts index 91b65ef..6841337 100644 --- a/src/User/user.schema.ts +++ b/src/User/user.schema.ts @@ -169,6 +169,9 @@ export class UserSchema extends PothosSchema { throw new Error('Not allowed') } let user = ctx.http.me as UserWithChatRooms + + console.log("hahahahahaha") + if (!user?.name) { throw new Error('User not found') } @@ -211,10 +214,12 @@ export class UserSchema extends PothosSchema { type: this.user(), args: this.builder.generator.findUniqueArgs('User'), resolve: async (query, _root, args) => { - return await this.prisma.user.findUniqueOrThrow({ + const user = await this.prisma.user.findUniqueOrThrow({ ...query, where: args.where, }) + + return user; }, }), userBySession: t.prismaField({