fix: 创建知识点时更新知识库 itemCount 计数
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 40s

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
wangdl 2026-05-27 22:38:34 +08:00
parent 846ba43f8f
commit 53a4cc118a

View File

@ -12,7 +12,7 @@ export class KnowledgeItemsRepository {
itemType?: string;
orderIndex?: number;
}) {
return this.prisma.knowledgeItem.create({
const item = await this.prisma.knowledgeItem.create({
data: {
userId,
knowledgeBaseId,
@ -23,6 +23,14 @@ export class KnowledgeItemsRepository {
orderIndex: dto.orderIndex ?? 0,
},
});
// 更新知识库 itemCount
await this.prisma.knowledgeBase.update({
where: { id: knowledgeBaseId },
data: { itemCount: { increment: 1 } },
});
return item;
}
async findById(id: string) {