front-end almost done | started back-end
This commit is contained in:
@@ -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)
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user