fix: 统一预约取消的工作流状态判断
This commit is contained in:
1 parent
549b488d51
commit
c00e188392
6 files changed
+17
-30
No files matched your search
@@ -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 },
|
||||
|
||||
Reference in new issue
Block a user