Bhaskar 8 months ago
commit b3f9043f08

@ -928,6 +928,7 @@ exports.createstaff = async (request, reply) => {
name: member.name || null,
phone: member.phone || null,
password: member.password || null,
all_motor_access:member.all_motor_access,
status: "active", // Default status
});
}
@ -937,6 +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);

@ -63,11 +63,12 @@ const userSchema = new mongoose.Schema(
survey_status:{ type:String,default: "pending" },
staff: {
staff: [
{
name: { type: String },
phone: { type: String },
all_motor_access: { type: String },
password: { type: String, default: null },
status: { type: String, default: "active" },

@ -851,6 +851,7 @@ module.exports = function (fastify, opts, next) {
phone: { type: "string", default: null },
password:{ type: "string" ,default: null},
all_motor_access:{ type: "string" ,default: "read"},
},
},
@ -864,6 +865,7 @@ module.exports = function (fastify, opts, next) {
},
],
},
//preHandler: fastify.auth([fastify.authenticate]),
handler: userController.createstaff,
});

Loading…
Cancel
Save