fix: 统一预约取消的工作流状态判断

This commit is contained in:
que01 committed 2026-09-21 15:36:46 +08:00
1 parent 549b488d51
commit c00e188392
6 files changed
+17 -30

No files matched your search

+2 -1
View File
@@ -123,7 +123,8 @@ export class BookingService {
async cancelForCustomer(brandId: string, customerUserId: string, id: string) {
const booking = await this.prisma.booking.findFirst({ where: { id, brandId, customerUserId } });
if (!booking) throw new NotFoundException("订单不存在");
if (booking.status !== "received") throw new BadRequestException("当前状态不可取消");
if (!canTransitionBasicBooking(booking.currentState, "cancelled"))
throw new BadRequestException("当前状态不可取消");
return this.prisma.$transaction(async (tx) => {
const updated = await tx.booking.update({
where: { id },