Browse Source

work on call

unknown 1 year ago
parent
commit
f2bcb1726e
3 changed files with 0 additions and 44 deletions
  1. 0 27
      controllers/chats.js
  2. 0 16
      model/schemas/chat.js
  3. 0 1
      routes/chats.js

+ 0 - 27
controllers/chats.js

@@ -170,32 +170,6 @@ 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;
@@ -318,7 +292,6 @@ module.exports = {
 	startChat,
 	removeChatForBoth,
 	muteChat,
-	mediaControllersChat,
 	sortChat,
 	socketIdChat,
 	seenChat,

+ 0 - 16
model/schemas/chat.js

@@ -95,22 +95,6 @@ const chatSchema = new Schema(
 			type: String,
 			default: false,
 		},
-		mutedMyVideo: {
-			type: Boolean,
-			default: true,
-		},
-		mutedMyAudio: {
-			type: Boolean,
-			default: false,
-		},
-		companionMutedVideo: {
-			type: Boolean,
-			default: true,
-		},
-		companionMutedAudio: {
-			type: Boolean,
-			default: false,
-		},
 		owner: {
 			type: SchemaTypes.ObjectId,
 			ref: 'user',

+ 0 - 1
routes/chats.js

@@ -9,7 +9,6 @@ router
 	.get('/:companionId', guard, controllers.getChatById)
 	.post('/', guard, validation.startChat, controllers.startChat)
 	.patch('/mute/', guard, controllers.muteChat)
-	.patch('/controllers/', guard, controllers.mediaControllersChat)
 	.patch('/socketId/', guard, controllers.socketIdChat)
 	.patch('/sort/', guard, controllers.sortChat)
 	.patch('/seen/', guard, controllers.seenChat)