feat(server): add public user type (#10006)

This commit is contained in:
liuyi
2025-02-07 12:03:59 +08:00
committed by GitHub
parent e68bdbde3e
commit 00b1f01f9b
5 changed files with 60 additions and 15 deletions

View File

@@ -59,6 +59,13 @@ export class UserModel extends BaseModel {
});
}
async getPublicUsers(ids: string[]): Promise<PublicUser[]> {
return this.db.user.findMany({
select: publicUserSelect,
where: { id: { in: ids } },
});
}
async getUserByEmail(email: string): Promise<User | null> {
const rows = await this.db.$queryRaw<User[]>`
SELECT id, name, email, password, registered, email_verified as emailVerifiedAt, avatar_url as avatarUrl, registered, created_at as createdAt