From fef0a890ad5bb9c2e47bef81c3afafa8a780b2ce Mon Sep 17 00:00:00 2001 From: que01 Date: Wed, 23 Sep 2026 02:04:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=9D=E8=AF=81=E7=A4=BA=E4=BE=8B?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=AF=BC=E5=85=A5=E5=B9=82=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/src/admin-workspace.controller.ts | 5 ++++- apps/api/test/http.integration.test.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/api/src/admin-workspace.controller.ts b/apps/api/src/admin-workspace.controller.ts index de640bb..51d87d4 100644 --- a/apps/api/src/admin-workspace.controller.ts +++ b/apps/api/src/admin-workspace.controller.ts @@ -224,7 +224,10 @@ class AdminWorkspaceController { const existing = await this.prisma.brandFieldDefinition.count({ where: { brandId, source: "sample" }, }); - if (existing) throw new BadRequestException("示例内容已经导入"); + const existingOffering = await this.prisma.offering.count({ + where: { brandId, name: "序章·入户门" }, + }); + if (existing || existingOffering) throw new BadRequestException("示例内容已经导入"); const result = await this.prisma.$transaction(async (tx) => { const offerings = await tx.offering.createMany({ data: [ diff --git a/apps/api/test/http.integration.test.js b/apps/api/test/http.integration.test.js index 22bce87..1d00b5f 100644 --- a/apps/api/test/http.integration.test.js +++ b/apps/api/test/http.integration.test.js @@ -213,7 +213,7 @@ test("admin can preview and import sample content idempotently", async () => { await prisma.offering.deleteMany({ where: { brandId, - categoryKey: { in: ["entrance-door", "garden-door", "interior-door", "custom"] }, + name: { in: ["序章·入户门", "庭院·边界门", "室内·静谧门", "一对一门系统设计咨询"] }, }, }); await prisma.trustContent.deleteMany({