feat: add queue and assoc with whatsapps

This commit is contained in:
canove
2021-01-08 17:41:08 -03:00
parent a12c9db731
commit 9f99245dc4
14 changed files with 217 additions and 7 deletions

View File

@@ -11,6 +11,7 @@ import UpdateWhatsAppService from "../services/WhatsappService/UpdateWhatsAppSer
interface WhatsappData {
name: string;
queueIds: number[];
status?: string;
isDefault?: boolean;
}
@@ -22,15 +23,16 @@ export const index = async (req: Request, res: Response): Promise<Response> => {
};
export const store = async (req: Request, res: Response): Promise<Response> => {
const { name, status, isDefault }: WhatsappData = req.body;
const { name, status, isDefault, queueIds }: WhatsappData = req.body;
const { whatsapp, oldDefaultWhatsapp } = await CreateWhatsAppService({
name,
status,
isDefault
isDefault,
queueIds
});
StartWhatsAppSession(whatsapp);
// StartWhatsAppSession(whatsapp);
const io = getIO();
io.emit("whatsapp", {