Remove tutorials & add auth manager
This commit is contained in:
parent
a748b93133
commit
e87c4bb146
9 changed files with 46 additions and 198 deletions
|
|
@ -6,7 +6,6 @@ mongoose.Promise = global.Promise;
|
|||
const db = {};
|
||||
db.mongoose = mongoose;
|
||||
db.url = dbConfig.url;
|
||||
db.tutorials = require("./tutorial.model")(mongoose);
|
||||
db.users = require("./user.model")(mongoose);
|
||||
|
||||
module.exports = db;
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
module.exports = mongoose => {
|
||||
let schema = mongoose.Schema({
|
||||
title: String,
|
||||
description: String,
|
||||
published: Boolean
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
schema.method("toJSON", function() {
|
||||
const { __v, _id, ...object } = this.toObject();
|
||||
object.id = _id;
|
||||
return object;
|
||||
});
|
||||
|
||||
return mongoose.model("tutorial", schema);
|
||||
};
|
||||
|
|
@ -3,7 +3,10 @@ module.exports = mongoose => {
|
|||
login: String,
|
||||
hashPass: String, // WARNING: We don't want to send back the hashPass
|
||||
mail: String,
|
||||
role: Object
|
||||
role: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
|
|
|||
Reference in a new issue