Update
This commit is contained in:
parent
4dfd8cd516
commit
5a64568824
22 changed files with 702 additions and 194 deletions
17
backend/app/models/tutorial.model.js
Normal file
17
backend/app/models/tutorial.model.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
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);
|
||||
};
|
||||
Reference in a new issue