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

18 lines
562 B
JavaScript

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