feat: 增加通用品牌咨询记录类型
This commit is contained in:
1 parent
0228112846
commit
8d93f34260
7 files changed
+27
-4
No files matched your search
@@ -0,0 +1 @@
|
||||
ALTER TYPE "BookingRequestType" ADD VALUE 'inquiry';
|
||||
@@ -18,6 +18,7 @@ enum BookingStatus {
|
||||
enum BookingRequestType {
|
||||
package
|
||||
private_chef
|
||||
inquiry
|
||||
}
|
||||
|
||||
enum ContactPreference {
|
||||
|
||||
@@ -17,7 +17,7 @@ export class BookingItemDto {
|
||||
}
|
||||
|
||||
export class CreateBookingDto {
|
||||
@IsIn(["package", "private_chef"]) requestType!: "package" | "private_chef";
|
||||
@IsIn(["package", "private_chef", "inquiry"]) requestType!: "package" | "private_chef" | "inquiry";
|
||||
@IsString() customerName!: string;
|
||||
@IsOptional() @IsString() phone?: string;
|
||||
@IsOptional() @IsString() wechatId?: string;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { BookingStatus, Prisma } from "@prisma/client";
|
||||
import { PrismaService } from "./prisma.service.js";
|
||||
|
||||
export interface CreateBookingInput {
|
||||
requestType: "package" | "private_chef";
|
||||
requestType: "package" | "private_chef" | "inquiry";
|
||||
customerName: string;
|
||||
phone?: string;
|
||||
wechatId?: string;
|
||||
|
||||
@@ -152,6 +152,27 @@ test("customer booking DTO rejects incomplete package requests", async () => {
|
||||
assert.equal(JSON.parse(response.body).error.code, "HTTP_400");
|
||||
});
|
||||
|
||||
test("customer can create a generic inquiry without food-specific fields", async () => {
|
||||
const response = await request("/customer/bookings", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${customerToken}` },
|
||||
payload: {
|
||||
requestType: "inquiry",
|
||||
customerName: "个人品牌咨询客户",
|
||||
wechatId: "inquiry-wechat",
|
||||
contactPreference: "wechat",
|
||||
requestedTime: "下周三 14:00",
|
||||
note: "希望讨论品牌合作方案",
|
||||
},
|
||||
});
|
||||
assert.equal(response.statusCode, 201);
|
||||
const body = JSON.parse(response.body);
|
||||
const booking = await prisma.booking.findUnique({ where: { bookingNo: body.bookingNo } });
|
||||
assert.ok(booking);
|
||||
assert.equal(booking.requestType, "inquiry");
|
||||
createdBookingIds.push(booking.id);
|
||||
});
|
||||
|
||||
test("customer can create and cancel a package booking", async () => {
|
||||
const service = await prisma.service.findFirst({ where: { brandId, isEnabled: true, priceAmount: { not: null } } });
|
||||
assert.ok(service);
|
||||
|
||||
Reference in new issue
Block a user