|
@@ -170,6 +170,32 @@ const muteChat = async (req, res, next) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const mediaControllersChat = async (req, res, next) => {
|
|
|
+ try {
|
|
|
+ const { companionId, mutedMyVideo, mutedMyAudio } = req.body;
|
|
|
+ const userId = req.user.id;
|
|
|
+ const isChat = await ChatModel.getByField(companionId, userId);
|
|
|
+ const isCompanionChat = await ChatModel.getByField(companionId, userId);
|
|
|
+ if (isChat && isCompanionChat) {
|
|
|
+ await ChatModel.update(isChat._id, userId, {
|
|
|
+ mutedMyVideo,
|
|
|
+ mutedMyAudio,
|
|
|
+ });
|
|
|
+ await ChatModel.update(isCompanionChat._id, companionId, {
|
|
|
+ companionMutedVideo: mutedMyVideo,
|
|
|
+ companionMutedAudio: mutedMyAudio,
|
|
|
+ });
|
|
|
+ return res.status(200).json({
|
|
|
+ status: 'success',
|
|
|
+ code: 200,
|
|
|
+ data: {},
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ next(e);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
const sortChat = async (req, res, next) => {
|
|
|
try {
|
|
|
const id = req.body.id;
|
|
@@ -292,6 +318,7 @@ module.exports = {
|
|
|
startChat,
|
|
|
removeChatForBoth,
|
|
|
muteChat,
|
|
|
+ mediaControllersChat,
|
|
|
sortChat,
|
|
|
socketIdChat,
|
|
|
seenChat,
|