Varun 10 months ago
commit f6c990cba2

@ -0,0 +1,426 @@
const boom = require("boom");
const bcrypt = require('bcrypt');
const jwt = require('jsonwebtoken');
const customJwtAuth = require("../customAuthJwt");
const fastify = require("fastify")({
logger: true,
genReqId(req) {
return uuidv4();
},
});
const { Counter} = require('../models/User')
const {Department, Desgination} = require('../models/Department')
const generateDepartmentId = async () => {
const result = await Counter.findOneAndUpdate(
{ _id: 'department_id' },
{ $inc: { seq: 1 } },
{ upsert: true, new: true }
);
return result.seq;
};
const generateDesginationId = async () => {
const result = await Counter.findOneAndUpdate(
{ _id: 'desgination_id' },
{ $inc: { seq: 1 } },
{ upsert: true, new: true }
);
return result.seq;
};
exports.addDepartment = async (request, reply) => {
try {
const d_id = await generateDepartmentId();
const departmentId = `AWDP${d_id}`;
const {
//phone,
city,
state,
// password,
country,
zone,
address1,
address2,
pincode,
departmentName,
createdBy,
updatedBy,
} = request.body;
const existingStore = await Department.findOne({ departmentId });
if (existingStore) {
return reply.status(400).send({ message: 'Department is already registered' });
}
// const hashedPassword = await bcrypt.hash(password, 10);
const department = new Department({
departmentId: departmentId,
city,
// phone,
address1,
address2,
// services: { password: { bcrypt: hashedPassword } },
state,
zone,
country,
pincode,
departmentName,
createdBy,
updatedBy,
});
await department.save();
reply.send({department, message: 'Account Created Successfully' });
} catch (err) {
reply.status(500).send({ message: err.message });
}
};
exports.getSinledepartmentData = async (req, reply) => {
try {
const { departmentId } = req.params;
const department = await Department.findOne({ departmentId: departmentId });
if (!department) {
return reply.code(404).send({
success: false,
message: 'Department not found.'
});
}
reply.code(200).send({
success: true,
message: 'Department data retrieved successfully.',
data: department
});
} catch (error) {
console.error('Error fetching department data:', error);
reply.code(500).send({
success: false,
message: 'Failed to retrieve department data.',
error: error.message,
});
}
};
exports.getalldepartmants = async (req, reply) => {
try {
await Department.find()
.exec()
.then((docs) => {
reply.send({ status_code: 200, data: docs, count: docs.length });
})
.catch((err) => {
console.log(err);
reply.send({ error: err });
});
} catch (err) {
throw boom.boomify(err);
}
};
exports.getAllDepartmentsParticularFields = async (req, reply) => {
try {
const departments = await Department.find().exec();
// Grouping the data
const result = {
cities: [...new Set(departments.map((doc) => doc.city))],
zones: [...new Set(departments.map((doc) => doc.zone))],
pincodes: [...new Set(departments.map((doc) => doc.pincode))],
departments: [...new Set(departments.map((doc) => doc.departmentName))],
states: [...new Set(departments.map((doc) => doc.state))],
countries: [...new Set(departments.map((doc) => doc.country))],
};
// Sending the response
reply.send({
status_code: 200,
data: result,
count: departments.length,
});
} catch (err) {
console.error(err);
reply.send({ error: err.message });
}
};
exports.deletedepartmentInfo = async (req, reply) => {
try {
const departmentId = req.params.departmentId;
const department = await Department.findOneAndDelete({ departmentId:departmentId });
reply.send({ status_code: 200, message: 'Delete Sucessfully', department});
} catch (err) {
throw boom.boomify(err);
}
};
exports.editdepartment = async (request, reply) => {
try {
const { departmentId } = request.params;
const {
// phone,
city,
state,
country,
zone,
address1,
address2,
pincode,
departmentName
} = request.body;
const existing = await Department.findOne({ departmentId });
if (!existing) {
return reply.status(404).send({ message: 'Department not found' });
}
// const phoneExists = await Department.findOne({ phone, departmentId: { $ne: departmentId } });
// if (phoneExists) {
// return reply.status(400).send({ message: 'Phone is already registered to another user' });
// }
// existing.phone = phone || existing.phone;
existing.city = city || existing.city;
existing.state = state || existing.state;
existing.country = country || existing.country;
existing.zone = zone || existing.zone;
existing.departmentName = departmentName || existing.departmentName;
existing.pincode = pincode || existing.pincode;
existing.address1 = address1 || existing.address1;
existing.address2 = address2 || existing.address2;
await existing.save();
reply.send({ message: 'Department user updated successfully' });
} catch (err) {
reply.status(500).send({ message: err.message });
}
};
exports.addDesgination = async (request, reply) => {
try {
const d_id = await generateDepartmentId();
const desginationId = `AWDES${d_id}`;
const {
phone,
city,
firstName,
lastName,
departmentName,
reportingManager,
email,
state,
password,
country,
zone,
address1,
address2,
pincode,
desginationName,
createdBy,
updatedBy,
} = request.body;
const existingStore = await Desgination.findOne({ phone });
if (existingStore) {
return reply.status(400).send({ message: 'Phone is already registered' });
}
const hashedPassword = await bcrypt.hash(password, 10);
const department = new Desgination({
desginationId: desginationId,
city,
firstName,
lastName,
email,
reportingManager,
departmentName,
phone,
address1,
address2,
services: { password: { bcrypt: hashedPassword } },
state,
zone,
country,
pincode,
desginationName,
createdBy,
updatedBy,
});
await department.save();
reply.send({department, message: 'Account Created Successfully' });
} catch (err) {
reply.status(500).send({ message: err.message });
}
};
exports.getSinledesginationData = async (req, reply) => {
try {
const { desginationId } = req.params;
const department = await Desgination.findOne({ desginationId: desginationId });
if (!department) {
return reply.code(404).send({
success: false,
message: 'Department not found.'
});
}
reply.code(200).send({
success: true,
message: 'Designation data retrieved successfully.',
data: department
});
} catch (error) {
console.error('Error fetching department data:', error);
reply.code(500).send({
success: false,
message: 'Failed to retrieve department data.',
error: error.message,
});
}
};
exports.getalldesgination = async (req, reply) => {
try {
await Desgination.find()
.exec()
.then((docs) => {
reply.send({ status_code: 200, data: docs, count: docs.length });
})
.catch((err) => {
console.log(err);
reply.send({ error: err });
});
} catch (err) {
throw boom.boomify(err);
}
};
exports.deletedesginationInfo = async (req, reply) => {
try {
const desginationId = req.params.desginationId;
const department = await Desgination.findOneAndDelete({ desginationId:desginationId });
reply.send({ status_code: 200, message: 'Delete Sucessfully', department});
} catch (err) {
throw boom.boomify(err);
}
};
exports.editdesgination = async (request, reply) => {
try {
const { desginationId } = request.params;
const {
phone,
city,
firstName,
lastName,
email,
reportingManager,
departmentName,
state,
country,
zone,
address1,
address2,
pincode,
desginationName
} = request.body;
const existing = await Desgination.findOne({ desginationId });
if (!existing) {
return reply.status(404).send({ message: 'Designation not found' });
}
const phoneExists = await Desgination.findOne({ phone, desginationId: { $ne: desginationId } });
if (phoneExists) {
return reply.status(400).send({ message: 'Phone is already registered to another user' });
}
existing.phone = phone || existing.phone;
existing.city = city || existing.city;
existing.state = state || existing.state;
existing.country = country || existing.country;
existing.zone = zone || existing.zone;
existing.desginationName = desginationName || existing.desginationName;
existing.pincode = pincode || existing.pincode;
existing.address1 = address1 || existing.address1;
existing.address2 = address2 || existing.address2;
existing.email = email || existing.email;
existing.firstName = firstName || existing.firstName;
existing.lastName = lastName || existing.lastName;
existing.departmentName = departmentName || existing.departmentName;
existing.reportingManager = reportingManager || existing.reportingManager
await existing.save();
reply.send({ message: 'Designation user updated successfully' });
} catch (err) {
reply.status(500).send({ message: err.message });
}
};
exports.getAllDesignationsParticularFields = async (req, reply) => {
try {
const departments = await Desgination.find().exec();
// Grouping the data
const result = {
cities: [...new Set(departments.map((doc) => doc.city))],
zones: [...new Set(departments.map((doc) => doc.zone))],
pincodes: [...new Set(departments.map((doc) => doc.pincode))],
departments: [...new Set(departments.map((doc) => doc.departmentName))],
states: [...new Set(departments.map((doc) => doc.state))],
countries: [...new Set(departments.map((doc) => doc.country))],
designations: [...new Set(departments.map((doc) => doc.desginationName))],
reportingMangers: [...new Set(departments.map((doc) => doc.reportingManager))],
};
// Sending the response
reply.send({
status_code: 200,
data: result,
count: departments.length,
});
} catch (err) {
console.error(err);
reply.send({ error: err.message });
}
};

