Files
arakrail/api/models/History.js
T
2020-12-19 13:26:55 +03:30

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)