Skip to content

Commit

Permalink
chore: update utility functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunny-unik committed Dec 12, 2023
1 parent 7109ecb commit 0acd0b7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/controllers/userController.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import SendMail from '../services/mailer.js';
import SendMail from '../utils/mailer.js';
import userSchema from '../models/userSchema.js';
import bcrypt from 'bcrypt';
import jwt from 'jsonwebtoken';
import otpHelper from '../helper/otpHelper.js';
import { getOtp } from '../utils/helpers.js';

export default class UserController {
static async getUsers(query) {
Expand Down Expand Up @@ -43,7 +43,7 @@ export default class UserController {

static async verifyMailAddress(body) {
let result = {};
const otp = otpHelper.getOtp();
const otp = getOtp();
const userData = { ...body, otp };
await SendMail(
process.env.APP_ID,
Expand Down
8 changes: 0 additions & 8 deletions src/helper/otpHelper.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/utils/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const getOtp = () => {
const otp = Math.floor(Math.random() * 1000000).toString();
return +(otp.length < 6 ? otp + Math.floor(Math.random() * 10) : otp);
};

const matchOtp = async () => {};

export { getOtp, matchOtp };
File renamed without changes.

0 comments on commit 0acd0b7

Please sign in to comment.