worldshine-redesign/app/models/center-phone.model.js
2025-04-14 16:29:36 -04:00

20 lines
622 B
JavaScript

const uniqueValidator = require('mongoose-unique-validator');
module.exports = mongoose => {
var schema = mongoose.Schema(
{
phone_title: String,
phone_number: String,
activated: Boolean,
site: Number
},
{ collection: 'center_phone', timestamps: true }
);
schema.method("toJSON", function() {
const { __v, _id, ...object } = this.toObject();
object.id = _id;
return object;
});
schema.plugin(uniqueValidator);
const CenterPhone = mongoose.model("center_phone", schema);
return CenterPhone;
};