import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Otp } from '../entity/otp.entity'; import { Repository } from 'typeorm'; @Injectable() export class OtpRepository { constructor( @InjectRepository(Otp) private readonly otpRepository: Repository, ) {} async save(otp: Otp) { return await this.otpRepository.save(otp); } async findByOtpId(otpId: string) { return await this.otpRepository.findOne({ where: { otp_id: otpId, }, }); } async update(id: number, otp: Otp) { return await this.otpRepository.update(id, otp); } }