fix: 统一预约取消的工作流状态判断
This commit is contained in:
1 parent
549b488d51
commit
c00e188392
6 files changed
+17
-30
No files matched your search
@@ -23,8 +23,7 @@ export function OverviewPage() {
|
||||
const retry = () => results.forEach((result) => void result.refetch());
|
||||
const brand = results[0].data;
|
||||
const workspace = results[1].data as
|
||||
| { inquiryForm?: { isEnabled?: boolean }; modules?: Array<{ isEnabled?: boolean }> }
|
||||
| undefined;
|
||||
{ inquiryForm?: { isEnabled?: boolean }; modules?: Array<{ isEnabled?: boolean }> } | undefined;
|
||||
const trust = results[2].data;
|
||||
const offerings = results[3].data as Array<{ isEnabled?: boolean }> | undefined;
|
||||
const submissions = results[4].data;
|
||||
|
||||
@@ -324,11 +324,11 @@ export function ServicesPage() {
|
||||
onOk={() => form.submit()}
|
||||
confirmLoading={save.isPending}
|
||||
>
|
||||
<Form
|
||||
form={form}
|
||||
layout="vertical"
|
||||
onFinish={(values) => save.mutate(values as Record<string, unknown>)}
|
||||
>
|
||||
<Form
|
||||
form={form}
|
||||
layout="vertical"
|
||||
onFinish={(values) => save.mutate(values as Record<string, unknown>)}
|
||||
>
|
||||
<Form.Item name="name" label="服务名称" rules={[{ required: true }]}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
|
||||
+2
-16
@@ -1,21 +1,7 @@
|
||||
import React, { Suspense, useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import {
|
||||
QueryClient,
|
||||
QueryClientProvider,
|
||||
} from "@tanstack/react-query";
|
||||
import {
|
||||
App,
|
||||
Button,
|
||||
Card,
|
||||
Form,
|
||||
Input,
|
||||
Layout,
|
||||
Menu,
|
||||
Space,
|
||||
Typography,
|
||||
message,
|
||||
} from "antd";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { App, Button, Card, Form, Input, Layout, Menu, Space, Typography, message } from "antd";
|
||||
import { createApiClient } from "./lib/api.js";
|
||||
const FeatureInquiriesPage = React.lazy(() =>
|
||||
import("./features/inquiries/InquiriesPage.js").then((module) => ({
|
||||
|
||||
@@ -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