UNPKG

authenzify

Version:

server to manage authentication authorization of users and more

56 lines (44 loc) 1.34 kB
import { verifyExistence } from '../util/util.js' const fnList = ['create', 'findOne', 'findOne', 'find', 'delete'] export class VerificationsService { #iDalVerificationsService constructor(iDalVerificationsService) { verifyExistence(iDalVerificationsService, fnList) this.#iDalVerificationsService = iDalVerificationsService } async createVerification(verificationDetails) { const now = new Date() const verification = await this.#iDalVerificationsService.create({ ...verificationDetails, createdAt: now, updatedAt: now, }) return verification } async findOne(filter) { const verification = await this.#iDalVerificationsService.findOne(filter) return verification } async findByUserId({ id, type, isDeleted }) { const verification = await this.#iDalVerificationsService.findOne({ id, type, isDeleted, }) return verification } async find(filter) { const verifications = await this.#iDalVerificationsService.find(filter) return verifications } async delete(id) { const verification = await this.#iDalVerificationsService.delete(id) return verification } async updateMany(updatePart, wherePart) { return await this.#iDalVerificationsService.updateMany( updatePart, wherePart, ) } }