feat: add ci cd files dont edit those files
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
|
||||
function PDF(pdf) {
|
||||
if (pdf) return '/uploads/files/ReadOnly-PDF' + pdf
|
||||
}
|
||||
const BookSchema = mongoose.Schema({
|
||||
title: String,
|
||||
uri: String,
|
||||
slides:{
|
||||
default:[],
|
||||
type:Array
|
||||
}
|
||||
});
|
||||
|
||||
BookSchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('Book', BookSchema);
|
||||
@@ -0,0 +1,8 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
const CaptchaSchema = mongoose.Schema({
|
||||
code : String,
|
||||
createdAt : {type : Date , expires : 60 , default : Date.now()}
|
||||
});
|
||||
|
||||
module.exports = mongoose.model('Captcha', CaptchaSchema);
|
||||
@@ -0,0 +1,77 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
function autoPopulateSubs(next) {
|
||||
this.populate({
|
||||
path: 'childs',
|
||||
select: 'title childs navIndex url modelType treeCat parent defaultPageType',
|
||||
options:{
|
||||
sort : 'navIndex'
|
||||
}
|
||||
// sort: {navIndex: -1},
|
||||
});
|
||||
next();
|
||||
}
|
||||
|
||||
function file(file) {
|
||||
return '/uploads/files/terms/' + file
|
||||
}
|
||||
|
||||
function image(img) {
|
||||
if (img) return '/uploads/images/category/' + img
|
||||
else return '/img/no-cover.jpg'
|
||||
}
|
||||
|
||||
const CategoryTermsFile = mongoose.Schema({
|
||||
file: {type: String, get: file},
|
||||
title: String
|
||||
})
|
||||
|
||||
|
||||
const CategorySchema = mongoose.Schema({
|
||||
title: String,
|
||||
parent: {type: mongoose.Schema.Types.ObjectId, ref: 'Category', default: null},
|
||||
childs: [{type: mongoose.Schema.Types.ObjectId, ref: 'Category'}],
|
||||
treeCat: [{type: mongoose.Schema.Types.ObjectId, ref: 'Category'}],
|
||||
rootParent: {type: mongoose.Schema.Types.ObjectId, ref: 'Category'},
|
||||
priority: {type: Number, default: 0},
|
||||
showInMenu: Boolean,
|
||||
navIndex: {type: Number, default: null},
|
||||
news: {type: Boolean, default: true},
|
||||
child: {type: Boolean, default: true},
|
||||
special: {type: Boolean, default: false},
|
||||
allowComment: {type: Boolean, default: false},
|
||||
level: {type: Number, default: 1},
|
||||
siteMap: {type: Boolean, default: true},
|
||||
modelType: String,
|
||||
_creator: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
haveNews: {type: Boolean, default: false},
|
||||
///// for client
|
||||
hasNewsTab: {type: Boolean, default: true},
|
||||
hasContentTab: {type: Boolean, default: true},
|
||||
hasMediaTab: {type: Boolean, default: true},
|
||||
hasSubMenusTab: {type: Boolean, default: true},
|
||||
hasTermsTab: {type: Boolean, default: true},
|
||||
hasNotificationsTab: {type: Boolean, default: true},
|
||||
hasSpecNewsTab: {type: Boolean, default: true},
|
||||
hasNazarTab: {type: Boolean, default: true},
|
||||
hasNewsFileTab: {type: Boolean, default: true},
|
||||
defaultPageType: {type: String, default: 'news'},
|
||||
/** page */
|
||||
showInFooter: {type: Number, enum: [0, 1, 2, 3], default: 0},
|
||||
url: {type: String, default: null},
|
||||
pageContent: String,
|
||||
terms: [CategoryTermsFile],
|
||||
hasManagerInfo: {type: Boolean, default: true},
|
||||
managerCover: {type: String, get: image},
|
||||
managerName: String,
|
||||
managerDescription: String
|
||||
});
|
||||
|
||||
CategorySchema.index({parent: 1, childs: 1});
|
||||
|
||||
CategorySchema
|
||||
.pre('findOne', autoPopulateSubs)
|
||||
.pre('find', autoPopulateSubs);
|
||||
|
||||
module.exports = mongoose.model('Category', CategorySchema);
|
||||
@@ -0,0 +1,32 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
|
||||
const CommentSchema = mongoose.Schema({
|
||||
name : String,
|
||||
description: String,
|
||||
email : String,
|
||||
read : {type : Boolean , default : false},
|
||||
allowShow : {type : Boolean , default : false},
|
||||
catsId : {type : Array , default : []},
|
||||
_updatedBy: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'User'
|
||||
},
|
||||
modelRef : {
|
||||
type : mongoose.Schema.Types.ObjectId,
|
||||
refPath: 'modelName'
|
||||
},
|
||||
modelName : {
|
||||
type: String,
|
||||
required: true,
|
||||
enum: ['News', 'Category' , 'ContactUs']
|
||||
},
|
||||
modelType : String
|
||||
});
|
||||
|
||||
CommentSchema.index({modelRef: 1});
|
||||
|
||||
CommentSchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('Comment', CommentSchema);
|
||||
@@ -0,0 +1,22 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
|
||||
const ContactUsSchema = mongoose.Schema({
|
||||
title : {type : String , default : 'تماس با ما'},
|
||||
description: String,
|
||||
showInMenu: Boolean,
|
||||
email : String,
|
||||
phone : String,
|
||||
address : String,
|
||||
main : {type : Boolean , default : false},
|
||||
// catId : { type: mongoose.Schema.Types.ObjectId, ref: 'Category'},
|
||||
_creator: {type: mongoose.Schema.Types.ObjectId , ref: 'User'},
|
||||
_updatedBy : {type: mongoose.Schema.Types.ObjectId , ref: 'User'},
|
||||
location : { type: {type:String}, coordinates: [Number]},
|
||||
siteMap : {type : Boolean , default : true},
|
||||
showInFooter : {type : Number , enum : [0,1,2,3] , default : 0},
|
||||
});
|
||||
|
||||
ContactUsSchema.index({ location : '2dsphere'});
|
||||
|
||||
module.exports = mongoose.model('ContactUs', ContactUsSchema);
|
||||
@@ -0,0 +1,26 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
function image(img) {
|
||||
if (img) return '/uploads/images/content/' + img
|
||||
}
|
||||
|
||||
|
||||
const ContentSchema = mongoose.Schema({
|
||||
title: String,
|
||||
param: String,
|
||||
email: String,
|
||||
cover: {type: String, get: image, default: null},
|
||||
thumb: {type: String, get: image, default: null},
|
||||
showInMenu: {type: Boolean, default: false},
|
||||
pageContent: String,
|
||||
showInFooter: {type: Number, enum: [0, 1, 2, 3], default: 0},
|
||||
showInSubFooter: {type: Boolean, default: false},
|
||||
index: {type: Number, default: null},
|
||||
private: {type: Boolean, default: true},
|
||||
_creator: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
siteMap: {type: Boolean, default: true},
|
||||
modelType: {type: String, default: 'ostandari'}
|
||||
});
|
||||
|
||||
module.exports = mongoose.model('Content', ContentSchema);
|
||||
@@ -0,0 +1,15 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
|
||||
const CounterDaySchema = mongoose.Schema({
|
||||
title : String,
|
||||
expireDate : Date,
|
||||
publish : {type : Boolean , default: true},
|
||||
_creator :{type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
});
|
||||
|
||||
CounterDaySchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('CounterDay', CounterDaySchema);
|
||||
@@ -0,0 +1,52 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
function image(img) {
|
||||
if (img) return '/uploads/images/election/' + img
|
||||
}
|
||||
|
||||
const CandidatesSchema = mongoose.Schema({
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
bornDate : {type: Date , default: null},
|
||||
education: {type: String, default: null},
|
||||
nationalCode : {type: String, default: null},
|
||||
resume : {type: String, default: null},
|
||||
profilePic : {type: String, get: image, default: null},
|
||||
_creator :{type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
});
|
||||
|
||||
const VotersSchema = mongoose.Schema({
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
nationalCode : String,
|
||||
password: String,
|
||||
scope:{type: Array, default: ['voter']},
|
||||
username: {type: String, unique: true},
|
||||
mobileNumber: {type: String, default: null},
|
||||
job: {type: String, default: null},
|
||||
voted: {type: Boolean, default: false},
|
||||
_creator :{type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
});
|
||||
|
||||
const ElectionSchema = mongoose.Schema({
|
||||
title: String,
|
||||
description : {type : String , default : null},
|
||||
catId: {type: mongoose.Schema.Types.ObjectId, ref: 'Category'},
|
||||
allCat: [{type: mongoose.Schema.Types.ObjectId, ref: 'Category'}],
|
||||
rootParent: {type: mongoose.Schema.Types.ObjectId, ref: 'Category'},
|
||||
candidates : [CandidatesSchema],
|
||||
voters : [VotersSchema],
|
||||
votes : {type : Array , default : []},
|
||||
startDate : Date,
|
||||
endDate : Date,
|
||||
publish: {type: Boolean, default: false},
|
||||
_creator :{type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
});
|
||||
|
||||
ElectionSchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('Election', ElectionSchema);
|
||||
@@ -0,0 +1,20 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
|
||||
const FeedBackSchema = mongoose.Schema({
|
||||
name : String,
|
||||
description: String,
|
||||
email : String,
|
||||
twitter:String,
|
||||
phoneNumber : String,
|
||||
read : {type : Boolean , default : false},
|
||||
_updatedBy: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'User'
|
||||
}
|
||||
});
|
||||
|
||||
FeedBackSchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('FeedBack', FeedBackSchema);
|
||||
@@ -0,0 +1,57 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
function image(img) {
|
||||
if (img) return '/uploads/images/gallery/' + img
|
||||
}
|
||||
|
||||
function graphic(img) {
|
||||
if (img) return '/uploads/graphics/gallery/' + img
|
||||
}
|
||||
|
||||
function video(vdo) {
|
||||
if (vdo) return '/uploads/videos/gallery/' + vdo
|
||||
}
|
||||
|
||||
const GallerySchema = mongoose.Schema({
|
||||
title: String,
|
||||
shortTitlePanel: String,
|
||||
shortTitleFront: String,
|
||||
summaryTitle: String,
|
||||
shortSummaryTitle: String,
|
||||
leadTitle: String,
|
||||
catId: {type: mongoose.Schema.Types.ObjectId, ref: 'Category'},
|
||||
rootParent: {type: mongoose.Schema.Types.ObjectId, ref: 'Category'},
|
||||
allCat: [{type: mongoose.Schema.Types.ObjectId, ref: 'Category'}],
|
||||
newsFileId: {type: mongoose.Schema.Types.ObjectId, ref: 'NewsFile'},
|
||||
// priority: {type : Number , default : 0},
|
||||
publish: {type: Boolean, default: false},
|
||||
showInHome: {type: Boolean, default: true},
|
||||
graphic: {type: String, get: graphic, default: null},
|
||||
thumbGraphic: {type: String, get: graphic, default: null},
|
||||
cover: {type: String, get: image, default: null},
|
||||
thumbCover: {type: String, get: image, default: null},
|
||||
uidImage:[{type:String , get:image , default:null}],
|
||||
images: [{type: String, get: image, default: null}],
|
||||
thumbImages: [{type: String, get: image, default: null}],
|
||||
video: {type: String, get: video, default: null},
|
||||
isEmbedded: {type: Boolean, default: false},
|
||||
embeddedCode: String,
|
||||
userViews: {type: Number, default: 0},
|
||||
special: {type: Boolean, default: false},
|
||||
_creator: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
siteMap: {type: Boolean, default: true},
|
||||
modelType: String,
|
||||
keywords: {type: Array, default: []},
|
||||
metaTagDesc: {type: String, default: null},
|
||||
galleryType: {type: String, enum: ['image', 'video', 'graphic']},
|
||||
galleryStatus: {type: Boolean, default: false},
|
||||
customDate: {type: Date, default: Date.now},
|
||||
customDateHistory: Array,
|
||||
favorite: {type: Boolean, default: false}
|
||||
}, {toJson: {getters: false}});
|
||||
|
||||
GallerySchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('Gallery', GallerySchema);
|
||||
@@ -0,0 +1,18 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
const HomePageSchema = mongoose.Schema({
|
||||
s2: {type: mongoose.Schema.Types.ObjectId, ref: 'Category', default: null},
|
||||
s3: {type: mongoose.Schema.Types.ObjectId, ref: 'Category', default: null},
|
||||
s4: {type: mongoose.Schema.Types.ObjectId, ref: 'Category', default: null},
|
||||
s5: [{type: mongoose.Schema.Types.ObjectId, ref: 'Category', default: null}],
|
||||
s6: {type: mongoose.Schema.Types.ObjectId, ref: 'Category', default: null},
|
||||
// side bar
|
||||
s2Side: {type: mongoose.Schema.Types.ObjectId, ref: 'Category', default: null},
|
||||
s3Side: {type: mongoose.Schema.Types.ObjectId, ref: 'Category', default: null},
|
||||
s4Side: {type: mongoose.Schema.Types.ObjectId, ref: 'Category', default: null},
|
||||
s5Side: {type: mongoose.Schema.Types.ObjectId, ref: 'Category', default: null},
|
||||
s6Side: {type: mongoose.Schema.Types.ObjectId, ref: 'Category', default: null},
|
||||
modelType : String
|
||||
});
|
||||
|
||||
module.exports = mongoose.model('HomePage', HomePageSchema);
|
||||
@@ -0,0 +1,20 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
function image(img) {
|
||||
if (img) return '/uploads/images/links/' + img
|
||||
}
|
||||
|
||||
const LinksSchema = mongoose.Schema({
|
||||
title: String,
|
||||
url : String,
|
||||
icon : {type: String, get: image , default : null},
|
||||
index: {type : Number , default : null},
|
||||
showInHome : {type : Boolean , default : false},
|
||||
_creator: {type: mongoose.Schema.Types.ObjectId , ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId , ref: 'User'},
|
||||
siteMap : {type : Boolean , default : false},
|
||||
modelType : String
|
||||
});
|
||||
|
||||
|
||||
module.exports = mongoose.model('Links', LinksSchema);
|
||||
@@ -0,0 +1,11 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
const LoggerSchema = mongoose.Schema({
|
||||
LastLogin: String,
|
||||
user :{type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
});
|
||||
|
||||
LoggerSchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('Logger', LoggerSchema);
|
||||
@@ -0,0 +1,21 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
|
||||
const MeetingSchema = mongoose.Schema({
|
||||
name : String,
|
||||
subject : String,
|
||||
description: String,
|
||||
email : String,
|
||||
phoneNumber : String,
|
||||
nationalCode : String,
|
||||
read : {type : Boolean , default : false},
|
||||
_updatedBy: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'User'
|
||||
}
|
||||
});
|
||||
|
||||
MeetingSchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('Meeting', MeetingSchema);
|
||||
@@ -0,0 +1,61 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
function image(img) {
|
||||
if (img) return '/uploads/images/news/' + img
|
||||
else return '/img/no-cover.jpg'
|
||||
}
|
||||
|
||||
function file(file) {
|
||||
return '/uploads/files/newsAttachments/' + file
|
||||
}
|
||||
|
||||
const NewsAttachmentSchema = mongoose.Schema({
|
||||
file: {type: String, get: file},
|
||||
title: String
|
||||
})
|
||||
|
||||
const NewsSchema = mongoose.Schema({
|
||||
title: String,
|
||||
shortTitlePanel: String,
|
||||
shortTitleFront: String,
|
||||
summaryTitle: String,
|
||||
leadTitle: String,
|
||||
shortSummaryTitle: String,
|
||||
customDate: {type: Date, default: Date.now},
|
||||
catId: {type: mongoose.Schema.Types.ObjectId, ref: 'Category'},
|
||||
allCat: [{type: mongoose.Schema.Types.ObjectId, ref: 'Category'}],
|
||||
newsFileId: {type: mongoose.Schema.Types.ObjectId, ref: 'NewsFile'},
|
||||
rootParent: {type: mongoose.Schema.Types.ObjectId, ref: 'Category'},
|
||||
priority: {type: Boolean, default: false},
|
||||
allowComment: {type: Boolean, default: false},
|
||||
showInHome: {type: Boolean, default: true},
|
||||
slider: {type: Boolean, default: false},
|
||||
PublisherId:{type:String},
|
||||
PublisherAccept:{type:Boolean , default:false},
|
||||
publish: {type: Boolean, default: false},
|
||||
pageContent: String,
|
||||
cover: {type: String, get: image, default: null},
|
||||
thumbCover: {type: String, get: image, default: null},
|
||||
content:{type:String , default:''},
|
||||
userViews: {type: Number, default: 0},
|
||||
special: {type: Boolean, default: false},
|
||||
notifications: {type: Boolean, default: false},
|
||||
_creator: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
siteMap: {type: Boolean, default: true},
|
||||
keywords: {type: Array, default: []},
|
||||
metaTagDesc: {type: String, default: null},
|
||||
newsStatus: {type: Boolean, default: false},
|
||||
modelType: String,
|
||||
customDateHistory: Array,
|
||||
attachments: [NewsAttachmentSchema],
|
||||
imported: Boolean,
|
||||
superNews: Boolean
|
||||
});
|
||||
|
||||
NewsSchema.index({catId: 1, allCat: 1});
|
||||
|
||||
NewsSchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('News', NewsSchema);
|
||||
@@ -0,0 +1,31 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
function image(img) {
|
||||
if (img) return '/uploads/images/news/' + img
|
||||
else return '/img/no-cover.jpg'
|
||||
}
|
||||
|
||||
const NewsFileSchema = mongoose.Schema({
|
||||
title: String,
|
||||
description: String,
|
||||
index: {type: Number, default: null},
|
||||
catId: {type: mongoose.Schema.Types.ObjectId, ref: 'Category'},
|
||||
allCat: [{type: mongoose.Schema.Types.ObjectId, ref: 'Category'}],
|
||||
rootParent: {type: mongoose.Schema.Types.ObjectId, ref: 'Category'},
|
||||
showInHome: {type: Boolean, default: true},
|
||||
showInMenu: {type: Boolean, default: false},
|
||||
_creator: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
siteMap: {type: Boolean, default: true},
|
||||
userViews: {type: Number, default: 0},
|
||||
modelType: String,
|
||||
publish: {type: Boolean, default: true},
|
||||
cover: {type: String, get: image, default: null},
|
||||
thumbCover: {type: String, get: image, default: null},
|
||||
});
|
||||
|
||||
NewsFileSchema.plugin(mongoosePaginate);
|
||||
|
||||
|
||||
module.exports = mongoose.model('NewsFile', NewsFileSchema);
|
||||
@@ -0,0 +1,22 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
function image(img) {
|
||||
if (img) return '/uploads/images/occasion/' + img
|
||||
}
|
||||
|
||||
const OccasionSchema = mongoose.Schema({
|
||||
title : String,
|
||||
mainCover: {type: String, get: image, default: null},
|
||||
startDate : Date,
|
||||
endDate : Date,
|
||||
index: {type: Number, default: null},
|
||||
publish : {type : Boolean , default: true},
|
||||
status : {type : Boolean , default: false},
|
||||
_creator :{type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
});
|
||||
|
||||
OccasionSchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('Occasion', OccasionSchema);
|
||||
@@ -0,0 +1,24 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
const PollSchema = mongoose.Schema({
|
||||
title: String,
|
||||
description : {type : String , default : null},
|
||||
surveyType : {type : String , default : 'check'},
|
||||
catId: {type: mongoose.Schema.Types.ObjectId, ref: 'Category'},
|
||||
allCat: [{type: mongoose.Schema.Types.ObjectId, ref: 'Category'}],
|
||||
rootParent: {type: mongoose.Schema.Types.ObjectId, ref: 'Category'},
|
||||
// index: {type: Number, default: null},
|
||||
options : {type : Array , default : []},
|
||||
answers : {type : Array , default : []},
|
||||
userIds : {type : Array , default : []},
|
||||
startDate : Date,
|
||||
endDate : Date,
|
||||
publish: {type: Boolean, default: false},
|
||||
_creator :{type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
});
|
||||
|
||||
PollSchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('Poll', PollSchema);
|
||||
@@ -0,0 +1,20 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
function image(img) {
|
||||
if (img) return '/uploads/images/services/' + img
|
||||
}
|
||||
|
||||
const ServicesSchema = mongoose.Schema({
|
||||
title: String,
|
||||
url : String,
|
||||
cover : {type: String, get: image , default : null},
|
||||
index: {type : Number , default : null},
|
||||
_creator: {type: mongoose.Schema.Types.ObjectId , ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId , ref: 'User'},
|
||||
modelType : String
|
||||
});
|
||||
|
||||
ServicesSchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('Services', ServicesSchema);
|
||||
@@ -0,0 +1,24 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
function image(img) {
|
||||
if (img) return '/uploads/images/slider/' + img
|
||||
}
|
||||
|
||||
const SliderSchema = mongoose.Schema({
|
||||
title: String,
|
||||
summaryTitle : String,
|
||||
url : String,
|
||||
newsTitle : String,
|
||||
isLocal : {type : Boolean , default : false},
|
||||
cover : {type: String, get: image , default : null},
|
||||
index: {type : Number , default : null},
|
||||
_creator: {type: mongoose.Schema.Types.ObjectId , ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId , ref: 'User'},
|
||||
siteMap : {type : Boolean , default : false},
|
||||
modelType : String
|
||||
});
|
||||
|
||||
SliderSchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('Slider', SliderSchema);
|
||||
@@ -0,0 +1,29 @@
|
||||
const mongoose = require('mongoose');
|
||||
const mongoosePaginate = require('mongoose-paginate-v2');
|
||||
|
||||
function image(img) {
|
||||
if (img) return '/uploads/images/users/' + img
|
||||
}
|
||||
|
||||
const AdminSchema = mongoose.Schema({
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
password: String,
|
||||
scope: {type: Array, default: ['admin']},
|
||||
token: {type: String, default: null},
|
||||
profilePic: {type: String, get: image, default: null},
|
||||
mobileNumber: {type: String, default: null},
|
||||
email: String,
|
||||
registration_done: {type: Boolean, default: false},
|
||||
_creator: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
username: {type: String, unique: true},
|
||||
portals: {type: Array, default: []},
|
||||
permissions: Array,
|
||||
specialPermissions: [{type: mongoose.Schema.Types.ObjectId, ref: 'Category'}],
|
||||
private: {type: Boolean, default: false}
|
||||
})
|
||||
|
||||
AdminSchema.plugin(mongoosePaginate);
|
||||
|
||||
module.exports = mongoose.model('User', AdminSchema)
|
||||
@@ -0,0 +1,26 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
function image(img) {
|
||||
if (img) return '/uploads/images/mainCover/' + img
|
||||
}
|
||||
|
||||
const YearBannerSchema = mongoose.Schema({
|
||||
mainCover: {type: String, get: image, default: null},
|
||||
iranFlag: {type: Boolean, default: true},
|
||||
// electionBtn
|
||||
electionBtn: {type: Boolean, default: true},
|
||||
// social links
|
||||
hasEmail: {type: Boolean, default: true},
|
||||
hasGPlus: {type: Boolean, default: true},
|
||||
hasTweeter: {type: Boolean, default: true},
|
||||
hasInstagram: {type: Boolean, default: true},
|
||||
email: {type: String, default: ''},
|
||||
gPlus: {type: String, default: ''},
|
||||
tweeter: {type: String, default: ''},
|
||||
instagram: {type: String, default: ''},
|
||||
// textCover : {type : String , default : null},
|
||||
_updatedBy: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
|
||||
});
|
||||
|
||||
|
||||
module.exports = mongoose.model('YearBanner', YearBannerSchema);
|
||||
Reference in New Issue
Block a user