get users

This commit is contained in:
2018-06-01 13:40:12 +03:00
parent 9c7907f1e8
commit 21477e3ef1
3 changed files with 31 additions and 1 deletions

View File

@@ -32,6 +32,13 @@ UserSchema.methods.generateJwt = function () {
return jwt.sign({ id: this._id, username: this.username }, secret, { expiresIn: '6m' });
};
UserSchema.methods.toJson = function () {
return {
id: this._id,
username: this.username,
};
};
UserSchema.methods.toAuthJson = function () {
return {
id: this._id,