Create: Backend branch
This commit is contained in:
parent
f91febf919
commit
76ac0c292c
260 changed files with 10 additions and 12964 deletions
29
models/database/videos.model.js
Normal file
29
models/database/videos.model.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
module.exports = mongoose => {
|
||||
let schema = mongoose.Schema({
|
||||
userId: String,
|
||||
videoId: String,
|
||||
source: String,
|
||||
interest: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
watchedDates: {
|
||||
type: Array,
|
||||
default: null
|
||||
},
|
||||
isActive: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
schema.method("toJSON", function() {
|
||||
const { __v, _id, ...object } = this.toObject();
|
||||
object.id = _id;
|
||||
return object;
|
||||
});
|
||||
|
||||
return mongoose.model("videos", schema);
|
||||
};
|
||||
Reference in a new issue