feat(server): add user existence check and optimize permission queries (#10402)

This commit is contained in:
fengmk2
2025-03-05 01:49:33 +00:00
parent b8ecfbdae6
commit 3d2c4fe007
4 changed files with 20 additions and 13 deletions

View File

@@ -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,