register remaining part

This commit is contained in:
pawan-dot 2024-06-28 15:38:47 +05:30
parent aa66a6b792
commit ef3ddc6669

View File

@ -3,6 +3,8 @@
import crypto from 'crypto';
import Patient from './PatientModel.js'
import { sendOtp } from '../../Utils/sendEmail.js';
import validator from "validator";
export const register = async (req, res) => {
let { name, countryCode, mobileNumber } = req.body;
// Trim the country code and mobile number
@ -118,6 +120,13 @@ export const create1RegistrationDetails = async (req, res) => {
password,
confirmPassword,
} = req.body;
if (!email) return res.status(400).json({ message: 'Email is required' });
if (!password) return res.status(400).json({ message: 'Password is required' });
if (!confirmPassword) return res.status(400).json({ message: 'Confirm password is required' });
// Validate email format
if (!validator.isEmail(email)) {
return res.status(400).json({ message: 'Invalid email format' });
}
const patientId = req.cookies.patientId;
if (!patientId) {
return res.status(400).json({ message: 'Patient did not registered Or verified' });