Skip to content

Feat : add login API(#40014)#19

Merged
mohit-nx merged 13 commits intodevelopfrom
feature/40014
Mar 1, 2020
Merged

Feat : add login API(#40014)#19
mohit-nx merged 13 commits intodevelopfrom
feature/40014

Conversation

@rvchauhan
Copy link
Copy Markdown
Owner

No description provided.

@mohit-nx
Copy link
Copy Markdown
Collaborator

take latest pull

.env Outdated
NODE_ENV=dev
SECRET_KEY = qwertyuiopasdfghjklzxcvbnm123456
MONGO_URL=mongodb://localhost:27017/express-training
password= trainee@123 No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

remove .env from git

in: ['body'],
errorMessage: 'DOB is required',
},
email: {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why have you removed validation for email while creating user?

};
findOne(query): mongoose.Query<D> {
return this.modelType.findOne(query);
async findOne(id: string) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

cannot find by email like this in version repository. Versioning repository is common to all. cannot update it.

}
return await this.modelType.update(_id, deleteddata);
async delete(id) {
return await this.modelType.update(id, { deletedAt: new Date() });
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

it should be {originalId: id}

...data,
updatedAt: new Date()
})
return this.modelType.updateOne(id, { updatedBy: id, deletedBy: id, deletedAt: new Date() });
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why doing is when we have already invalidated the object.

});
public async update(id, data) {
let record = await this.findOne(id);
this.delete(id);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

need to make operations syncronous

console.log("::::::::::", Password)
return await bcrypt.hash(Password, 10)
}
const ecncryptPassword = await encodedPassword(config.Password)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

encodedPAssword is a helper and used at mutliple place. Define it as a helper function instead of defining at every location.

@mohit-nx mohit-nx merged commit 5c3c3c9 into develop Mar 1, 2020
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