diff --git a/src/controllers/userController.js b/src/controllers/userController.js index 0eb9c1b0..1a6fa618 100644 --- a/src/controllers/userController.js +++ b/src/controllers/userController.js @@ -938,7 +938,7 @@ exports.createstaff = async (request, reply) => { return reply.status(400).send({ error: 'Duplicate phone numbers found', duplicatePhones }); } - + // Update the user document with the new staff members user.staff.staff.push(...newStaff); @@ -957,7 +957,7 @@ exports.createstaff = async (request, reply) => { exports.editStaff = async (request, reply) => { try { 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 }); if (!user) { diff --git a/src/routes/usersRoute.js b/src/routes/usersRoute.js index cc82207e..c49e9c33 100644 --- a/src/routes/usersRoute.js +++ b/src/routes/usersRoute.js @@ -865,7 +865,7 @@ module.exports = function (fastify, opts, next) { }, ], }, - + //preHandler: fastify.auth([fastify.authenticate]), handler: userController.createstaff, }); @@ -890,7 +890,8 @@ fastify.route({ type: "object", properties: { name: { type: "string" }, - password: { type: "string" } + password: { type: "string" }, + all_motor_access:{type:"string"} }, required: ["name", "password"] }