update order id

This commit is contained in:
unclebonn
2024-11-19 16:09:56 +07:00
parent 208ae897ef
commit 9a134645a7
2 changed files with 15 additions and 1 deletions

View File

@@ -228,6 +228,15 @@ export class OrderSchema extends PothosSchema {
paymentCode: paymentData.paymentLinkId, 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 // refetch order
return await this.prisma.order.findUnique({ return await this.prisma.order.findUnique({
where: { id: order.id }, where: { id: order.id },

View File

@@ -169,6 +169,9 @@ export class UserSchema extends PothosSchema {
throw new Error('Not allowed') throw new Error('Not allowed')
} }
let user = ctx.http.me as UserWithChatRooms let user = ctx.http.me as UserWithChatRooms
console.log("hahahahahaha")
if (!user?.name) { if (!user?.name) {
throw new Error('User not found') throw new Error('User not found')
} }
@@ -211,10 +214,12 @@ export class UserSchema extends PothosSchema {
type: this.user(), type: this.user(),
args: this.builder.generator.findUniqueArgs('User'), args: this.builder.generator.findUniqueArgs('User'),
resolve: async (query, _root, args) => { resolve: async (query, _root, args) => {
return await this.prisma.user.findUniqueOrThrow({ const user = await this.prisma.user.findUniqueOrThrow({
...query, ...query,
where: args.where, where: args.where,
}) })
return user;
}, },
}), }),
userBySession: t.prismaField({ userBySession: t.prismaField({