28 lines
526 B
JavaScript
28 lines
526 B
JavaScript
const mongoose = require('mongoose')
|
|
|
|
function file(file) {
|
|
return '/uploads/catalogs/file/' + file
|
|
}
|
|
|
|
function cover(img) {
|
|
return '/uploads/catalogs/cover/' + img
|
|
}
|
|
|
|
const CatalogSchema = mongoose.Schema({
|
|
locale: {
|
|
fa: {
|
|
title: String
|
|
},
|
|
en: {
|
|
title: String
|
|
}
|
|
},
|
|
file: {type: String, get: file},
|
|
cover: {type: String, get: cover},
|
|
showInFa: {type: Boolean, default: false},
|
|
showInEn: {type: Boolean, default: false}
|
|
})
|
|
|
|
|
|
module.exports = mongoose.model('Catalog', CatalogSchema)
|