feat(server): add batchMoveTopics TRPC mutation

Expose TopicModel.batchMoveToAgent through a new topic.batchMoveTopics
lambda mutation (topic:update scoped permission, input { topicIds,
targetAgentId }) and add the matching topicService.batchMoveTopics client
wrapper.

Depends on the database layer (TopicModel.batchMoveToAgent).
Part of LOBE-10330

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Arvin Xu
2026-06-14 02:08:21 +08:00
parent 583eb84b54
commit 0c571580ab
2 changed files with 16 additions and 0 deletions
+12
View File
@@ -162,6 +162,18 @@ export const topicRouter = router({
return ctx.topicModel.batchDeleteBySessionId(resolved.sessionId);
}),
batchMoveTopics: topicProcedure
.use(withScopedPermission('topic:update'))
.input(
z.object({
targetAgentId: z.string(),
topicIds: z.array(z.string()),
}),
)
.mutation(async ({ input, ctx }) => {
return ctx.topicModel.batchMoveToAgent(input.topicIds, input.targetAgentId);
}),
cloneTopic: topicProcedure
.use(withScopedPermission('topic:create'))
.input(z.object({ id: z.string(), newTitle: z.string().optional() }))
+4
View File
@@ -32,6 +32,10 @@ export class TopicService {
return lambdaClient.topic.cloneTopic.mutate({ id, newTitle });
};
batchMoveTopics = (topicIds: string[], targetAgentId: string) => {
return lambdaClient.topic.batchMoveTopics.mutate({ targetAgentId, topicIds });
};
importTopic = (params: {
agentId: string;
data: string;