feat(server): search docs by keywork from indexer (#12863)

#### PR Dependency Tree


* **PR #12867**
  * **PR #12863** 👈
    * **PR #12837**
    * **PR #12866**

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
This commit is contained in:
fengmk2
2025-06-20 17:48:30 +08:00
committed by GitHub
parent bebe4349a9
commit 62d74de810
7 changed files with 315 additions and 0 deletions
@@ -45,6 +45,10 @@ interface UserFilter {
withDisabled?: boolean;
}
export interface ItemWithUserId {
userId: string;
}
export type PublicUser = Pick<User, keyof typeof publicUserSelect>;
export type WorkspaceUser = Pick<User, keyof typeof workspaceUserSelect>;
export type { ConnectedAccount, User };
@@ -78,6 +82,19 @@ export class UserModel extends BaseModel {
});
}
async getPublicUsersMap<T extends ItemWithUserId>(
items: T[]
): Promise<Map<string, PublicUser>> {
const userIds: string[] = [];
for (const item of items) {
if (item.userId) {
userIds.push(item.userId);
}
}
const users = await this.getPublicUsers(userIds);
return new Map(users.map(user => [user.id, user]));
}
async getWorkspaceUser(id: string): Promise<WorkspaceUser | null> {
return this.db.user.findUnique({
select: workspaceUserSelect,