| 579 | * @return {Promise<{Object}|{Object}>} |
| 580 | * @throws {Error} - If error occurs while fetching user's image verification entry |
| 581 | */ |
| 582 | const getUserImageForVerification = async (userId) => { |
| 583 | try { |
| 584 | const verificationImagesSnapshot = await photoVerificationModel.where("userId", "==", userId).get(); |
| 585 | if (verificationImagesSnapshot.empty) { |
| 586 | throw new Error(`No document with userId: ${userId} was found!`); |
| 587 | } |
| 588 | return verificationImagesSnapshot.docs[0].data(); |
| 589 | } catch (err) { |
| 590 | logger.error("Error while Removing Verification Entry", err); |
| 591 | throw err; |