History added + User tested
This commit is contained in:
parent
f774cf64bd
commit
4629b42b36
8 changed files with 197 additions and 107 deletions
15
backend/app/models/history.model.js
Normal file
15
backend/app/models/history.model.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
module.exports = mongoose => {
|
||||
let schema = mongoose.Schema({
|
||||
user: Object
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
schema.method("toJSON", function() {
|
||||
const { __v, _id, ...object } = this.toObject();
|
||||
object.id = _id;
|
||||
return object;
|
||||
});
|
||||
|
||||
return mongoose.model("history", schema);
|
||||
};
|
||||
|
|
@ -8,8 +8,8 @@ db.mongoose = mongoose;
|
|||
db.url = dbConfig.url;
|
||||
db.users = require("./user.model")(mongoose);
|
||||
db.playlists = require("./playlist.model")(mongoose);
|
||||
db.videos = require("./video.model")(mongoose);
|
||||
db.ads = require("./ad.model")(mongoose);
|
||||
db.images = require("./image.model")(mongoose);
|
||||
db.histories = require("./history.model")(mongoose);
|
||||
|
||||
|
||||
module.exports = db;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,11 @@ module.exports = mongoose => {
|
|||
type: Object,
|
||||
default: roles.User
|
||||
},
|
||||
playlists: []
|
||||
playlists: [],
|
||||
active: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
|
|
|||
Reference in a new issue