This repository has been archived on 2026-05-01. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
PolyNotFound/backend/app/models/user.model.js
2021-10-29 23:54:19 +02:00

18 lines
425 B
JavaScript

module.exports = mongoose => {
let schema = mongoose.Schema({
login: String,
hashPass: String, // WARNING: We don't want to send back the hashPass
mail: String,
role: Object
},
{ timestamps: true }
);
schema.method("toJSON", function() {
const { __v, _id, ...object } = this.toObject();
object.id = _id;
return object;
});
return mongoose.model("user", schema);
};