front-end almost done | started back-end

This commit is contained in:
Amir Mohamadi
2020-11-23 19:39:26 +03:30
parent 95149f0e72
commit 80a7abafb7
191 changed files with 60163 additions and 950 deletions
+25
View File
@@ -0,0 +1,25 @@
const mongoose = require('mongoose')
const BlogCategorySchema = mongoose.Schema({
blogCategory_details: {
fa: {
name: String
},
en: {
name: String
},
de: {
name: String
},
tr: {
name: String
},
it: {
name: String
}
},
created_at: String,
updated_at: String
})
module.exports = mongoose.model('BlogCategory', BlogCategorySchema)
+49
View File
@@ -0,0 +1,49 @@
const mongoose = require('mongoose')
function cover(img) {
return '/uploads/images/blog/' + img
}
const BlogPostSchema = mongoose.Schema({
cover: {type: String, get: cover},
published: {type: Boolean, default: true},
category: String,
post_details: {
fa: {
title: String,
description: String,
short_description: String
},
en: {
title: String,
description: String,
short_description: String
},
de: {
title: String,
description: String,
short_description: String
},
tr: {
title: String,
description: String,
short_description: String
},
it: {
title: String,
description: String,
short_description: String
}
},
created_at: String,
updated_at: String
}, {
toObject: {getters: true},
toJSON: {getters: true}
})
BlogPostSchema.virtual('thumb').get(function () {
return '/uploads/images/blog/thumb_' + this.cover.split('blog/')[1]
})
module.exports = mongoose.model('BlogPost', BlogPostSchema)