Skip to content

Conversation

geeknk
Copy link
Owner

@geeknk geeknk commented Dec 1, 2023

No description provided.

Copy link

@rahulexcel01 rahulexcel01 left a comment

Choose a reason for hiding this comment

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

complete these

await userServices.updateuser1(req.data.email , req.body);
res.status(201).send({success: "true", message: "user updated successfully" });
const resp = await userServices.updateuser1(req.data.email , req.body);
res.status(201).send({success: "true", message: "user updated successfully", resposne:resp });

Choose a reason for hiding this comment

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

const resposne= await userServices.updateuser1(req.data.email , req.body);
res.status(201).send({success: "true", message: "user updated successfully", resposne});

a better way

const updateuser1 = async (data, body_data) => {
await users.updateOne(data.email, body_data);
const updateuser1 = async (email, body_data) => {
await User.update(body_data,{where:{email:email}});

Choose a reason for hiding this comment

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

if key and value are same in the object you need not to write both
await User.update(body_data,{where:{email}});

password: data.password,
await User.update({password: data.password},
{
where:{email:email}

Choose a reason for hiding this comment

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

same as previous

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