feat: add ci cd files dont edit those files
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user