first commit

This commit is contained in:
pawan-dot 2024-07-09 14:24:10 +05:30
parent e9c8880a0d
commit 93721e9a18
3 changed files with 43 additions and 8 deletions

18
.env
View File

@ -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 # pulseayur Data Connection
# 2DTLj4MH9OqkzBKJ
# cheminova2004
# WpWgxim7Hp1PM21m
# DB_URL="mongodb+srv://pulseayur:rEF9gYORzKavLeiy@cluster0.vi4tl1l.mongodb.net/" # DB_URL="mongodb+srv://pulseayur:rEF9gYORzKavLeiy@cluster0.vi4tl1l.mongodb.net/"
# DB_URL="mongodb://localhost:27017/smellica" # DB_URL="mongodb://localhost:27017/smellica"
PORT = 5000 PORT = 5000
# mongosh "mongodb+srv://cluster0.vi4tl1l.mongodb.net/" --apiVersion 1 --username pulseayur --password rEF9gYORzKavLeiy # 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 # pulseayur
# // AyurPulse cloudinary credential # // AyurPulse cloudinary credential
CLOUDINARY_NAME = "duqbmh63s" #
CLOUDINARY_API_KEY = "545993395349868" # duqbmh63s
CLOUDINARY_API_SECRET = "GqzugvVge61dCme8LBELOR2GlOE" CLOUDINARY_NAME = "dslvetard"
CLOUDINARY_API_KEY = "364448988434865"
CLOUDINARY_API_SECRET = "27fjHV-Ve6yPnBZ6KdFj1KzRulc"
WEBHOOK_SECRET_KEY="whsec_m9u7CFBCY1qWarhxq65CkII6egOBf20K" WEBHOOK_SECRET_KEY="whsec_m9u7CFBCY1qWarhxq65CkII6egOBf20K"
# rEF9gYORzKavLeiy # rEF9gYORzKavLeiy
# STRIPE_SECRET_KEY="sk_test_51OhPRdSG6gbAOwcEid1GavJ4FTD0ZuHVTferdvJwKal77RlMtFJGBzL5GjtL0ie8ZJztsGjUWi8DWrnw1pDdDRGS005Hk0ahql" # STRIPE_SECRET_KEY="sk_test_51OhPRdSG6gbAOwcEid1GavJ4FTD0ZuHVTferdvJwKal77RlMtFJGBzL5GjtL0ie8ZJztsGjUWi8DWrnw1pDdDRGS005Hk0ahql"
@ -26,7 +32,7 @@ RAZERPAY_SECRET_KEY="WFhHbXL7AlLIuull9kKjYiNA"
FRONTEND_URL="https://smellika.com" FRONTEND_URL="https://smellika.com"
SEND_EMAIL_FROM="pulseayur@gmail.com" SEND_EMAIL_FROM="cheminova2004@gmail.com"
#brevo send mail #brevo send mail
SMPT_HOST="smtp-relay.brevo.com" SMPT_HOST="smtp-relay.brevo.com"
SMPT_PORT="587" SMPT_PORT="587"

View File

@ -112,6 +112,12 @@ export const getAllPatient = async (req, res) => {
$regex: new RegExp(req.query.name), $regex: new RegExp(req.query.name),
$options: "i", $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?.category) obj.category = req.query.category;
if (req.query?.isVerified) if (req.query?.isVerified)
obj.isVerified = 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) => { export const create1RegistrationDetails = async (req, res) => {
const { const {
email, email,

View File

@ -1,7 +1,7 @@
import express from "express"; import express from "express";
const router = express.Router(); 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 { isAuthenticatedPatient } from "../../middlewares/PatientAuth.js";
import { authorizeRoles, isAuthenticatedUser } from "../../middlewares/auth.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-p1', isAuthenticatedPatient, create1RegistrationDetails);
router.post('/rgstr_details-p2', isAuthenticatedPatient, EnterPatientDetails); router.post('/rgstr_details-p2', isAuthenticatedPatient, EnterPatientDetails);
router.post('/rgstr_psrnl_details-p3', isAuthenticatedPatient, EnterPersonalDetails); router.post('/rgstr_psrnl_details-p3', isAuthenticatedPatient, EnterPersonalDetails);
//admin
router.get('/getAll', isAuthenticatedUser, authorizeRoles("admin"), getAllPatient); router.get('/getAll', isAuthenticatedUser, authorizeRoles("admin"), getAllPatient);
router.get('/getOne/:id', isAuthenticatedUser, authorizeRoles("admin"), getOnePatient);
router.get('/my-profile', isAuthenticatedPatient, getmyProfile); router.get('/my-profile', isAuthenticatedPatient, getmyProfile);
//Update Mobile Number //Update Mobile Number