demo-deploy
This commit is contained in:
parent
8263b0a684
commit
9d23be1385
2
.env
2
.env
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
DB_URL="mongodb+srv://projectboloai:kNe1zksKjiIrnJjV@cluster0.r7lfhbq.mongodb.net/?retryWrites=true&w=majority"
|
DB_URL="mongodb+srv://projectboloai:kNe1zksKjiIrnJjV@cluster0.r7lfhbq.mongodb.net/?retryWrites=true&w=majority"
|
||||||
|
|
||||||
PORT = 5000
|
PORT = 8000
|
||||||
JWT_SECRET = jdvnvjwrniwj4562jn6@1xsbfeh@wre4Njdf;
|
JWT_SECRET = jdvnvjwrniwj4562jn6@1xsbfeh@wre4Njdf;
|
||||||
|
|
||||||
|
|
||||||
|
1666
package-lock.json
generated
1666
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -26,6 +26,7 @@
|
|||||||
"multer": "^1.4.5-lts.1",
|
"multer": "^1.4.5-lts.1",
|
||||||
"multer-storage-cloudinary": "^4.0.0",
|
"multer-storage-cloudinary": "^4.0.0",
|
||||||
"nodemailer": "^6.9.4",
|
"nodemailer": "^6.9.4",
|
||||||
|
"nodemon": "^3.0.1",
|
||||||
"secure-random-password": "^0.2.3",
|
"secure-random-password": "^0.2.3",
|
||||||
"validator": "^13.7.0"
|
"validator": "^13.7.0"
|
||||||
}
|
}
|
||||||
|
@ -10,12 +10,15 @@ import catchAsyncErrors from "../../middlewares/catchAsyncErrors.js";
|
|||||||
import sendToken from "../../Utils/jwtToken.js";
|
import sendToken from "../../Utils/jwtToken.js";
|
||||||
import ErrorHander from "../../Utils/errorhander.js";
|
import ErrorHander from "../../Utils/errorhander.js";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const createBusiness = async (req, res) => {
|
export const createBusiness = async (req, res) => {
|
||||||
try {
|
try {
|
||||||
if (!req?.user) return res.status(400).json({ message: "please login !" });
|
if (!req?.user) return res.status(400).json({ message: "please login !" });
|
||||||
|
|
||||||
const {
|
const {
|
||||||
business,
|
userType,
|
||||||
specialization,
|
specialization,
|
||||||
country,
|
country,
|
||||||
language,
|
language,
|
||||||
@ -24,7 +27,7 @@ export const createBusiness = async (req, res) => {
|
|||||||
address_Line_1,
|
address_Line_1,
|
||||||
address_Line_2,
|
address_Line_2,
|
||||||
pincode,
|
pincode,
|
||||||
business_name,
|
userName,
|
||||||
email,
|
email,
|
||||||
contact_Number,
|
contact_Number,
|
||||||
contact_Person_Name,
|
contact_Person_Name,
|
||||||
@ -33,10 +36,10 @@ export const createBusiness = async (req, res) => {
|
|||||||
} = req.body;
|
} = req.body;
|
||||||
//validation
|
//validation
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case !business:
|
case !userType:
|
||||||
return res.status(500).send({ error: "Business is Required" });
|
return res.status(500).send({ error: "Business is Required" });
|
||||||
case !language:
|
// case !language:
|
||||||
return res.status(500).send({ error: "Language is Required" });
|
// return res.status(500).send({ error: "Language is Required" });
|
||||||
case !address_Line_1:
|
case !address_Line_1:
|
||||||
return res.status(500).send({ error: "address_Line_1 is Required" });
|
return res.status(500).send({ error: "address_Line_1 is Required" });
|
||||||
case !address_Line_2:
|
case !address_Line_2:
|
||||||
@ -134,6 +137,22 @@ export const createBusiness = async (req, res) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const getAllBusiness = async (req, res) => {
|
export const getAllBusiness = async (req, res) => {
|
||||||
try {
|
try {
|
||||||
if (!req?.user) return res.status(400).json({ message: "please login !" });
|
if (!req?.user) return res.status(400).json({ message: "please login !" });
|
||||||
|
@ -10,16 +10,17 @@ const { Schema, model } = mongoose;
|
|||||||
|
|
||||||
const BusinessSchema = new Schema(
|
const BusinessSchema = new Schema(
|
||||||
{
|
{
|
||||||
business: { type: String, required: true },
|
userType: { type: String, required: true },
|
||||||
|
|
||||||
specialization: {
|
specialization: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
|
||||||
language: [{ type: Array, default: [], required: true }],
|
language: [{ type: Array, default: [] }],
|
||||||
//contacts
|
//contacts
|
||||||
business_name: {
|
userName: {
|
||||||
type: String,
|
type: String,
|
||||||
|
required:true
|
||||||
},
|
},
|
||||||
email: {
|
email: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -32,7 +33,7 @@ const BusinessSchema = new Schema(
|
|||||||
},
|
},
|
||||||
|
|
||||||
contact_Number: { type: Number, required: true },
|
contact_Number: { type: Number, required: true },
|
||||||
contact_Person_Name: { type: String, required: true },
|
contact_Person_Name: { type: String},
|
||||||
|
|
||||||
url: { type: String, default: "" },
|
url: { type: String, default: "" },
|
||||||
short_url: { type: String, default: "" },
|
short_url: { type: String, default: "" },
|
||||||
@ -50,7 +51,7 @@ const BusinessSchema = new Schema(
|
|||||||
added_by: {
|
added_by: {
|
||||||
type: mongoose.Schema.ObjectId,
|
type: mongoose.Schema.ObjectId,
|
||||||
ref: "User",
|
ref: "User",
|
||||||
required: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ timestamps: true }
|
{ timestamps: true }
|
||||||
|
@ -15,7 +15,7 @@ cloudinary.config({
|
|||||||
api_key: process.env.CLOUDINARY_API_KEY,
|
api_key: process.env.CLOUDINARY_API_KEY,
|
||||||
api_secret: process.env.CLOUDINARY_API_SECRET,
|
api_secret: process.env.CLOUDINARY_API_SECRET,
|
||||||
});
|
});
|
||||||
//<---------deployement------------->
|
//<---------deployement------------->``
|
||||||
// const data_dir = path.resolve();
|
// const data_dir = path.resolve();
|
||||||
|
|
||||||
// if (process.env.NODE_ENV === "production") {
|
// if (process.env.NODE_ENV === "production") {
|
||||||
|
Loading…
Reference in New Issue
Block a user