forgot pass sign image footer api content etc

This commit is contained in:
pawan-dot 2024-02-07 10:09:40 +05:30
parent c999f1bf81
commit d6280b6808
8 changed files with 130 additions and 32 deletions

22
.env
View File

@ -1,15 +1,17 @@
# mongodb # mongodb
# DB_URL="mongodb+srv://Get-Sygnal:Doo1KHDIWWlSsTFW@cluster0.zom9mlq.mongodb.net/?retryWrites=true&w=majority" # DB_URL="mongodb+srv://smellica:Anjefef23dnsfjne@cluster0.c5gfqzm.mongodb.net/?retryWrites=true&w=majority"
DB_URL="mongodb+srv://Get-Sygnal:Doo1KHDIWWlSsTFW@cluster.zom9mlq.mongodb.net/test?ssl=true&sslValidate=true" # DB_URL="mongodb+srv://Get-Sygnal:Doo1KHDIWWlSsTFW@cluster.zom9mlq.mongodb.net/test?ssl=true&sslValidate=true"
PORT = 8000 DB_URL="mongodb+srv://smellica:Anjefef23dnsfjne@cluster0.c5gfqzm.mongodb.net/"
# //Anjefef23dnsfjne
PORT = 5000
JWT_SECRET = jdvnvjwrniwj4562jn6@1xsbfeh@wre4Njdf; JWT_SECRET = jdvnvjwrniwj4562jn6@1xsbfeh@wre4Njdf;
# // Get-Sygnal cloudinary credential # // smellica cloudinary credential
CLOUDINARY_NAME = "dne5rkqkt" CLOUDINARY_NAME = "dnmgivd1x"
CLOUDINARY_API_KEY = "335493365729323" CLOUDINARY_API_KEY = "877544192441588"
CLOUDINARY_API_SECRET = "uBPv-qUGSGBwVyUKya6tGZjrBSc" CLOUDINARY_API_SECRET = "9paejuSC-fY5b0WoaUuSFURSnvM"
# SEND_EMAIL_FROM="project.boloai@gmail.com" # SEND_EMAIL_FROM="project.boloai@gmail.com"
@ -20,15 +22,15 @@ CLOUDINARY_API_SECRET = "uBPv-qUGSGBwVyUKya6tGZjrBSc"
# SMPT_PORT="587" # SMPT_PORT="587"
# SMPT_MAIL="beameri.team@gmail.com" # SMPT_MAIL="beameri.team@gmail.com"
# SMPT_PASSWORD="xsmtpsib-a88c224860249a3f1e0765e0e3d119c1bf07ad21f2859318fbf50975deee1711-JrdPpfsvF6LwEn4A" # SMPT_PASSWORD="xsmtpsib-a88c224860249a3f1e0765e0e3d119c1bf07ad21f2859318fbf50975deee1711-JrdPpfsvF6LwEn4A"
SEND_EMAIL_FROM="admin@getsygnal.com" SEND_EMAIL_FROM="hello@smellika.com"
# Bolo Ai # Bolo Ai
SENDGRID_API_KEY="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" SENDGRID_API_KEY="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"
SMPT_HOST="smtp-relay.brevo.com" SMPT_HOST="smtp-relay.brevo.com"
SMPT_PORT="587" SMPT_PORT="587"
SMPT_MAIL=" admin@getsygnal.com" SMPT_MAIL="neonflake.enterprises@gmail.com"
SMPT_PASSWORD="j15Jb8UzhmMx07pN" SMPT_PASSWORD="ND5sgVnWtrpUFfTb"
# SMPT_PASSWORD="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" # SMPT_PASSWORD="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"
PAYPAL_CLIENT_ID="AemCjVuWswklp1sWUo4peCFg9eS4bofMsMR0RCrVRB2DifYR1IUSrWqtHpVmQlrVMKTI2cWZXLJAdYwn" PAYPAL_CLIENT_ID="AemCjVuWswklp1sWUo4peCFg9eS4bofMsMR0RCrVRB2DifYR1IUSrWqtHpVmQlrVMKTI2cWZXLJAdYwn"

View File

