worldshine-redesign/app/models/label.model.js
2025-06-13 22:48:05 -04:00

18 lines
400 B
JavaScript

module.exports = mongoose => {
var schema = mongoose.Schema(
{
label_name: String,
label_color: String,
site: Number,
status: String
},
{ collection: 'label', timestamps: true }
);
schema.method("toJSON", function() {
const { __v, _id, ...object } = this.toObject();
object.id = _id;
return object;
});
const Label = mongoose.model("label", schema);
return Label;
};