Create: Backend branch

This commit is contained in:
Yûki VACHOT 2021-12-22 11:09:20 +01:00
parent f91febf919
commit 76ac0c292c
260 changed files with 10 additions and 12964 deletions

View file

@ -0,0 +1,44 @@
module.exports = mongoose => {
let schema = mongoose.Schema({
userId: String,
title: String,
images: {
type: Array,
default: []
},
url: {
type: String,
default: null
},
interests: {
type: Array,
default: []
},
comment: {
type: String,
default: null
},
views: {
type: Array,
default: []
},
isVisible: {
type: Boolean,
default: true
},
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("ads", schema);
};