Finalização da implementação do recurso de importar contactos em massa a partir de arquivo csv

pull/20/head
adriano 2022-11-07 17:49:44 -03:00
parent 260ab06016
commit f0714eb015
3 changed files with 26 additions and 1 deletions

View File

@ -78,6 +78,6 @@
"supertest": "^5.0.0", "supertest": "^5.0.0",
"ts-jest": "^26.4.1", "ts-jest": "^26.4.1",
"ts-node-dev": "^1.0.0-pre.63", "ts-node-dev": "^1.0.0-pre.63",
"typescript": "4.0.3" "typescript": "4.1"
} }
} }

View File

@ -171,3 +171,26 @@ export const remove = async (
return res.status(200).json({ message: "Contact deleted" }); return res.status(200).json({ message: "Contact deleted" });
}; };
export const contacsBulkInsertOnQueue = async (req: Request, res: Response): Promise<Response> => {
// console.log('THE BODY: ', req.body)
const { adminId, identifier, queueStatus, file } = req.body
const io = getIO();
io.emit("contactsBulkInsertOnQueueStatus", {
action: "update",
insertOnQueue: {
adminId: adminId,
identifier: identifier,
queueStatus: queueStatus,
file: file
}
});
return res.status(200).json({ message: 'ok' })
};

View File

@ -8,6 +8,8 @@ const contactRoutes = express.Router();
contactRoutes.post("/contacts/import", isAuth, ImportPhoneContactsController.store); contactRoutes.post("/contacts/import", isAuth, ImportPhoneContactsController.store);
contactRoutes.post("/contacts/bulk/insert/onqueue", ContactController.contacsBulkInsertOnQueue);
contactRoutes.get("/contacts", isAuth, ContactController.index); contactRoutes.get("/contacts", isAuth, ContactController.index);
contactRoutes.get("/contacts/:contactId", isAuth, ContactController.show); contactRoutes.get("/contacts/:contactId", isAuth, ContactController.show);