@ -19,13 +19,14 @@ const transporter = createTransport({
// }; // };
const sendEmail = async (options) => { const sendEmail = async (options) => {
console.log(options); // console.log(options);
await transporter.sendMail(options, function (error, info) { await transporter.sendMail(options, function (error, info) {
if (error) { if (error) {
console.log(error); console.log(error);
} else {
console.log("Email sent: " + info.response);
} }
// else {
// console.log("Email sent: " + info?.response);
// }
}); });
}; };
export default sendEmail; export default sendEmail;

View File

@ -1,4 +1,5 @@
import { PrivacyAndPolicy } from "./PrivacyPolicyModel.js"; import { PrivacyAndPolicy } from "./PrivacyPolicyModel.js";
import { Refundpolicy } from "./RefundModel.js";
import { Shipping } from "./ShippingModel.js"; import { Shipping } from "./ShippingModel.js";
import { TermsAndCondition } from "./TermsandConditonModel.js"; import { TermsAndCondition } from "./TermsandConditonModel.js";
@ -73,6 +74,61 @@ export const updateTermsAndConditions = async (req, res) => {
}); });
} }
}; };
//refund Policy
export const RefundPolicy = async (req, res) => {
try {
if (!req?.user) return res.status(400).json({ message: "please login !" });
// console.log(req?.user)
const { content } = req.body;
const findv = await Refundpolicy.findOne();
let refundPolicy;
if (findv) {
refundPolicy = await Refundpolicy.findOneAndUpdate(
{
addedBy: req.user._id,
},
{
Refundpolicy: content,
}
);
} else {
refundPolicy = await Refundpolicy.create({
addedBy: req.user._id,
Refundpolicy: content,
});
}
res.status(200).json({
success: true,
refundPolicy,
message: "updated successfully ",
});
} catch (error) {
res.status(500).json({
success: false,
message: error.message ? error.message : "Something went Wrong",
});
}
};
//
export const getRefundPolicy = async (req, res) => {
try {
const Refundpolicys = await Refundpolicy.find();
res.status(200).json({
success: true,
Refundpolicys,
message: "Found successfully ",
});
} catch (error) {
res.status(500).json({
success: false,
message: error.message ? error.message : "Something went Wrong",
});
}
};
// Privacy policy controller functions // Privacy policy controller functions

View File

