fix: 创建知识点时更新知识库 itemCount 计数
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 40s
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:
parent
846ba43f8f
commit
53a4cc118a
@ -12,7 +12,7 @@ export class KnowledgeItemsRepository {
|
|||||||
itemType?: string;
|
itemType?: string;
|
||||||
orderIndex?: number;
|
orderIndex?: number;
|
||||||
}) {
|
}) {
|
||||||
return this.prisma.knowledgeItem.create({
|
const item = await this.prisma.knowledgeItem.create({
|
||||||
data: {
|
data: {
|
||||||
userId,
|
userId,
|
||||||
knowledgeBaseId,
|
knowledgeBaseId,
|
||||||
@ -23,6 +23,14 @@ export class KnowledgeItemsRepository {
|
|||||||
orderIndex: dto.orderIndex ?? 0,
|
orderIndex: dto.orderIndex ?? 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 更新知识库 itemCount
|
||||||
|
await this.prisma.knowledgeBase.update({
|
||||||
|
where: { id: knowledgeBaseId },
|
||||||
|
data: { itemCount: { increment: 1 } },
|
||||||
|
});
|
||||||
|
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
async findById(id: string) {
|
async findById(id: string) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user