diff --git a/src/database/repository/KeystoreRepo.ts b/src/database/repository/KeystoreRepo.ts index 056b905..a9262e7 100755 --- a/src/database/repository/KeystoreRepo.ts +++ b/src/database/repository/KeystoreRepo.ts @@ -4,7 +4,7 @@ import User from '../model/User'; export default class KeystoreRepo { public static findforKey(client: User, key: string): Promise { - return KeystoreModel.findOne({ client: client, primaryKey: key, status: true }).exec(); + return KeystoreModel.find({ client: client, primaryKey: key, status: true }).exec(); } public static remove(id: Types.ObjectId): Promise { diff --git a/src/helpers/asyncHandler.ts b/src/helpers/asyncHandler.ts index 2843632..0367464 100644 --- a/src/helpers/asyncHandler.ts +++ b/src/helpers/asyncHandler.ts @@ -1,7 +1,7 @@ import { Request, Response, NextFunction } from 'express'; -type AsyncFunction = (req: Request, res: Response, next: NextFunction) => Promise; +type AsyncFunction = (req: T, res: Response, next: NextFunction) => Promise; -export default (execution: AsyncFunction) => (req: Request, res: Response, next: NextFunction) => { +export default (execution: AsyncFunction) => (req: Request, res: Response, next: NextFunction) => { execution(req, res, next).catch(next); };