Skip to content

Commit be7767c

Browse files
author
Aishwarya Nair
committed
save files
1 parent 8fcfaf6 commit be7767c

File tree

3 files changed

+0
-186
lines changed

3 files changed

+0
-186
lines changed

CollaborationService/config/config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ const SYSTEM_TERMINATE_TIMEOUT = 10 * 1000; // 10 secsS
1616
module.exports = {
1717
PORT: 3005,
1818
serverAddress: "http://collaboration-service:3005",
19-
<<<<<<< HEAD
2019
// serverAddress: "http://127.0.0.1:3005",
21-
=======
22-
// serverAddress: "http://127.0.0.1:3005",
23-
>>>>>>> origin/collab-fix
2420
matchingServiceUrl: "http://matching-service:3004",
2521
// matchingServiceUrl: "http://127.0.0.1:3004",
2622
questionServiceUrl: "http://question-service:3003/api/questions",

CollaborationService/database/collaborativeInputDb.js

Lines changed: 0 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<<<<<<< HEAD
21
const {
32
CollaborativeInput,
43
LineInput,
@@ -216,149 +215,3 @@ module.exports = {
216215
deleteCollaborativeInput,
217216
deleteCollaborativeLineInput,
218217
};
219-
=======
220-
const CollaborativeInput = require('../models/collaborationCodeModel');
221-
const axios = require('axios');
222-
const config = require('../config/config');
223-
224-
const getCollaborativeInput = async(sessionId) => {
225-
try {
226-
const dataOutput = await CollaborativeInput.findOne({ sessionId: sessionId });
227-
228-
console.log(`Get collaborative input for session ${sessionId}`);
229-
230-
return [dataOutput.initTime, dataOutput.language, dataOutput.codes];
231-
232-
} catch (error) {
233-
console.log(`Error getting collaborative input for session ${sessionId}`);
234-
235-
return ["None", "", ""];
236-
}
237-
}
238-
239-
const getCollaborativeInputByLine = async(sessionId, line) => {
240-
try {
241-
const dataOutput = await CollaborativeInput.findOne({ sessionId: sessionId, 'codes.line': line });
242-
243-
console.log(`Get collaborative input for session ${sessionId} line ${line}`);
244-
245-
return [dataOutput.language, line, dataOutput.codes[line].code];
246-
247-
} catch (error) {
248-
console.error(`Error getting collaborative input by line for session ${sessionId}`);
249-
250-
return ["None", line, ""];
251-
}
252-
}
253-
254-
const initCollaborativeCode = async(initTime, sessionId, language) => {
255-
try {
256-
const input = await getCollaborativeInput(sessionId);
257-
258-
if (input[0] === "None") {
259-
const collaborativeInput = new CollaborativeInput(
260-
{ sessionId: sessionId, initTime: initTime, language: language, codes: [] });
261-
262-
await collaborativeInput.save();
263-
264-
console.log(`Successfully added:`, collaborativeInput);
265-
266-
return [collaborativeInput.initTime, language, []];
267-
268-
} else {
269-
console.log(`Collaborative input already exists for ${sessionId}`);
270-
271-
return input;
272-
}
273-
274-
} catch (error) {
275-
console.log(`Failed to add collaborative input for ${sessionId}`);
276-
277-
return ["None", ""];
278-
}
279-
}
280-
281-
const updateCollaborativeLineInput = async(sessionId, line, code, lastModifier) => {
282-
try {
283-
let collaborativeInput = await CollaborativeInput.findOne(
284-
{ sessionId: sessionId, 'codes.line': line });
285-
286-
if (collaborativeInput) {
287-
await CollaborativeInput.updateOne(
288-
{ sessionId: sessionId, 'codes.line': line },
289-
{ $set: { 'codes.$.code': code, 'codes.$.lastModifier': lastModifier } }
290-
);
291-
292-
} else {
293-
await CollaborativeInput.updateOne(
294-
{ sessionId: sessionId },
295-
{ $push: { codes: { line: line, code: code, lastModifier: lastModifier } } }
296-
);
297-
}
298-
299-
console.log(`Successfully updated line:`, line);
300-
301-
} catch (error) {
302-
console.log(`Failed to update collaborative input for ${sessionId} line ${line}`);
303-
}
304-
}
305-
306-
const updateCollaborativeInput = async(sessionId, codes) => {
307-
try {
308-
let collaborativeInput = await CollaborativeInput.findOne({ sessionId: sessionId });
309-
const sessionReq = await axios.get(`${config.matchingServiceUrl}/getSession/${sessionId}`);
310-
311-
const session = sessionReq.data.session;
312-
313-
if (collaborativeInput.codes !== null) {
314-
collaborativeInput.codes = codes;
315-
316-
} else {
317-
collaborativeInput = new CollaborativeInput({ sessionId: sessionId, initTime: session.initTime, language: session.language, codes: codes });
318-
}
319-
320-
await collaborativeInput.save();
321-
322-
console.log(`Successfully updated:`, collaborativeInput);
323-
324-
} catch (error) {
325-
console.log(`Failed to update collaborative input for ${sessionId}`);
326-
}
327-
}
328-
329-
const deleteCollaborativeInput = async(sessionId) => {
330-
try {
331-
const result = await CollaborativeInput.deleteOne({ sessionId: sessionId });
332-
333-
console.log(`Successfully deleted:`, result);
334-
335-
} catch (error) {
336-
console.log(`Failed to delete collaborative input for ${sessionId}`);
337-
}
338-
}
339-
340-
const deleteCollaborativeLineInput = async(sessionId, line) => {
341-
try {
342-
const collaborativeInput = await CollaborativeInput.findOne({ sessionId: sessionId });
343-
344-
collaborativeInput.codes.splice(line, 1);
345-
346-
await collaborativeInput.save();
347-
348-
console.log(`Successfully deleted:`, collaborativeInput);
349-
350-
} catch (error) {
351-
console.log(`Failed to delete collaborative input for ${sessionId} line ${line}`);
352-
}
353-
}
354-
355-
module.exports = {
356-
getCollaborativeInput,
357-
getCollaborativeInputByLine,
358-
initCollaborativeCode,
359-
updateCollaborativeLineInput,
360-
updateCollaborativeInput,
361-
deleteCollaborativeInput,
362-
deleteCollaborativeLineInput
363-
}
364-
>>>>>>> origin/collab-fix

Frontend/src/Components/Collaboration/CodeEditor.jsx

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import "./CodeEditor.css";
22
import Editor from "@monaco-editor/react";
3-
<<<<<<< HEAD
43
import React, {useState, useEffect} from "react";
54
import {getUserId} from "../../User/UserState";
65

@@ -13,20 +12,6 @@ const CodeEditor = ({
1312
socket,
1413
}) => {
1514
const OriginalResizeObserver = window.ResizeObserver;
16-
=======
17-
import React from "react";
18-
19-
const CodeEditor = ({code, setCode, language, isReadOnly}) => {
20-
const OriginalResizeObserver = window.ResizeObserver;
21-
22-
// Monaco Editor Resize Fix (https://github.com/microsoft/vscode/issues/183324#issuecomment-1575484617)
23-
window.ResizeObserver = function (callback) {
24-
const wrappedCallback = (entries, observer) => {
25-
window.requestAnimationFrame(() => {
26-
callback(entries, observer);
27-
});
28-
};
29-
>>>>>>> origin/collab-fix
3015

3116
const [originalCode, setOriginalCode] = useState(code);
3217
const [originalLanguage, setOriginalLanguage] = useState(language);
@@ -40,7 +25,6 @@ const CodeEditor = ({code, setCode, language, isReadOnly}) => {
4025
}
4126
}, [code]);
4227

43-
<<<<<<< HEAD
4428
// Monaco Editor Resize Fix (https://github.com/microsoft/vscode/issues/183324#issuecomment-1575484617)
4529
window.ResizeObserver = function (callback) {
4630
const wrappedCallback = (entries, observer) => {
@@ -131,25 +115,6 @@ const CodeEditor = ({code, setCode, language, isReadOnly}) => {
131115
/>
132116
</div>
133117
);
134-
=======
135-
return (
136-
<div className="code-editor">
137-
<Editor
138-
language={language}
139-
theme="vs-light"
140-
value={code}
141-
onChange={e => {setCode(code)}}
142-
options={{
143-
inlineSuggest: true,
144-
fontSize: "16px",
145-
formatOnType: true,
146-
minimap: { enabled: false },
147-
readOnly: isReadOnly
148-
}}
149-
/>
150-
</div>
151-
);
152-
>>>>>>> origin/collab-fix
153118
};
154119

155120
export default CodeEditor;

0 commit comments

Comments
 (0)