fix: 统一预约取消的工作流状态判断
This commit is contained in:
1 parent
549b488d51
commit
c00e188392
5 files changed
+12
-25
No files matched your search
@@ -23,8 +23,7 @@ export function OverviewPage() {
|
|||||||
const retry = () => results.forEach((result) => void result.refetch());
|
const retry = () => results.forEach((result) => void result.refetch());
|
||||||
const brand = results[0].data;
|
const brand = results[0].data;
|
||||||
const workspace = results[1].data as
|
const workspace = results[1].data as
|
||||||
| { inquiryForm?: { isEnabled?: boolean }; modules?: Array<{ isEnabled?: boolean }> }
|
{ inquiryForm?: { isEnabled?: boolean }; modules?: Array<{ isEnabled?: boolean }> } | undefined;
|
||||||
| undefined;
|
|
||||||
const trust = results[2].data;
|
const trust = results[2].data;
|
||||||
const offerings = results[3].data as Array<{ isEnabled?: boolean }> | undefined;
|
const offerings = results[3].data as Array<{ isEnabled?: boolean }> | undefined;
|
||||||
const submissions = results[4].data;
|
const submissions = results[4].data;
|
||||||
|
|||||||
+2
-16
@@ -1,21 +1,7 @@
|
|||||||
import React, { Suspense, useState } from "react";
|
import React, { Suspense, useState } from "react";
|
||||||
import { createRoot } from "react-dom/client";
|
import { createRoot } from "react-dom/client";
|
||||||
import {
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
QueryClient,
|
import { App, Button, Card, Form, Input, Layout, Menu, Space, Typography, message } from "antd";
|
||||||
QueryClientProvider,
|
|
||||||
} from "@tanstack/react-query";
|
|
||||||
import {
|
|
||||||
App,
|
|
||||||
Button,
|
|
||||||
Card,
|
|
||||||
Form,
|
|
||||||
Input,
|
|
||||||
Layout,
|
|
||||||
Menu,
|
|
||||||
Space,
|
|
||||||
Typography,
|
|
||||||
message,
|
|
||||||
} from "antd";
|
|
||||||
import { createApiClient } from "./lib/api.js";
|
import { createApiClient } from "./lib/api.js";
|
||||||
const FeatureInquiriesPage = React.lazy(() =>
|
const FeatureInquiriesPage = React.lazy(() =>
|
||||||
import("./features/inquiries/InquiriesPage.js").then((module) => ({
|
import("./features/inquiries/InquiriesPage.js").then((module) => ({
|
||||||
|
|||||||
@@ -180,7 +180,9 @@ export class CreateInquiryFormDto {
|
|||||||
@IsOptional() @IsString() offeringId?: string;
|
@IsOptional() @IsString() offeringId?: string;
|
||||||
@IsOptional() @IsIn(["inquiry", "booking", "quote-request"]) purpose?: string;
|
@IsOptional() @IsIn(["inquiry", "booking", "quote-request"]) purpose?: string;
|
||||||
@IsOptional() @IsIn(["brand", "offering"]) targetType?: 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[];
|
@IsArray() fieldsSnapshot!: unknown[];
|
||||||
@IsOptional() @IsBoolean() isEnabled?: boolean;
|
@IsOptional() @IsBoolean() isEnabled?: boolean;
|
||||||
}
|
}
|
||||||
@@ -190,7 +192,9 @@ export class UpdateInquiryFormDto {
|
|||||||
@IsOptional() @IsString() offeringId?: string;
|
@IsOptional() @IsString() offeringId?: string;
|
||||||
@IsOptional() @IsIn(["inquiry", "booking", "quote-request"]) purpose?: string;
|
@IsOptional() @IsIn(["inquiry", "booking", "quote-request"]) purpose?: string;
|
||||||
@IsOptional() @IsIn(["brand", "offering"]) targetType?: 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() @IsArray() fieldsSnapshot?: unknown[];
|
||||||
@IsOptional() @IsBoolean() isEnabled?: boolean;
|
@IsOptional() @IsBoolean() isEnabled?: boolean;
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,8 @@ export class BookingService {
|
|||||||
async cancelForCustomer(brandId: string, customerUserId: string, id: string) {
|
async cancelForCustomer(brandId: string, customerUserId: string, id: string) {
|
||||||
const booking = await this.prisma.booking.findFirst({ where: { id, brandId, customerUserId } });
|
const booking = await this.prisma.booking.findFirst({ where: { id, brandId, customerUserId } });
|
||||||
if (!booking) throw new NotFoundException("订单不存在");
|
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) => {
|
return this.prisma.$transaction(async (tx) => {
|
||||||
const updated = await tx.booking.update({
|
const updated = await tx.booking.update({
|
||||||
where: { id },
|
where: { id },
|
||||||
|
|||||||
@@ -126,10 +126,7 @@ export class TemplateWorkspaceService {
|
|||||||
data: {
|
data: {
|
||||||
templateVersion: template.version,
|
templateVersion: template.version,
|
||||||
configSnapshot: template as unknown as Prisma.InputJsonValue,
|
configSnapshot: template as unknown as Prisma.InputJsonValue,
|
||||||
previousSnapshots: [
|
previousSnapshots: [...history, installation.configSnapshot],
|
||||||
...history,
|
|
||||||
installation.configSnapshot,
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return { installation: updated, addedModules, addedFields };
|
return { installation: updated, addedModules, addedFields };
|
||||||
|
|||||||
Reference in new issue
Block a user