Skip to content

Conversation

@geeknk
Copy link
Owner

@geeknk geeknk commented Nov 7, 2023

No description provided.

const bcrypt = require("bcryptjs");
const jwt = require("jsonwebtoken");
const {updateuser1,getdata,matchpass,modifyPass,verifyemail,userlogin,usersignup,user_list} = require("../services/userservices")
const {updateuser1,getdata,useraddress,matchpass,modifyPass,verifyemail,userlogin,usersignup,user_list} = require("../services/userservices")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use classes or object and keep everything inside it a lot of import like this doesn't look good

const userModel = require("./userModel");
const user = mongoose.Schema({
user_id:{
type:'ObjectId',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createdat and updated At field should be there

router.use('/updateuser',mid_register.checkAuth)
router.use('/get',mid_register.checkAuth)
router.use('/delete',mid_register.checkAuth)
router.use('/address',mid_register.checkAuth)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move middleware in separate file instead route

pin_code: data.pin_code,
phone: data.phone
});
if(user){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you checking user here ? you need to verify data


exports.checkAuth = async (req, res, next) => {
const bearerHeader = req.headers["authorization"];
if (typeof bearerHeader !== "undefined") {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improve else if conditions here doesn't look good here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants