fix: 统一预约取消的工作流状态判断
This commit is contained in:
1 parent
549b488d51
commit
c00e188392
6 files changed
+17
-30
No files matched your search
@@ -180,7 +180,9 @@ export class CreateInquiryFormDto {
|
||||
@IsOptional() @IsString() offeringId?: string;
|
||||
@IsOptional() @IsIn(["inquiry", "booking", "quote-request"]) purpose?: string;
|
||||
@IsOptional() @IsIn(["brand", "offering"]) targetType?: string;
|
||||
@IsOptional() @IsIn(["create-inquiry", "create-booking", "create-quote"]) submissionAction?: string;
|
||||
@IsOptional()
|
||||
@IsIn(["create-inquiry", "create-booking", "create-quote"])
|
||||
submissionAction?: string;
|
||||
@IsArray() fieldsSnapshot!: unknown[];
|
||||
@IsOptional() @IsBoolean() isEnabled?: boolean;
|
||||
}
|
||||
@@ -190,7 +192,9 @@ export class UpdateInquiryFormDto {
|
||||
@IsOptional() @IsString() offeringId?: string;
|
||||
@IsOptional() @IsIn(["inquiry", "booking", "quote-request"]) purpose?: string;
|
||||
@IsOptional() @IsIn(["brand", "offering"]) targetType?: string;
|
||||
@IsOptional() @IsIn(["create-inquiry", "create-booking", "create-quote"]) submissionAction?: string;
|
||||
@IsOptional()
|
||||
@IsIn(["create-inquiry", "create-booking", "create-quote"])
|
||||
submissionAction?: string;
|
||||
@IsOptional() @IsArray() fieldsSnapshot?: unknown[];
|
||||
@IsOptional() @IsBoolean() isEnabled?: boolean;
|
||||
}
|
||||
@@ -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 },
|
||||
|
||||
@@ -126,10 +126,7 @@ export class TemplateWorkspaceService {
|
||||
data: {
|
||||
templateVersion: template.version,
|
||||
configSnapshot: template as unknown as Prisma.InputJsonValue,
|
||||
previousSnapshots: [
|
||||
...history,
|
||||
installation.configSnapshot,
|
||||
],
|
||||
previousSnapshots: [...history, installation.configSnapshot],
|
||||
},
|
||||
});
|
||||
return { installation: updated, addedModules, addedFields };
|
||||
|
||||
Reference in new issue
Block a user