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

37 lines
1.0 KiB
JavaScript

module.exports = mongoose => {
var editHistorySchema = mongoose.Schema({
employee: String,
date: Date
});
var schema = mongoose.Schema(
{
name: {
type: String,
required: true,
},
content: String,
description: String,
model: Object,
status: String, // 'active', 'inactive'
file: [{
type: Object
}],
site: Number,
create_by: String,
create_date: Date,
edit_by: String,
edit_date: Date,
edit_history: [{
type: editHistorySchema
}],
},
{ collection: 'xlsx-template', timestamps: true }
);
schema.method("toJSON", function() {
const { __v, _id, ...object } = this.toObject();
object.id = _id;
return object;
});
const ExcelTemplate = mongoose.model("xlsxtemplate", schema);
return ExcelTemplate;
};