Files
arakrail/api/models/MainCatalog.js
T
2021-01-27 18:51:06 +03:30

20 lines
412 B
JavaScript

const mongoose = require('mongoose')
function catalog(pdf) {
if (pdf) return '/uploads/pdf/' + pdf
}
const MainCatalogSchema = mongoose.Schema({
file: {
fa: {type: String, get: catalog},
en: {type: String, get: catalog}
},
created_at: String,
updated_at: String
}, {
toObject: {getters: true},
toJSON: {getters: true}
})
module.exports = mongoose.model('MainCatalog', MainCatalogSchema)