@ -42,6 +42,10 @@ exports.installSignUp = async (request, reply) => {
firstName,
lastName,
city,
designation,
reportingManager,
departmentName,
zone,
createdBy,
updatedBy,
} = request.body;
@ -75,6 +79,10 @@ exports.installSignUp = async (request, reply) => {
firstName,
lastName,
city,
designation,
reportingManager,
departmentName,
zone,
createdBy,
updatedBy,
});
@ -283,6 +291,10 @@ exports.addStore = async (request, reply) => {
const {
storename,
phone,
zone,
departmentName,
designation,
reportingManager,
contactPersonName,
contactPersonPhone,
emails,
@ -308,6 +320,8 @@ exports.addStore = async (request, reply) => {
state = null,
zip = null,
country = null,
address1 = null,
address2 = null
} = profile; // Extract profile fields
// Check if the phone is already registered
@ -329,6 +343,10 @@ exports.addStore = async (request, reply) => {
const store = new Store({
storename,
phone,
zone,
departmentName,
designation,
reportingManager,
contactPersonName,
contactPersonPhone,
storeId,
@ -346,6 +364,8 @@ exports.addStore = async (request, reply) => {
state,
zip,
country,
address1,
address2
},
longitude,
latitude,
@ -374,12 +394,16 @@ exports.addSales = async (request, reply) => {
username,
emails,
password,
zone,
departmentName,
designation,
reportingManager,
profile,
createdBy,
updatedBy,
} = request.body;
const { firstName, lastName ,address} = profile || {};
const { firstName, lastName ,address,city,state,country,zip,address1,address2} = profile || {};
const existingStore = await Sales.findOne({ phone });
if (existingStore) {
@ -394,11 +418,21 @@ exports.addSales = async (request, reply) => {
phone,
address,
emails,
zone,
departmentName,
designation,
reportingManager,
services: { password: { bcrypt: hashedPassword } },
profile: {
firstName,
lastName,
address,
city,
state,
country,
zip,
address1,
address2,
...profile,
},
createdBy,
@ -476,7 +510,11 @@ exports.editSalesUser = async (request, reply) => {
phone,
emails,
address,
profile,
profile,
zone,
reportingManager,
designation,
departmentName
} = request.body;
@ -494,12 +532,23 @@ exports.editSalesUser = async (request, reply) => {
existingSales.username = username || existingSales.username;
existingSales.phone = phone || existingSales.phone;
existingSales.emails = emails || existingSales.emails;
existingSales.zone = zone || existingSales.zone;
existingSales.reportingManager = reportingManager || existingSales.reportingManager;
existingSales.designation = designation || existingSales.designation;
existingSales.departmentName = departmentName || existingSales.departmentName;
if (profile) {
existingSales.profile.firstName = profile.firstName || existingSales.profile.firstName;
existingSales.profile.lastName = profile.lastName || existingSales.profile.lastName;
existingSales.profile.address = profile.address || existingSales.profile.address;
existingSales.profile.city = profile.city || existingSales.profile.city;
existingSales.profile.state = profile.state || existingSales.profile.state;
existingSales.profile.country = profile.country || existingSales.profile.country;
existingSales.profile.zip = profile.zip || existingSales.profile.zip;
existingSales.profile.address1 = profile.address1 || existingSales.profile.address1;
existingSales.profile.address2 = profile.address2 || existingSales.profile.address2;
}
@ -536,6 +585,11 @@ exports.editStore = async (request, reply) => {
description,
startingPrice,
password,
contactPersonPhone,
zone,
reportingManager,
designation,
departmentName
} = request.body;
@ -562,6 +616,11 @@ exports.editStore = async (request, reply) => {
existingStore.fcmId = fcmId || existingStore.fcmId;
existingStore.description = description || existingStore.description;
existingStore.startingPrice = startingPrice || existingStore.startingPrice;
existingStore.contactPersonPhone = contactPersonPhone || existingStore.contactPersonPhone;
existingStore.zone = zone || existingStore.zone;
existingStore.reportingManager = reportingManager || existingStore.reportingManager;
existingStore.designation = designation || existingStore.designation;
existingStore.departmentName = departmentName || existingStore.departmentName;
if (profile) {
@ -575,6 +634,9 @@ exports.editStore = async (request, reply) => {
existingStore.profile.state = profile.state || existingStore.profile.state;
existingStore.profile.country = profile.country || existingStore.profile.country;
existingStore.profile.zip = profile.zip || existingStore.profile.zip;
existingStore.profile.address1 = profile.address1 || existingStore.profile.address1;
existingStore.profile.address2 = profile.address2 || existingStore.profile.address2;
}

@ -588,6 +588,8 @@ fastify.register(require("./routes/supplierOrdersRoutes"));
fastify.register(require("./routes/friendRequestRoute"));
fastify.register(require("./routes/adminRoute"));
fastify.register(require("./routes/storeRoute"));
fastify.register(require("./routes/departmentRoute.js"));
// Testing route allows for retrieving a user by phone so one can see what is the phone verification code sent for a given user's phone
// Also allows deletion of a user with a given phone number

@ -0,0 +1,80 @@
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const ObjectId = Schema.Types.ObjectId;
const departmentSchema = new mongoose.Schema(
{
departmentId:{type:String},
departmentName: { type: String },
//phone: { type: String, unique: true, trim: true },
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 desginationSchema = new mongoose.Schema(
{
desginationId:{type:String},
desginationName: { type: String },
phone: { type: String, unique: true, trim: true },
reportingManager : { type: String },
firstName : { type: String },
lastName: { type: String },
email: { 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 Department = mongoose.model('Department', departmentSchema);
const Desgination = mongoose.model('Desgination', desginationSchema);
module.exports = { Department,Desgination};

@ -42,6 +42,11 @@ const installationschema = new mongoose.Schema({
address1: { type: String, default: null },
address2: { type: String, default: null },
city: { type: String, default: null },
designation: { type: String, default: null },
reportingManager: { type: String, default: null },
departmentName: { type: String, default: null },
zone: { type: String, default: null },
profile: {
state: { type: String, default: null },
@ -123,6 +128,10 @@ const installationschema = new mongoose.Schema({
passwordResetCode: { type: Number, default: 11111 },
oneTimePasswordSetFlag: { type: Boolean, default: false },
emails: {type: String},
designation: { type: String, default: null },
reportingManager: { type: String, default: null },
departmentName: { type: String, default: null },
zone: { type: String, default: null },
services: {
password: {
bcrypt: { type: String, required: true }
@ -137,6 +146,8 @@ const installationschema = new mongoose.Schema({
contactNumber: { type: String, default: null },
alternativeContactNumber: { type: String, default: null },
store_address: { type: String, default: null },
address1: { type: String, default: null },
address2: { type: String, default: null },
city: { type: String, default: null },
state: { type: String, default: null },
country: { type: String, default: null },
@ -339,13 +350,18 @@ const salesSchema = new mongoose.Schema({
}
},
description: { type: String, default: null },
designation: { type: String, default: null },
reportingManager: { type: String, default: null },
departmentName: { type: String, default: null },
zone: { type: String, default: null },
profile: {
role: [{ type: String, default: "sales" }],
firstName: { type: String, default: null },
lastName: { type: String, default: null },
contactNumber: { type: String, default: null },
alternativeContactNumber: { type: String, default: null },
address: { type: String, default: null },
address1: { type: String, default: null },
address2: { type: String, default: null },
city: { type: String, default: null },
state: { type: String, default: null },
country: { type: String, default: null },

@ -0,0 +1,308 @@
const departmentController = require('../controllers/departmentController')
module.exports = function (fastify, opts, next) {
fastify.route({
method: "POST",
url: "/api/departmentSignup",
schema: {
tags: ["Department"],
description: "This is for creating a new Department Account",
summary: "This is for creating a new Department Account",
body: {
type: "object",
//required: ["phone", "username", "password", "role"], // Add role to required fields
properties: {
// phone: { type: "string" },
// password: { type: "string" },
city: { type: "string" },
state: { type: "string" },
country: { type: "string" },
address1: { type: "string" },
address2: { type: "string" },
zone: { type: "string" },
pincode: { type: "string" },
departmentName: { type: "string" },
},
},
security: [
{
basicAuth: [],
},
],
},
handler: departmentController.addDepartment,
});
fastify.get("/api/getSingledepartmentData/:departmentId", {
schema: {
tags: ["Department"],
description: "This is for Get Single departmentId Data",
summary: "This is to Get Single departmentId Data",
params: {
type: "object",
properties: {
departmentId: {
type: "string",
description: "departmentId",
},
},
},
security: [
{
basicAuth: [],
},
],
},
handler: departmentController.getSinledepartmentData,
});
fastify.get("/api/getalldepartments", {
schema: {
tags: ["Department"],
description: "This is for Get all Department Data",
summary: "This is for to Get all Department Data",
security: [
{
basicAuth: [],
},
],
},
//preHandler: fastify.auth([fastify.authenticate]),
handler: departmentController.getalldepartmants,
});
fastify.get("/api/getalldepartmentsParticularFileds", {
schema: {
tags: ["Department"],
description: "This is for Get all Department particular fileds Data",
summary: "This is for to Get all Department particular fields Data",
security: [
{
basicAuth: [],
},
],
},
//preHandler: fastify.auth([fastify.authenticate]),
handler: departmentController.getAllDepartmentsParticularFields,
});
fastify.delete("/api/deletedepartment/:departmentId", {
schema: {
description: "Delete a Department by departmentId",
tags: ["Department"],
summary: "Delete a user by departmentId",
params: {
type: "object",
properties: {
departmentId: { type: "string" }, // Customer ID
},
required: ["departmentId"],
},
response: {
200: {
type: "object",
properties: {
success: { type: "boolean" },
message: { type: "string" },
}
}
}
},
handler: departmentController.deletedepartmentInfo,
});
fastify.put('/api/editdepartment/:departmentId', {
schema: {
description: "Edit Department details by departmentId",
tags: ["Department"],
summary: "Edit Department details.",
params: {
type: "object",
properties: {
departmentId: { type: "string" },
},
required: ["departmentId"],
},
body: {
type: "object",
properties: {
// phone: { type: "string" },
city: { type: "string" },
state: { type: "string" },
country: { type: "string" },
address1: { type: "string" },
address2: { type: "string" },
zone: { type: "string" },
pincode: { type: "string" },
departmentName: { type: "string" },
},
}
},
handler: departmentController.editdepartment,
});
fastify.route({
method: "POST",
url: "/api/desginationSignup",
schema: {
tags: ["Department"],
description: "This is for creating a new Desgination Account",
summary: "This is for creating a new Desgination Account",
body: {
type: "object",
//required: ["phone", "username", "password", "role"], // Add role to required fields
properties: {
phone: { type: "string" },
password: { type: "string" },
city: { type: "string" },
state: { type: "string" },
country: { type: "string" },
address1: { type: "string" },
address2: { type: "string" },
zone: { type: "string" },
pincode: { type: "string" },
desginationName: { type: "string" },
departmentName: { type: "string" },
firstName: { type: "string" },
lastName: { type: "string" },
reportingManager: { type: "string" },
email: { type: "string" },
},
},
security: [
{
basicAuth: [],
},
],
},
handler: departmentController.addDesgination,
});
fastify.get("/api/getSingledesginationData/:desginationId", {
schema: {
tags: ["Department"],
description: "This is for Get Single desginationId Data",
summary: "This is to Get Single desginationId Data",
params: {
type: "object",
properties: {
desginationId: {
type: "string",
description: "desginationId",
},
},
},
security: [
{
basicAuth: [],
},
],
},
handler: departmentController.getSinledesginationData,
});
fastify.get("/api/getalldesginations", {
schema: {
tags: ["Department"],
description: "This is for Get all designation Data",
summary: "This is for to Get all designation Data",
security: [
{
basicAuth: [],
},
],
},
//preHandler: fastify.auth([fastify.authenticate]),
handler: departmentController.getalldesgination,
});
fastify.delete("/api/deletedesignation/:desginationId", {
schema: {
description: "Delete a desgination by desginationId",
tags: ["Department"],
summary: "Delete a user by desginationId",
params: {
type: "object",
properties: {
desginationId: { type: "string" },
},
required: ["desginationId"],
},
response: {
200: {
type: "object",
properties: {
success: { type: "boolean" },
message: { type: "string" },
}
}
}
},
handler: departmentController.deletedesginationInfo,
});
fastify.put('/api/editdesgination/:desginationId', {
schema: {
description: "Edit Desgination details by desginationId",
tags: ["Department"],
summary: "Edit Desgination details.",
params: {
type: "object",
properties: {
desginationId: { type: "string" },
},
required: ["desginationId"],
},
body: {
type: "object",
properties: {
phone: { type: "string" },
city: { type: "string" },
state: { type: "string" },
country: { type: "string" },
address1: { type: "string" },
address2: { type: "string" },
zone: { type: "string" },
pincode: { type: "string" },
desginationName: { type: "string" },
email: { type: "string" },
reportingManager: { type: "string" },
departmentName: { type: "string" },
firstName: { type: "string" },
lastName: { type: "string" },
},
}
},
handler: departmentController.editdesgination,
});
fastify.get("/api/getalldesignationsParticularFileds", {
schema: {
tags: ["Department"],
description: "This is for Get all Designation particular fileds Data",
summary: "This is for to Get all Designation particular fields Data",
security: [
{
basicAuth: [],
},
],
},
//preHandler: fastify.auth([fastify.authenticate]),
handler: departmentController.getAllDesignationsParticularFields,
});
next();
};

@ -31,6 +31,10 @@ module.exports = function (fastify, opts, next) {
//name: { type: 'string' },
team: { type: 'string', default: null },
zone: { type: 'string', default: null },
designation: { type: 'string', default: null },
reportingManager: { type: 'string', default: null },
departmentName: { type: 'string', default: null },
manager: { type: 'string', default: null },
address: { type: 'string', default: null },
address1: { type: 'string', default: null },
@ -102,6 +106,10 @@ fastify.post('/api/stores', {
properties: {
storename: { type: "string" },
password: {type: "string"},
zone: { type: 'string', default: null },
designation: { type: 'string', default: null },
reportingManager: { type: 'string', default: null },
departmentName: { type: 'string', default: null },
phone: { type: "string", unique: true, trim: true },
contactPersonName: { type: "string" },
contactPersonPhone: { type: "string", unique: true, trim: true },
@ -117,6 +125,8 @@ fastify.post('/api/stores', {
contactNumber: { type: "string", default: null },
alternativeContactNumber: { type: "string", default: null },
store_address: { type: "string", default: null },
address1: { type: 'string', default: null },
address2: { type: 'string', default: null },
city: { type: "string", default: null },
state: { type: "string", default: null },
country: { type: "string", default: null },
@ -143,6 +153,11 @@ fastify.post('/api/salesSignUp', {
type: "object",
properties: {
username: { type: "string" },
designation: { type: 'string', default: null },
reportingManager: { type: 'string', default: null },
departmentName: { type: 'string', default: null },
zone: { type: 'string', default: null },
phone: { type: "string" },
password: { type: "string" },
emails: { type: "string" },
@ -153,6 +168,12 @@ fastify.post('/api/salesSignUp', {
firstName: { type: "string" },
lastName: { type: "string" },
address: { type: "string" },
city: { type: 'string', default: null },
state: { type: 'string', default: null },
zip: { type: 'string', default: null },
country: { type: 'string', default: null },
address1: { type: 'string', default: null },
address2: { type: 'string', default: null },
},
required: ["firstName", "lastName"]
}
@ -262,6 +283,10 @@ fastify.put('/api/editSalesUser/:salesId', {
properties: {
username: { type: "string" },
phone: { type: "string" },
zone: { type: 'string', default: null },
designation: { type: 'string', default: null },
reportingManager: { type: 'string', default: null },
departmentName: { type: 'string', default: null },
password: { type: "string" },
emails: { type: "string" },
address: { type: "string" },
@ -270,7 +295,13 @@ fastify.put('/api/editSalesUser/:salesId', {
properties: {
firstName: { type: "string" },
lastName: { type: "string" },
address: { type: "string" }
address: { type: "string" },
city: { type: 'string', default: null },
state: { type: 'string', default: null },
zip: { type: 'string', default: null },
country: { type: 'string', default: null },
address1: { type: 'string', default: null },
address2: { type: 'string', default: null },
},
}
@ -302,6 +333,10 @@ fastify.put('/api/editStore/:storeId', {
address1: { type: "string" },
address2: { type: "string" },
emails: { type: "string" },
zone: { type: 'string', default: null },
designation: { type: 'string', default: null },
reportingManager: { type: 'string', default: null },
departmentName: { type: 'string', default: null },
profile: {
type: "object",
properties: {
@ -314,6 +349,8 @@ fastify.put('/api/editStore/:storeId', {
state: { type: "string" },
country: { type: "string" },
zip: { type: "string" },
address1: { type: 'string', default: null },
address2: { type: 'string', default: null },
},
},
alternativeNumber: { type: "string" },
@ -322,7 +359,7 @@ fastify.put('/api/editStore/:storeId', {
fcmId: { type: "string" },
description: { type: "string" },
startingPrice: { type: "string" },
password: { type: "string" },
contactPersonPhone: { type: "string" },
},
required: ["phone"],
}
@ -400,9 +437,9 @@ fastify.delete("/api/deleteInstaller/:installationId", {
fastify.put("/api/updaeInstaller/:installationId", {
schema: {
description: "Update user details by installationId",
description: "Update installer details by installationId",
tags: ["Install Management"],
summary: "Update user",
summary: "Update installer details by installationId",
params: {
type: "object",
properties: {
@ -417,6 +454,10 @@ fastify.put("/api/updaeInstaller/:installationId", {
password: { type: "string" },
emails: { type: "array", items: { type: "object", properties: { email: { type: "string" } } } },
team: { type: "string" },
zone: { type: 'string', default: null },
designation: { type: 'string', default: null },
reportingManager: { type: 'string', default: null },
departmentName: { type: 'string', default: null },
manager: { type: "string" },
address: { type: "string" },
address1: { type: "string" },

Loading…
Cancel
Save