mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
feat(server): add user existence check and optimize permission queries (#10402)
This commit is contained in:
@@ -61,6 +61,13 @@ export class UserModel extends BaseModel {
|
||||
});
|
||||
}
|
||||
|
||||
async exists(id: string) {
|
||||
const count = await this.db.user.count({
|
||||
where: { id },
|
||||
});
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
async getPublicUser(id: string): Promise<PublicUser | null> {
|
||||
return this.db.user.findUnique({
|
||||
select: publicUserSelect,
|
||||
|
||||
Reference in New Issue
Block a user