refactor: 将数据库访问从控制器下沉到服务层

This commit is contained in:
que01 committed 2026-10-14 17:53:49 +08:00
1 parent f158f906d5
commit 3ae7b462f5
21 files changed
+1046 -857

No files matched your search

@@ -61,6 +61,20 @@ export class TemplateWorkspaceService {
},
});
}
listTrustContent(brandId: string) {
return this.prisma.trustContent.findMany({
where: { brandId },
orderBy: [{ type: "asc" }, { sortOrder: "asc" }],
});
}
async deleteTrustContent(brandId: string, id: string) {
const item = await this.prisma.trustContent.findFirst({ where: { id, brandId } });
if (!item) throw new BadRequestException("信任内容不存在");
await this.prisma.trustContent.delete({ where: { id } });
return { deleted: true };
}
async getEffectiveTemplateKey(brandId: string): Promise<BrandTemplateKey> {
const [brand, installation] = await Promise.all([
this.prisma.brandProfile.findUnique({