@ -938,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,6 +63,7 @@ const userSchema = new mongoose.Schema(
survey_status:{ type:String,default: "pending" },
staff: {
staff: [
{
name: { type: String },
@ -865,6 +865,7 @@ module.exports = function (fastify, opts, next) {
},
],
//preHandler: fastify.auth([fastify.authenticate]),
handler: userController.createstaff,
});