ashok 10 months ago
commit 5163f0bc26

@ -938,7 +938,7 @@ exports.createstaff = async (request, reply) => {
return reply.status(400).send({ error: 'Duplicate phone numbers found', duplicatePhones }); return reply.status(400).send({ error: 'Duplicate phone numbers found', duplicatePhones });
} }
// Update the user document with the new staff members // Update the user document with the new staff members
user.staff.staff.push(...newStaff); user.staff.staff.push(...newStaff);
@ -954,10 +954,11 @@ exports.createstaff = async (request, reply) => {
exports.editStaff = async (request, reply) => { exports.editStaff = async (request, reply) => {
try { try {
const { customerId, phone } = request.params; const { customerId, phone } = request.params;
const { name, password } = request.body; const { name, password,all_motor_access } = request.body;
const user = await User.findOne({ customerId, "staff.staff.phone": phone }); const user = await User.findOne({ customerId, "staff.staff.phone": phone });
if (!user) { if (!user) {

@ -865,7 +865,7 @@ module.exports = function (fastify, opts, next) {
}, },
], ],
}, },
//preHandler: fastify.auth([fastify.authenticate]), //preHandler: fastify.auth([fastify.authenticate]),
handler: userController.createstaff, handler: userController.createstaff,
}); });
@ -890,10 +890,12 @@ fastify.route({
type: "object", type: "object",
properties: { properties: {
name: { type: "string" }, name: { type: "string" },
password: { type: "string" } password: { type: "string" },
all_motor_access:{type:"string"}
}, },
required: ["name", "password"] required: ["name", "password"]
} }
}, },
handler: userController.editStaff, handler: userController.editStaff,
}); });

Loading…
Cancel
Save