fileds added in department schmea

master^2
Bhaskar 8 months ago
parent 71d59c0aa2
commit 7145831d8f

@ -451,10 +451,14 @@ exports.addDepartment = async (request, reply) => {
try { try {
const { const {
phone, phone,
officeName,
alternativeContactNumber, alternativeContactNumber,
gender, gender,
personalEmail, personalEmail,
city, city,
personal_city,
reportingManager_mobile_number,
reportingManager_email,
firstName, firstName,
lastName, lastName,
departmentName, departmentName,
@ -489,6 +493,10 @@ exports.addDepartment = async (request, reply) => {
const department = new Deparments({ const department = new Deparments({
departmentId, departmentId,
alternativeContactNumber, alternativeContactNumber,
officeName,
reportingManager_mobile_number,
reportingManager_email,
personal_city,
gender, gender,
city, city,
firstName, firstName,
@ -647,7 +655,12 @@ exports.addDepartment = async (request, reply) => {
address1, address1,
address2, address2,
pincode, pincode,
desginationName desginationName,
personal_city,
reportingManager_mobile_number,
reportingManager_email,
officeName,
} = request.body; } = request.body;
@ -682,7 +695,10 @@ exports.addDepartment = async (request, reply) => {
existing.lastName = lastName || existing.lastName; existing.lastName = lastName || existing.lastName;
existing.departmentName = departmentName || existing.departmentName; existing.departmentName = departmentName || existing.departmentName;
existing.reportingManager = reportingManager || existing.reportingManager existing.reportingManager = reportingManager || existing.reportingManager
existing.personal_city = personal_city || existing.personal_city;
existing.reportingManager_mobile_number = reportingManager_mobile_number || existing.reportingManager_mobile_number;
existing.reportingManager_email = reportingManager_email || existing.reportingManager_email;
existing.officeName = officeName || existing.officeName
await existing.save(); await existing.save();

@ -76,10 +76,13 @@ const citySchema = new mongoose.Schema(
const departmentsSchema = new mongoose.Schema( const departmentsSchema = new mongoose.Schema(
{ {
departmentId:{type:String}, departmentId:{type:String},
officeName: { type: String },
desginationName: { type: String }, desginationName: { type: String },
phone: { type: String, unique: true, trim: true }, phone: { type: String, unique: true, trim: true },
alternativeContactNumber : { type: String }, alternativeContactNumber : { type: String },
reportingManager : { type: String }, reportingManager : { type: String },
reportingManager_mobile_number : { type: String },
reportingManager_email : { type: String },
location: [{ type : String}], location: [{ type : String}],
firstName : { type: String }, firstName : { type: String },
gender: { type: String }, gender: { type: String },
@ -92,6 +95,7 @@ const citySchema = new mongoose.Schema(
pincode: { type: String }, pincode: { type: String },
zone: { type: String }, zone: { type: String },
city: { type: String }, city: { type: String },
personal_city: { type: String },
state: String, state: String,
country: String, country: String,
services: { password: { bcrypt: String } }, services: { password: { bcrypt: String } },

@ -177,7 +177,7 @@ module.exports = function (fastify, opts, next) {
schema: { schema: {
tags: ["Department"], tags: ["Department"],
description: "This is for creating a new Team Member Account", description: "This is for creating a new Team Member Account",
summary: "This is for creating a new Ream Member Account", summary: "This is for creating a new Team Member Account",
body: { body: {
type: "object", type: "object",
//required: ["phone", "username", "password", "role"], // Add role to required fields //required: ["phone", "username", "password", "role"], // Add role to required fields
@ -200,6 +200,10 @@ module.exports = function (fastify, opts, next) {
lastName: { type: "string" }, lastName: { type: "string" },
reportingManager: { type: "string" }, reportingManager: { type: "string" },
email: { type: "string" }, email: { type: "string" },
personal_city: { type: "string"},
officeName: { type: "string"},
reportingManager_mobile_number: { type: "string"},
reportingManager_email: { type: "string"},
location: { location: {
type: "array", type: "array",
items: { type: "string" }, items: { type: "string" },
@ -359,6 +363,10 @@ module.exports = function (fastify, opts, next) {
departmentName: { type: "string" }, departmentName: { type: "string" },
firstName: { type: "string" }, firstName: { type: "string" },
lastName: { type: "string" }, lastName: { type: "string" },
personal_city: { type: "string"},
officeName: { type: "string"},
reportingManager_mobile_number: { type: "string"},
reportingManager_email: { type: "string"},
}, },
} }

Loading…
Cancel
Save