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);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const TEMPLATES = {
|
||||
food: { hero: '今天吃什么', heroSub: '现做家常饭', about: '品牌简介', description: '个人经营的家常小灶,套餐现做,也可预约小型聚餐和私厨定制。', primary: '预约套餐', secondary: '咨询私厨', timeLabel: '营业时间', time: '11:00—20:00', addressLabel: '摊位地址', address: '校园路社区便民点 12 号', noteLabel: '配送说明', note: '满 30 元周边配送,也可自取', serviceSub: '今日可订', first: '普通套餐', firstSub: '日常家常饭', second: '私厨服务', secondSub: '聚餐定制', available: '今日可订', unavailable: '暂不可订', empty: '暂无可订服务', bookingTitle: '预约套餐', requestType: 'package', modeLabel: '取餐方式', modeA: '自取', modeB: '配送', locationLabel: '配送地址', locationPlaceholder: '请输入配送地址', notePlaceholder: '口味、餐具或其他说明', submitNotice: '提交后由摊主人工确认,确认后再安排制作。', submitLabel: '提交预约' },
|
||||
personal: { hero: '个人品牌', heroSub: '把专业能力,变成值得信赖的体验', about: '关于我', description: '这里展示你的专业背景、工作方式与品牌理念。', primary: '查看服务', secondary: '发起咨询', timeLabel: '服务时间', time: '工作日 10:00—18:00', addressLabel: '所在位置', address: '线上 / 线下均可沟通', noteLabel: '合作说明', note: '提交需求后,我会尽快与你联系', serviceSub: '可咨询', first: '标准服务', firstSub: '清晰的服务方案', second: '定制合作', secondSub: '按需求沟通', available: '可咨询', unavailable: '暂不可用', empty: '暂无可咨询服务', bookingTitle: '合作咨询', requestType: 'package', modeLabel: '沟通方式', modeA: '线上沟通', modeB: '线下沟通', locationLabel: '沟通方式或地点', locationPlaceholder: '请输入会议方式、地点或链接', notePlaceholder: '请介绍你的需求、预算或期待结果', submitNotice: '提交后品牌方会与你确认需求、时间和合作方式。', submitLabel: '提交需求' },
|
||||
personal: { hero: '个人品牌', heroSub: '把专业能力,变成值得信赖的体验', about: '关于我', description: '这里展示你的专业背景、工作方式与品牌理念。', primary: '查看服务', secondary: '发起咨询', timeLabel: '服务时间', time: '工作日 10:00—18:00', addressLabel: '所在位置', address: '线上 / 线下均可沟通', noteLabel: '合作说明', note: '提交需求后,我会尽快与你联系', serviceSub: '可咨询', first: '标准服务', firstSub: '清晰的服务方案', second: '定制合作', secondSub: '按需求沟通', available: '可咨询', unavailable: '暂不可用', empty: '暂无可咨询服务', bookingTitle: '合作咨询', requestType: 'inquiry', modeLabel: '沟通方式', modeA: '线上沟通', modeB: '线下沟通', locationLabel: '沟通方式或地点', locationPlaceholder: '请输入会议方式、地点或链接', notePlaceholder: '请介绍你的需求、预算或期待结果', submitNotice: '提交后品牌方会与你确认需求、时间和合作方式。', submitLabel: '提交需求' },
|
||||
};
|
||||
function getTemplate(key) { return TEMPLATES[key] || TEMPLATES.personal; }
|
||||
module.exports = { getTemplate, TEMPLATES };
|
||||
@@ -1,5 +1,5 @@
|
||||
export type BookingStatus = "received" | "contacting" | "confirmed" | "completed" | "cancelled";
|
||||
export type BookingRequestType = "package" | "private_chef";
|
||||
export type BookingRequestType = "package" | "private_chef" | "inquiry";
|
||||
export type ContactPreference = "wechat" | "phone" | "none";
|
||||
export type FulfillmentType = "pickup" | "delivery";
|
||||
export type OrderStatus = BookingStatus;
|
||||
|
||||
Reference in new issue
Block a user