diff --git a/backend/controllers/chat.controller.js b/backend/controllers/chat.controller.js index e2d7d07..1a1f31e 100644 --- a/backend/controllers/chat.controller.js +++ b/backend/controllers/chat.controller.js @@ -46,6 +46,18 @@ export const sendMessage = async (req, res) => { error: "Unauthorized user", }); } + + const validationError = validateMessagePayload({ + text, + image, + audio, + }); + + if (validationError) { + return res.status(400).json({ + error: validationError, + }); + } const validationError = validateMessagePayload({ text,