From 7451268e591fe23ff801c02fbe35281c8a30ec42 Mon Sep 17 00:00:00 2001 From: que01 Date: Wed, 23 Sep 2026 02:14:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=93=81=E7=89=8C=E4=B8=8A=E4=B8=8B=E6=96=87=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E8=83=BD=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/src/admin-workspace.controller.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/api/src/admin-workspace.controller.ts b/apps/api/src/admin-workspace.controller.ts index 51d87d4..64409ba 100644 --- a/apps/api/src/admin-workspace.controller.ts +++ b/apps/api/src/admin-workspace.controller.ts @@ -171,13 +171,12 @@ class AdminWorkspaceController { @Body() body: InstallTemplateDto, ): Promise { this.requireAdmin(request); - return this.templateWorkspace.install(this.brandId(), body.templateKey); + return this.templateWorkspace.install(this.requireAdmin(request).brandId, body.templateKey); } @Get("capabilities") async listCapabilities(@Req() request: FastifyRequest): Promise { - this.requireAdmin(request); - const brandId = this.brandId(); + const brandId = this.requireAdmin(request).brandId; const [brand, installations] = await Promise.all([ this.prisma.brandProfile.findUnique({ where: { id: brandId }, @@ -203,8 +202,7 @@ class AdminWorkspaceController { @Get("sample-content/preview") async previewSampleContent(@Req() request: FastifyRequest): Promise { - this.requireAdmin(request); - const brandId = this.brandId(); + const brandId = this.requireAdmin(request).brandId; const [offerings, trustContent, fields] = await Promise.all([ this.prisma.offering.count({ where: { brandId } }), this.prisma.trustContent.count({ where: { brandId } }), @@ -220,7 +218,7 @@ class AdminWorkspaceController { @Post("sample-content/import") async importSampleContent(@Req() request: FastifyRequest): Promise { const identity = this.requireAdmin(request); - const brandId = this.brandId(); + const brandId = identity.brandId; const existing = await this.prisma.brandFieldDefinition.count({ where: { brandId, source: "sample" }, }); @@ -296,7 +294,7 @@ class AdminWorkspaceController { @Body() body: UpdateCapabilityInstallationDto, ): Promise { const identity = this.requireAdmin(request); - const brandId = this.brandId(); + const brandId = identity.brandId; const brand = await this.prisma.brandProfile.findUnique({ where: { id: brandId } }); const template = getBrandTemplate(brand?.templateKey ?? "personal"); if (!template?.capabilities.includes(key as never) && !(key in capabilityPlugins))