@ -3,7 +3,9 @@ import {
AddPrivacyAndPolicy, AddPrivacyAndPolicy,
AddShipping, AddShipping,
AddTermsAndConditions, AddTermsAndConditions,
RefundPolicy,
getPrivacyPolicy, getPrivacyPolicy,
getRefundPolicy,
getShipping, getShipping,
getTermsAndCondition, getTermsAndCondition,
updatePrivacyPolicy, updatePrivacyPolicy,
@ -17,9 +19,7 @@ const router = express.Router();
router router
.route("/terms-and-conditions") .route("/terms-and-conditions")
.post(isAuthenticatedUser, authorizeRoles("admin"), AddTermsAndConditions); .post(isAuthenticatedUser, authorizeRoles("admin"), AddTermsAndConditions);
router router.route("/terms-and-conditions").get(getTermsAndCondition);
.route("/terms-and-conditions")
.get(getTermsAndCondition);
router router
.route("/terms-and-condition-update") .route("/terms-and-condition-update")
.patch( .patch(
@ -30,9 +30,7 @@ router
router router
.route("/privacy-and-policy") .route("/privacy-and-policy")
.post(isAuthenticatedUser, authorizeRoles("admin"), AddPrivacyAndPolicy); .post(isAuthenticatedUser, authorizeRoles("admin"), AddPrivacyAndPolicy);
router router.route("/privacy-and-policy").get(getPrivacyPolicy);
.route("/privacy-and-policy")
.get(getPrivacyPolicy);
router router
.route("/privacy-and-policy-update") .route("/privacy-and-policy-update")
.patch(isAuthenticatedUser, authorizeRoles("admin"), updatePrivacyPolicy); .patch(isAuthenticatedUser, authorizeRoles("admin"), updatePrivacyPolicy);
@ -40,11 +38,15 @@ router
router router
.route("/shipping-and-policy") .route("/shipping-and-policy")
.post(isAuthenticatedUser, authorizeRoles("admin"), AddShipping); .post(isAuthenticatedUser, authorizeRoles("admin"), AddShipping);
router router.route("/shipping-and-policy").get(getShipping);
.route("/shipping-and-policy")
.get(getShipping);
router router
.route("/shipping-and-policy-update") .route("/shipping-and-policy-update")
.patch(isAuthenticatedUser, authorizeRoles("admin"), updateShipping); .patch(isAuthenticatedUser, authorizeRoles("admin"), updateShipping);
//refund Policy
router.route("/refund-policy").get(getRefundPolicy);
router
.route("/refund-policy")
.patch(isAuthenticatedUser, authorizeRoles("admin"), RefundPolicy);
//
export default router; export default router;

View File

@ -0,0 +1,17 @@
import mongoose from "mongoose";
const { Schema, model } = mongoose;
const RefundpolicySchema = new Schema(
{
Refundpolicy: {
type: String,
},
addedBy: {
type: mongoose.Schema.ObjectId,
ref: "User",
required: true,
},
},
{ timestamps: true }
);
export const Refundpolicy = model("refund-policy", RefundpolicySchema);

View File

@ -24,7 +24,7 @@ export const createProduct = async (req, res) => {
const imagesLinks = []; const imagesLinks = [];
for (let i = 0; i < images.length; i++) { for (let i = 0; i < images.length; i++) {
const result = await cloudinary.v2.uploader.upload(images[i], { const result = await cloudinary.v2.uploader.upload(images[i], {
folder: "GetSygnal/product", folder: "smellica/product",
}); });
imagesLinks.push({ imagesLinks.push({
@ -54,9 +54,14 @@ export const createProduct = async (req, res) => {
//get All Product //get All Product
export const getAllProduct = async (req, res) => { export const getAllProduct = async (req, res) => {
try { try {
const product = await Product.find().sort({ const product = await Product.find()
createdAt: -1, .populate({
}); path: "category gst addedBy",
select: "name categoryName tax",
})
.sort({
createdAt: -1,
});
if (product) { if (product) {
return res.status(200).json({ return res.status(200).json({
success: true, success: true,
@ -73,7 +78,10 @@ export const getAllProduct = async (req, res) => {
//get One Product //get One Product
export const getOneProduct = async (req, res) => { export const getOneProduct = async (req, res) => {
try { try {
const product = await Product.findById(req.params.id); const product = await Product.findById(req.params.id).populate({
path: "category gst addedBy",
select: "name categoryName tax",
});
if (product) { if (product) {
return res.status(200).json({ return res.status(200).json({
success: true, success: true,
@ -112,7 +120,7 @@ export const updateProduct = async (req, res) => {
const result = await cloudinary.v2.uploader.upload( const result = await cloudinary.v2.uploader.upload(
newuploadImages[i].tempFilePath, newuploadImages[i].tempFilePath,
{ {
folder: "GetSygnal/product", folder: "smellica/product",
} }
); );

View File

@ -21,12 +21,24 @@ const productSchema = new Schema(
price: { price: {
type: Number, type: Number,
required: [true, "Please Enter product Price"], required: [true, "Please Enter product Price"],
maxLength: [8, "Price cannot exceed 8 characters"], maxLength: [8, "Price can not exceed 8 characters"],
}, },
category: { category: {
type: String, type: Schema.Types.ObjectId,
ref: "CategoryModel",
},
gst: {
type: Schema.Types.ObjectId,
ref: "Tax",
},
total_amount: {
type: Number,
required: true,
},
gst_amount: {
type: Number,
required: true,
}, },
image: [ image: [
{ {
public_id: { public_id: {

View File

@ -121,7 +121,7 @@ export const forgotPassword = async (req, res, next) => {
from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender from: `${process.env.SEND_EMAIL_FROM}`, // Change to your verified sender
subject: `Get Sygnal Password Recovery`, subject: `Smellika Password Recovery`,
html: `your new password is: <br/> <strong> ${passwords}</strong><br/><br/>If you have not requested this email then, please ignore it.`, html: `your new password is: <br/> <strong> ${passwords}</strong><br/><br/>If you have not requested this email then, please ignore it.`,
}); });