back-end done

This commit is contained in:
Amir Mohamadi
2020-12-10 16:36:48 +03:30
parent 80a7abafb7
commit bc5e617778
92 changed files with 5217 additions and 3379 deletions
+33
View File
@@ -0,0 +1,33 @@
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)