Files
arakrail/api/models/Project.js
T
Amir Mohamadi bc5e617778 back-end done
2020-12-10 16:36:48 +03:30

34 lines
639 B
JavaScript

const mongoose = require('mongoose')
function image(file) {
return `/uploads/images/projects/${file}`
}
const ImagesSchema = mongoose.Schema({
image: {type: String, get: image},
created_at: String
}, {
toObject: {getters: true},
toJSON: {getters: true}
})
const ProjectSchema = mongoose.Schema({
images: [ImagesSchema],
project_details: {
fa: {
name: String,
description: String
},
en: {
name: String,
description: String
}
},
date: String,
created_at: String,
updated_at: String
})
module.exports = mongoose.model('Project', ProjectSchema)