Update: Models
This commit is contained in:
parent
70ca726122
commit
002f79851a
10 changed files with 55 additions and 71 deletions
18
app-backend/models/database/playlists.model.js
Normal file
18
app-backend/models/database/playlists.model.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
module.exports = mongoose => {
|
||||
let schema = mongoose.Schema({
|
||||
userId: String,
|
||||
videoIds: Array,
|
||||
name: String,
|
||||
isActive: Boolean
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
schema.method("toJSON", function() {
|
||||
const { __v, _id, ...object } = this.toObject();
|
||||
object.id = _id;
|
||||
return object;
|
||||
});
|
||||
|
||||
return mongoose.model("playlists", schema);
|
||||
};
|
||||
Reference in a new issue