112 lines
2.9 KiB
JavaScript
112 lines
2.9 KiB
JavaScript
const mongoose = require('mongoose')
|
|
|
|
function file(file) {
|
|
return '/uploads/representation_docs/' + this.name
|
|
}
|
|
|
|
const FilesSchema = mongoose.Schema({
|
|
name: String
|
|
})
|
|
FilesSchema.virtual('url').get(file)
|
|
|
|
const RepresentationSchema = mongoose.Schema({
|
|
// user info
|
|
user_id: { type: mongoose.ObjectId, ref: 'User' },
|
|
representation_code: String,
|
|
agent_code: String,
|
|
editAccess: { type: Boolean, default: false },
|
|
|
|
// personal info
|
|
full_name: String,
|
|
birth_date: String,
|
|
id_number: String,
|
|
place_of_issue: String,
|
|
national_code: String,
|
|
fathers_name: String,
|
|
education_level: String,
|
|
military_status: String,
|
|
certificates: String,
|
|
|
|
// contact info
|
|
store_name: String,
|
|
province_name: String,
|
|
province_id: String,
|
|
city_name: String,
|
|
city_id: String,
|
|
postal_code: String,
|
|
mobile_number: String,
|
|
tel_number: String,
|
|
fax_number: String,
|
|
economic_code: String,
|
|
email: String,
|
|
address: String,
|
|
|
|
// location info
|
|
business_license: Boolean,
|
|
ownership_type: { type: String, enum: ['owner', 'rent', 'rghit_of_business'] },
|
|
total_area: String,
|
|
repair_area: String,
|
|
stock_area: String,
|
|
customer_reference_floor: String,
|
|
place_location: { type: String, enum: ['tech_passage', 'other'] },
|
|
geo_location: { type: String, enum: ['main_street', 'side_street', 'alley', 'inside_passage', 'outside_passage'] },
|
|
banner_info: String,
|
|
repair_technicians: String,
|
|
repair_masters: String,
|
|
office_workers: String,
|
|
bike_deliveries: String,
|
|
|
|
// experience info
|
|
computer_repair_exp: String,
|
|
multimedia_repair_exp: String,
|
|
business_exp: String,
|
|
|
|
// common questions
|
|
representation_type: {
|
|
type: String,
|
|
enum: ['verity', 'panatech', 'both'],
|
|
default: 'both'
|
|
},
|
|
know_asanServ_from: {
|
|
type: String,
|
|
enum: ['company_agents', 'website', 'company_workers', 'exhibition', 'introduced', 'other']
|
|
},
|
|
introducer_info: String,
|
|
asanServ_products_knowledge: { type: Number, enum: [0, 1, 2, 3, 4] },
|
|
computer_saling_exp: Boolean,
|
|
computer_saling_description: String,
|
|
other_representations: [
|
|
{
|
|
trademark: String,
|
|
company_name: String,
|
|
cooperation_history: String,
|
|
cooperation_start_year: String
|
|
}
|
|
],
|
|
more_descriptions: String,
|
|
|
|
// admins
|
|
status: {
|
|
type: String,
|
|
enum: ['registered', 'ongoing', 'verification', 'accepted', 'rejected'],
|
|
default: 'registered'
|
|
},
|
|
|
|
// files
|
|
upload: { type: Boolean, default: true },
|
|
tradeUnion: [FilesSchema],
|
|
expertise: [FilesSchema],
|
|
ownership: [FilesSchema],
|
|
repairShop: [FilesSchema],
|
|
itEmployee: [FilesSchema],
|
|
itExpert: [FilesSchema],
|
|
financialGuarantees: [FilesSchema],
|
|
//
|
|
archived: { type: Boolean, default: false },
|
|
_updatedBy: { type: mongoose.ObjectId, ref: 'User' },
|
|
_revoked: { type: Boolean, default: false },
|
|
_revokedBy: { type: mongoose.ObjectId, ref: 'User' }
|
|
})
|
|
|
|
module.exports = mongoose.model('Representation', RepresentationSchema)
|