28 lines
537 B
JavaScript
28 lines
537 B
JavaScript
const mongoose = require('mongoose')
|
|
|
|
function image(img) {
|
|
return '/uploads/images/history/' + img
|
|
}
|
|
|
|
const HistorySchema = mongoose.Schema({
|
|
image: {type: String, get: image},
|
|
year: Number,
|
|
history_details: {
|
|
fa: {
|
|
title: String,
|
|
caption: String
|
|
},
|
|
en: {
|
|
title: String,
|
|
caption: String
|
|
}
|
|
},
|
|
created_at: String,
|
|
updated_at: String
|
|
}, {
|
|
toObject: {getters: true},
|
|
toJSON: {getters: true}
|
|
})
|
|
|
|
module.exports = mongoose.model('History', HistorySchema)
|