You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.2 KiB

const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const ObjectId = Schema.Types.ObjectId;
const citySchema = new mongoose.Schema(
{
cityId:{type:String},
//departmentName: { type: String },
phone: { type: String, unique: true, trim: true },
office_address1: String,
officeName: { type: String },
email: { type: String },
address2: String,
pincode: { type: String },
zone: { type: String },
city: { type: String },
location: [{ type : String}],
state: String,
country: String,
services: { password: { bcrypt: String } },
createdAt: {
type: Date,
default: function () {
return Date.now();
},
},
createdBy: ObjectId,
updatedAt: {
type: Date,
default: function () {
return Date.now();
},
},
updatedBy: ObjectId,
},
{ versionKey: false }
);
const departmentsSchema = new mongoose.Schema(
{
departmentId:{type:String},
desginationName: { type: String },
phone: { type: String, unique: true, trim: true },
alternativeContactNumber : { type: String },
reportingManager : { type: String },
location: [{ type : String}],
firstName : { type: String },
gender: { type: String },
lastName: { type: String },
email: { type: String },
personalEmail : {type: String},
departmentName: { type: String },
address1: String,
address2: String,
pincode: { type: String },
zone: { type: String },
city: { type: String },
state: String,
country: String,
services: { password: { bcrypt: String } },
createdAt: {
type: Date,
default: function () {
return Date.now();
},
},
createdBy: ObjectId,
updatedAt: {
type: Date,
default: function () {
return Date.now();
},
},
updatedBy: ObjectId,
},
{ versionKey: false }
);
const City = mongoose.model('City', citySchema);
const Deparments = mongoose.model('Deparments', departmentsSchema);
module.exports = { City,Deparments};