From 93721e9a185a8be5d0458e1e80ab49c50ddaf269 Mon Sep 17 00:00:00 2001 From: pawan-dot <71133473+pawan-dot@users.noreply.github.com> Date: Tue, 9 Jul 2024 14:24:10 +0530 Subject: [PATCH] first commit --- .env | 18 ++++++++++------ resources/Patients/PatientController.js | 28 +++++++++++++++++++++++++ resources/Patients/PatientRoute.js | 5 +++-- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/.env b/.env index 974e60c..037dd77 100644 --- a/.env +++ b/.env @@ -1,20 +1,26 @@ - DB_URL="mongodb+srv://pulseayur:rEF9gYORzKavLeiy@cluster0.vi4tl1l.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0" +# DB_URL="mongodb+srv://pulseayur:rEF9gYORzKavLeiy@cluster0.vi4tl1l.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0" + DB_URL="mongodb+srv://cheminova2004:WpWgxim7Hp1PM21m@cluster0.nkjbzgd.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0" # pulseayur Data Connection +# 2DTLj4MH9OqkzBKJ +# cheminova2004 +# WpWgxim7Hp1PM21m # DB_URL="mongodb+srv://pulseayur:rEF9gYORzKavLeiy@cluster0.vi4tl1l.mongodb.net/" # DB_URL="mongodb://localhost:27017/smellica" PORT = 5000 # mongosh "mongodb+srv://cluster0.vi4tl1l.mongodb.net/" --apiVersion 1 --username pulseayur --password rEF9gYORzKavLeiy -JWT_SECRET = jdvnvjwrniwj4562ddsjn6@1xsbfeh@wre4Njdfeefr3; +JWT_SECRET = jdvnvjwrniwj4562ddsjn6@1xsbf85df@!fgrjjeh@wre4Njdfeefr3; # pulseayur # // AyurPulse cloudinary credential -CLOUDINARY_NAME = "duqbmh63s" -CLOUDINARY_API_KEY = "545993395349868" -CLOUDINARY_API_SECRET = "GqzugvVge61dCme8LBELOR2GlOE" +# +# duqbmh63s +CLOUDINARY_NAME = "dslvetard" +CLOUDINARY_API_KEY = "364448988434865" +CLOUDINARY_API_SECRET = "27fjHV-Ve6yPnBZ6KdFj1KzRulc" WEBHOOK_SECRET_KEY="whsec_m9u7CFBCY1qWarhxq65CkII6egOBf20K" # rEF9gYORzKavLeiy # STRIPE_SECRET_KEY="sk_test_51OhPRdSG6gbAOwcEid1GavJ4FTD0ZuHVTferdvJwKal77RlMtFJGBzL5GjtL0ie8ZJztsGjUWi8DWrnw1pDdDRGS005Hk0ahql" @@ -26,7 +32,7 @@ RAZERPAY_SECRET_KEY="WFhHbXL7AlLIuull9kKjYiNA" FRONTEND_URL="https://smellika.com" -SEND_EMAIL_FROM="pulseayur@gmail.com" +SEND_EMAIL_FROM="cheminova2004@gmail.com" #brevo send mail SMPT_HOST="smtp-relay.brevo.com" SMPT_PORT="587" diff --git a/resources/Patients/PatientController.js b/resources/Patients/PatientController.js index 11f65e3..66b3567 100644 --- a/resources/Patients/PatientController.js +++ b/resources/Patients/PatientController.js @@ -112,6 +112,12 @@ export const getAllPatient = async (req, res) => { $regex: new RegExp(req.query.name), $options: "i", }; + if (req.query?.mobileNumber) + obj.mobileNumber = { + $regex: new RegExp(req.query.mobileNumber), + $options: "i", + }; + if (req.query?.category) obj.category = req.query.category; if (req.query?.isVerified) obj.isVerified = req.query.isVerified; @@ -146,6 +152,28 @@ export const getAllPatient = async (req, res) => { }; +export const getOnePatient = async (req, res) => { + try { + if (!req.paras.id) { + return res.status(400).json({ message: "Please provide patient ID" }); + } + const data = await Patient.findById(req.paras.id); + if (data) { + return res.status(200).json({ + success: true, + message: "feched!", + data, + }); + } + } catch (error) { + return res.status(500).json({ + success: false, + message: error.message ? error.message : "Something went wrong!", + }); + } +} + + export const create1RegistrationDetails = async (req, res) => { const { email, diff --git a/resources/Patients/PatientRoute.js b/resources/Patients/PatientRoute.js index 4f17f89..f76d188 100644 --- a/resources/Patients/PatientRoute.js +++ b/resources/Patients/PatientRoute.js @@ -1,7 +1,7 @@ import express from "express"; const router = express.Router(); -import { EnterPatientDetails, EnterPersonalDetails, Otp, UploadProfileImage, create1RegistrationDetails, deletePatient, forgotPassword, getAllPatient, loginPatient, register, updateMobileNumber, verifyUpdatedMobileOtp, verifyOtp, UpdateProile, getmyProfile, ChangePassword } from "./PatientController.js"; +import { EnterPatientDetails, EnterPersonalDetails, Otp, UploadProfileImage, create1RegistrationDetails, deletePatient, forgotPassword, getAllPatient, loginPatient, register, updateMobileNumber, verifyUpdatedMobileOtp, verifyOtp, UpdateProile, getmyProfile, ChangePassword, getOnePatient } from "./PatientController.js"; import { isAuthenticatedPatient } from "../../middlewares/PatientAuth.js"; import { authorizeRoles, isAuthenticatedUser } from "../../middlewares/auth.js"; @@ -14,8 +14,9 @@ router.post('/login', loginPatient); router.post('/rgstr_details-p1', isAuthenticatedPatient, create1RegistrationDetails); router.post('/rgstr_details-p2', isAuthenticatedPatient, EnterPatientDetails); router.post('/rgstr_psrnl_details-p3', isAuthenticatedPatient, EnterPersonalDetails); - +//admin router.get('/getAll', isAuthenticatedUser, authorizeRoles("admin"), getAllPatient); +router.get('/getOne/:id', isAuthenticatedUser, authorizeRoles("admin"), getOnePatient); router.get('/my-profile', isAuthenticatedPatient, getmyProfile); //Update Mobile Number