feat: 增加动态咨询表单配置接口

This commit is contained in:
que01 committed 2026-09-20 09:37:40 +08:00
1 parent 46c3e5504e
commit 32d3db90de
4 files changed
+124

No files matched your search

+29
View File
@@ -132,6 +132,35 @@ test("admin can customize workspace modules and fields with brand isolation", as
}
});
test("admin can create and version an inquiry form", async () => {
const login = await request("/admin/session/login", {
method: "POST",
payload: { username: "admin", password: process.env.SEED_ADMIN_PASSWORD },
});
const token = JSON.parse(login.body).token;
const created = await request("/admin/workspace/forms", {
method: "POST",
headers: { authorization: `Bearer ${token}` },
payload: {
name: "品牌合作咨询",
fieldsSnapshot: [{ key: "project", type: "textarea", label: "项目背景", required: true }],
},
});
assert.equal(created.statusCode, 201);
const id = JSON.parse(created.body).id;
try {
const updated = await request(`/admin/workspace/forms/${id}`, {
method: "PATCH",
headers: { authorization: `Bearer ${token}` },
payload: { fieldsSnapshot: [{ key: "budget", type: "number", label: "预算" }] },
});
assert.equal(updated.statusCode, 200);
assert.equal(JSON.parse(updated.body).version, 2);
} finally {
await prisma.inquiryForm.delete({ where: { id } });
}
});
test("admin can manage offerings and public endpoint hides disabled offerings", async () => {
const login = await request("/admin/session/login", {
method: "POST",