From 74cc9522c21e53eb57f2a18347d01247eaedb637 Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 10 Nov 2021 10:27:05 +0100 Subject: [PATCH] Added method to find User with their email & find User with a PubKey Buffer. --- backend/src/typeorm/repository/User.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/src/typeorm/repository/User.ts b/backend/src/typeorm/repository/User.ts index 441c1b2c8..e127c179c 100644 --- a/backend/src/typeorm/repository/User.ts +++ b/backend/src/typeorm/repository/User.ts @@ -9,6 +9,15 @@ export class UserRepository extends Repository { .getOneOrFail() } + async findByPubkeyHexBuffer(pubkeyHexBuffer: Buffer): Promise { + const pubKeyString = pubkeyHexBuffer.toString('hex') + return await this.findByPubkeyHex(pubKeyString) + } + + async findByEmail(email: string): Promise { + return this.createQueryBuilder('user').where('user.email = :email', { email }).getOneOrFail() + } + async getUsersIndiced(userIds: number[]): Promise { if (!userIds.length) return [] const users = await this.createQueryBuilder('user')