66 lines
1.5 KiB
JavaScript
66 lines
1.5 KiB
JavaScript
const mongoose = require('mongoose')
|
|
|
|
function image(img) {
|
|
if (img) return '/uploads/images/projects/' + img
|
|
}
|
|
|
|
const ProjectImagesSchema = mongoose.Schema({
|
|
image: {type: String, get: image},
|
|
thumb: {type: String, get: image}
|
|
})
|
|
|
|
const ProjectSchema = mongoose.Schema({
|
|
locale: {
|
|
fa: {
|
|
title: String,
|
|
short_description: String,
|
|
description: String,
|
|
//
|
|
client: String,
|
|
size: String,
|
|
area: String,
|
|
//
|
|
s3_title: String,
|
|
s3_description: String,
|
|
//
|
|
s5_title: String,
|
|
s5_description: String,
|
|
//
|
|
s6_title: String,
|
|
s6_description: String
|
|
},
|
|
en: {
|
|
title: String,
|
|
short_description: String,
|
|
description: String,
|
|
//
|
|
client: String,
|
|
size: String,
|
|
area: String,
|
|
//
|
|
s3_title: String,
|
|
s3_description: String,
|
|
//
|
|
s5_title: String,
|
|
s5_description: String,
|
|
//
|
|
s6_title: String,
|
|
s6_description: String
|
|
}
|
|
},
|
|
category: {type: mongoose.ObjectId, ref: 'ProjectCategory'},
|
|
tag: {type: mongoose.ObjectId},
|
|
cover: {type: String, get: image},
|
|
thumb: {type: String, get: image},
|
|
s2_image: {type: String, get: image},
|
|
s4_image: {type: String, get: image},
|
|
s5_image: {type: String, get: image},
|
|
s6_image: {type: String, get: image},
|
|
project_date: String,
|
|
images: [ProjectImagesSchema],
|
|
has_details: {type: Boolean, default: false},
|
|
importWithCode : {type: Boolean, default: false}
|
|
})
|
|
|
|
module.exports = mongoose.model('Project', ProjectSchema)
|