update commission

This commit is contained in:
2024-11-21 22:05:22 +07:00
parent 8c5d81d0aa
commit 8eec1bed55
11 changed files with 336 additions and 121 deletions

View File

@@ -51,6 +51,9 @@ export class OrderSchema extends PothosSchema {
type: 'DateTime',
description: 'The date and time the order was updated.',
}),
commission: t.exposeFloat('commission', {
description: 'The commission of the order.',
}),
user: t.relation('user', {
description: 'The user who made the order.',
}),
@@ -107,7 +110,7 @@ export class OrderSchema extends PothosSchema {
description: 'Create a new order.',
args: {
data: t.arg({
type: this.builder.generator.getCreateInput('Order', ['id', 'user', 'paymentId', 'payment', 'refundTicket', 'status', 'total', 'createdAt', 'updatedAt']),
type: this.builder.generator.getCreateInput('Order', ['id', 'user', 'paymentId', 'payment', 'refundTicket', 'status', 'total', 'createdAt', 'updatedAt', 'commission']),
required: true,
}),
},
@@ -146,6 +149,7 @@ export class OrderSchema extends PothosSchema {
userId: ctx.http.me?.id ?? '',
serviceId: service.id,
scheduleId: args.data.schedule.connect?.id ?? '',
commission: service.commission ?? 0.0,
},
})
// check if service is valid