feat: 增加行业模板注册与切换能力
This commit is contained in:
1 parent
3c7ce2a8fa
commit
5b831b6740
7 files changed
+18
-6
No files matched your search
@@ -2,7 +2,7 @@ import { IsArray, IsBoolean, IsIn, IsInt, IsOptional, IsString, Max, Min } from
|
||||
|
||||
export class UpdateBrandDto {
|
||||
@IsOptional() @IsString() name?: string;
|
||||
@IsOptional() @IsString() templateKey?: string;
|
||||
@IsOptional() @IsIn(["food", "personal"]) templateKey?: "food" | "personal";
|
||||
@IsOptional() @IsString() tagline?: string;
|
||||
@IsOptional() @IsString() description?: string;
|
||||
@IsOptional() @IsString() avatarUrl?: string;
|
||||
|
||||
@@ -107,10 +107,11 @@ test("admin can read and update brand and service configuration", async () => {
|
||||
const updatedBrand = await request("/admin/config/brand", {
|
||||
method: "PATCH",
|
||||
headers: { authorization: `Bearer ${adminToken}` },
|
||||
payload: { description: "集成测试品牌简介", contactPhone: "13800000000" },
|
||||
payload: { description: "集成测试品牌简介", contactPhone: "13800000000", templateKey: "personal" },
|
||||
});
|
||||
assert.equal(updatedBrand.statusCode, 200);
|
||||
assert.equal(JSON.parse(updatedBrand.body).description, "集成测试品牌简介");
|
||||
assert.equal(JSON.parse(updatedBrand.body).templateKey, "personal");
|
||||
|
||||
const updatedService = await request(`/admin/config/services/${serviceBefore.id}`, {
|
||||
method: "PATCH",
|
||||
@@ -121,7 +122,7 @@ test("admin can read and update brand and service configuration", async () => {
|
||||
assert.equal(JSON.parse(updatedService.body).priceText, "集成测试价格");
|
||||
assert.equal(JSON.parse(updatedService.body).sortOrder, 99);
|
||||
} finally {
|
||||
await prisma.brandProfile.update({ where: { id: brandId }, data: { description: brandBefore.description, contactPhone: brandBefore.contactPhone } });
|
||||
await prisma.brandProfile.update({ where: { id: brandId }, data: { description: brandBefore.description, contactPhone: brandBefore.contactPhone, templateKey: brandBefore.templateKey } });
|
||||
await prisma.service.update({ where: { id: serviceBefore.id }, data: { priceText: serviceBefore.priceText, sortOrder: serviceBefore.sortOrder } });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user