front-end almost done | started back-end
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
function image(img) {
|
||||
return '/uploads/images/about/' + img
|
||||
}
|
||||
|
||||
const AboutPageSchema = mongoose.Schema({
|
||||
aboutPage_details: {
|
||||
fa: {
|
||||
page_title: String,
|
||||
s1_title: String,
|
||||
s1_caption: String,
|
||||
s2_title: String,
|
||||
s2_caption: String,
|
||||
s2_imageCaption: String,
|
||||
s3_title: String,
|
||||
s3_caption: String,
|
||||
s3_imageCaption: String,
|
||||
s4_text: String,
|
||||
last_section_title: String,
|
||||
last_section_text: String
|
||||
},
|
||||
en: {
|
||||
page_title: String,
|
||||
s1_title: String,
|
||||
s1_caption: String,
|
||||
s2_title: String,
|
||||
s2_caption: String,
|
||||
s2_imageCaption: String,
|
||||
s3_title: String,
|
||||
s3_caption: String,
|
||||
s3_imageCaption: String,
|
||||
s4_text: String,
|
||||
last_section_title: String,
|
||||
last_section_text: String
|
||||
},
|
||||
de: {
|
||||
page_title: String,
|
||||
s1_title: String,
|
||||
s1_caption: String,
|
||||
s2_title: String,
|
||||
s2_caption: String,
|
||||
s2_imageCaption: String,
|
||||
s3_title: String,
|
||||
s3_caption: String,
|
||||
s3_imageCaption: String,
|
||||
s4_text: String,
|
||||
last_section_title: String,
|
||||
last_section_text: String
|
||||
},
|
||||
tr: {
|
||||
page_title: String,
|
||||
s1_title: String,
|
||||
s1_caption: String,
|
||||
s2_title: String,
|
||||
s2_caption: String,
|
||||
s2_imageCaption: String,
|
||||
s3_title: String,
|
||||
s3_caption: String,
|
||||
s3_imageCaption: String,
|
||||
s4_text: String,
|
||||
last_section_title: String,
|
||||
last_section_text: String
|
||||
},
|
||||
it: {
|
||||
page_title: String,
|
||||
s1_title: String,
|
||||
s1_caption: String,
|
||||
s2_title: String,
|
||||
s2_caption: String,
|
||||
s2_imageCaption: String,
|
||||
s3_title: String,
|
||||
s3_caption: String,
|
||||
s3_imageCaption: String,
|
||||
s4_text: String,
|
||||
last_section_title: String,
|
||||
last_section_text: String
|
||||
}
|
||||
},
|
||||
page_hero: {type: String, get: image},
|
||||
s2_image: {type: String, get: image},
|
||||
s3_image: {type: String, get: image},
|
||||
last_section_image: {type: String, get: image},
|
||||
created_at: String,
|
||||
updated_at: String
|
||||
}, {
|
||||
toObject: {getters: true},
|
||||
toJSON: {getters: true}
|
||||
})
|
||||
|
||||
|
||||
module.exports = mongoose.model('AboutPageContent', AboutPageSchema)
|
||||
@@ -0,0 +1,13 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
const BroadcastSchema = mongoose.Schema({
|
||||
title: String,
|
||||
message: String,
|
||||
read: Array,
|
||||
locale: String,
|
||||
admin_id: String,
|
||||
created_at: String
|
||||
})
|
||||
|
||||
|
||||
module.exports = mongoose.model('Broadcast', BroadcastSchema)
|
||||
@@ -0,0 +1,14 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
const ContactPageMessageSchema = mongoose.Schema({
|
||||
first_name: String,
|
||||
last_name: String,
|
||||
phone_number: String,
|
||||
email: String,
|
||||
message: String,
|
||||
user_id: String,
|
||||
read: {type: Boolean, default: false},
|
||||
created_at: String
|
||||
})
|
||||
|
||||
module.exports = mongoose.model('ContactPageMessage', ContactPageMessageSchema)
|
||||
@@ -0,0 +1,19 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
function image(file) {
|
||||
return `/uploads/images/gallery/${file}`
|
||||
}
|
||||
|
||||
const gallerySchema = mongoose.Schema({
|
||||
image: {type: String, get: image},
|
||||
created_at: String
|
||||
}, {
|
||||
toObject: {getters: true},
|
||||
toJSON: {getters: true}
|
||||
})
|
||||
|
||||
gallerySchema.virtual('thumb').get(function () {
|
||||
return '/uploads/images/gallery/thumb/thumb_' + this.image.split('gallery/')[1]
|
||||
})
|
||||
|
||||
module.exports = mongoose.model('Gallery', gallerySchema)
|
||||
@@ -0,0 +1,33 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
function image(img) {
|
||||
return '/uploads/images/slider/' + img
|
||||
}
|
||||
|
||||
const SliderSchema = mongoose.Schema({
|
||||
image: {type: String, get: image},
|
||||
slider_details: {
|
||||
fa: {
|
||||
caption: String
|
||||
},
|
||||
en: {
|
||||
caption: String
|
||||
},
|
||||
de: {
|
||||
caption: String
|
||||
},
|
||||
tr: {
|
||||
caption: String
|
||||
},
|
||||
it: {
|
||||
caption: String
|
||||
}
|
||||
},
|
||||
created_at: String,
|
||||
updated_at: String
|
||||
}, {
|
||||
toObject: {getters: true},
|
||||
toJSON: {getters: true}
|
||||
})
|
||||
|
||||
module.exports = mongoose.model('Slider', SliderSchema)
|
||||
@@ -0,0 +1,14 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
const AdminSchema = mongoose.Schema({
|
||||
name: String,
|
||||
username: String,
|
||||
password: String,
|
||||
roles: Array,
|
||||
created_at: String,
|
||||
updated_at: String,
|
||||
scope: String,
|
||||
token: String
|
||||
})
|
||||
|
||||
module.exports = mongoose.model('Admin', AdminSchema)
|
||||
@@ -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)
|
||||
@@ -0,0 +1,100 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
function productImage(img) {
|
||||
return '/uploads/images/products/' + img
|
||||
}
|
||||
|
||||
function ProductImageGallery(img) {
|
||||
return '/uploads/images/products/gallery/' + img
|
||||
}
|
||||
|
||||
|
||||
const ProductFeatureSchema = mongoose.Schema({
|
||||
fa: {
|
||||
name: String,
|
||||
value: String
|
||||
},
|
||||
en: {
|
||||
name: String,
|
||||
value: String
|
||||
},
|
||||
de: {
|
||||
name: String,
|
||||
value: String
|
||||
},
|
||||
tr: {
|
||||
name: String,
|
||||
value: String
|
||||
},
|
||||
it: {
|
||||
name: String,
|
||||
value: String
|
||||
},
|
||||
created_at: String
|
||||
})
|
||||
|
||||
const ProductImageSchema = mongoose.Schema({
|
||||
image: {type: String, get: ProductImageGallery},
|
||||
created_at: String
|
||||
}, {
|
||||
toObject: {getters: true},
|
||||
toJSON: {getters: true}
|
||||
})
|
||||
|
||||
const ProductSchema = mongoose.Schema({
|
||||
image: {type: String, get: productImage},
|
||||
stock: Number,
|
||||
category: String,
|
||||
product_details: {
|
||||
fa: {
|
||||
name: String,
|
||||
description: String,
|
||||
price: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
en: {
|
||||
name: String,
|
||||
description: String,
|
||||
price: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
de: {
|
||||
name: String,
|
||||
description: String,
|
||||
price: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
it: {
|
||||
name: String,
|
||||
description: String,
|
||||
price: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
tr: {
|
||||
name: String,
|
||||
description: String,
|
||||
price: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
product_features: [ProductFeatureSchema],
|
||||
product_images: [ProductImageSchema],
|
||||
created_at: String,
|
||||
updated_at: String
|
||||
}, {
|
||||
toObject: {getters: true},
|
||||
toJSON: {getters: true}
|
||||
})
|
||||
|
||||
|
||||
module.exports = mongoose.model('Product', ProductSchema)
|
||||
@@ -0,0 +1,39 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
function image(img) {
|
||||
return '/uploads/images/products/category/' + img
|
||||
}
|
||||
|
||||
const ProductCategorySchema = mongoose.Schema({
|
||||
image: {type: String, get: image},
|
||||
cover: {type: String, get: image},
|
||||
category_details: {
|
||||
fa: {
|
||||
name: String,
|
||||
caption: String
|
||||
},
|
||||
en: {
|
||||
name: String,
|
||||
caption: String
|
||||
},
|
||||
de: {
|
||||
name: String,
|
||||
caption: String
|
||||
},
|
||||
tr: {
|
||||
name: String,
|
||||
caption: String
|
||||
},
|
||||
it: {
|
||||
name: String,
|
||||
caption: String
|
||||
}
|
||||
},
|
||||
created_at: String,
|
||||
updated_at: String
|
||||
}, {
|
||||
toObject: {getters: true},
|
||||
toJSON: {getters: true}
|
||||
})
|
||||
|
||||
module.exports = mongoose.model('ProductCategory', ProductCategorySchema)
|
||||
@@ -0,0 +1,11 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
const Cart_ItemSchema = mongoose.Schema({
|
||||
user_id: String,
|
||||
product_id: String,
|
||||
quantity: String,
|
||||
created_at: String,
|
||||
updated_at: String
|
||||
})
|
||||
|
||||
module.exports = mongoose.model('Cart_Item', Cart_ItemSchema)
|
||||
@@ -0,0 +1,30 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
const StatusSchema = mongoose.Schema({
|
||||
status: {
|
||||
type: String,
|
||||
enum: ['incomplete','processing', 'packing', 'sent','delivered'],
|
||||
default: 'processing'
|
||||
},
|
||||
created_at: String
|
||||
})
|
||||
|
||||
const Order_itemsSchema = mongoose.Schema({
|
||||
product_id: String,
|
||||
quantity: Number,
|
||||
price: Number,
|
||||
price_unit: String,
|
||||
created_at: String
|
||||
})
|
||||
|
||||
const OrderSchema = mongoose.Schema({
|
||||
user_id: String,
|
||||
number: Number,
|
||||
address: Object,
|
||||
statuses: [StatusSchema],
|
||||
order_items: [Order_itemsSchema],
|
||||
created_at: String,
|
||||
updated_at: String
|
||||
})
|
||||
|
||||
module.exports = mongoose.model('Order', OrderSchema)
|
||||
@@ -0,0 +1,43 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
const AddressSchema = mongoose.Schema({
|
||||
country: String,
|
||||
province: String,
|
||||
city: String,
|
||||
address: String,
|
||||
postal_code: String,
|
||||
plaque: String,
|
||||
block_number: String,
|
||||
receiver_first_name: String,
|
||||
receiver_last_name: String,
|
||||
receiver_mobile: String,
|
||||
created_at: String
|
||||
})
|
||||
|
||||
|
||||
const UserSchema = mongoose.Schema({
|
||||
first_name: String,
|
||||
last_name: String,
|
||||
type: {type: String, enum: ['personal', 'company'], default: 'personal'},
|
||||
company_name: String,
|
||||
email_personal: String,
|
||||
email_company: String,
|
||||
fb_id_personal: String,
|
||||
fb_id_company: String,
|
||||
ig_id_personal: String,
|
||||
ig_id_company: String,
|
||||
skype_id_personal: String,
|
||||
skype_id_company: String,
|
||||
addresses: [AddressSchema],
|
||||
phone_number: String,
|
||||
password: String,
|
||||
confirmed: {type: Boolean, default: false},
|
||||
confirmation_key: String,
|
||||
scope: String,
|
||||
token: String,
|
||||
reset_pass_key: String,
|
||||
created_at: String,
|
||||
updated_at: String
|
||||
})
|
||||
|
||||
module.exports = mongoose.model('User', UserSchema)
|
||||
Reference in New Issue
Block a user