diff --git a/backend/src/controllers/MessageController.ts b/backend/src/controllers/MessageController.ts index c492e13..4d22ec7 100644 --- a/backend/src/controllers/MessageController.ts +++ b/backend/src/controllers/MessageController.ts @@ -1,6 +1,9 @@ import { Request, Response } from "express"; +// import { getIO } from "../libs/socket"; + import CreateMessageService from "../services/MessageServices/CreateMessageService"; import ListMessagesService from "../services/MessageServices/ListMessagesService"; + // import Sequelize from "sequelize"; // import { MessageMedia } from "whatsapp-web.js"; // import Message from "../models/Message"; @@ -9,7 +12,6 @@ import ListMessagesService from "../services/MessageServices/ListMessagesService // import Whatsapp from "../models/Whatsapp"; // import Ticket from "../models/Ticket"; -// import { getIO } from "../libs/socket"; // import { getWbot } from "../libs/wbot"; // const setMessagesAsRead = async ticket => { diff --git a/backend/src/controllers/SessionController.ts b/backend/src/controllers/SessionController.ts index 2f2e216..89a44fb 100644 --- a/backend/src/controllers/SessionController.ts +++ b/backend/src/controllers/SessionController.ts @@ -8,7 +8,9 @@ export const store = async (req: Request, res: Response): Promise => { const { token, user } = await AuthUserService({ email, password }); return res.status(200).json({ - user, - token + token, + username: user.name, + profile: user.profile, + userId: user.id }); }; diff --git a/backend/src/controllers/SettingController.ts b/backend/src/controllers/SettingController.ts index 1d7411d..1ecb52e 100644 --- a/backend/src/controllers/SettingController.ts +++ b/backend/src/controllers/SettingController.ts @@ -1,10 +1,10 @@ import { Request, Response } from "express"; +import { getIO } from "../libs/socket"; import AppError from "../errors/AppError"; import UpdateSettingService from "../services/SettingServices/UpdateSettingService"; import ListSettingsService from "../services/SettingServices/ListSettingsService"; -// const { getIO } = require("../libs/socket"); export const index = async (req: Request, res: Response): Promise => { if (req.user.profile !== "admin") { @@ -31,11 +31,11 @@ export const update = async ( value }); - // const io = getIO(); - // io.emit("settings", { - // action: "update", - // setting - // }); + const io = getIO(); + io.emit("settings", { + action: "update", + setting + }); return res.status(200).json(setting); };