Skip to content

Commit

Permalink
Merge pull request #1 from Tushar3099/interviewBranch
Browse files Browse the repository at this point in the history
added link routes
  • Loading branch information
tomarviii88 authored Jan 21, 2021
2 parents ed150ad + e09af38 commit 7931e7b
Show file tree
Hide file tree
Showing 21 changed files with 675 additions and 23 deletions.
2 changes: 1 addition & 1 deletion client/.eslintcache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"D:\\Webdev\\remote-code-executor\\client\\src\\components\\home\\Header.js":"1","D:\\Webdev\\remote-code-executor\\client\\src\\reducers\\actions\\index.js":"2","D:\\Webdev\\remote-code-executor\\client\\src\\components\\home\\Modal.js":"3"},{"size":2726,"mtime":1610883574576,"results":"4","hashOfConfig":"5"},{"size":408,"mtime":1610835459540,"results":"6","hashOfConfig":"5"},{"size":1661,"mtime":1610883492826,"results":"7","hashOfConfig":"5"},{"filePath":"8","messages":"9","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"j0ormm",{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"12","messages":"13","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"D:\\Webdev\\remote-code-executor\\client\\src\\components\\home\\Header.js",["14","15"],"D:\\Webdev\\remote-code-executor\\client\\src\\reducers\\actions\\index.js",[],"D:\\Webdev\\remote-code-executor\\client\\src\\components\\home\\Modal.js",["16","17"],{"ruleId":"18","severity":1,"message":"19","line":51,"column":20,"nodeType":"20","messageId":"21","endLine":51,"endColumn":22},{"ruleId":"22","severity":1,"message":"23","line":75,"column":15,"nodeType":"24","endLine":79,"endColumn":17},{"ruleId":"25","severity":1,"message":"26","line":23,"column":6,"nodeType":"27","endLine":23,"endColumn":11,"suggestions":"28"},{"ruleId":"22","severity":1,"message":"23","line":32,"column":7,"nodeType":"24","endLine":36,"endColumn":9},"eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","unexpected","jsx-a11y/alt-text","img elements must have an alt prop, either with meaningful text, or an empty string for decorative images.","JSXOpeningElement","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'unclick'. Either include it or remove the dependency array. If 'unclick' changes too often, find the parent component that defines it and wrap that definition in useCallback.","ArrayExpression",["29"],{"desc":"30","fix":"31"},"Update the dependencies array to be: [ref, unclick]",{"range":"32","text":"33"},[727,732],"[ref, unclick]"]
[{"/media/shweta/New Volume/projects/RCE-aasf/remote-code-executor/client/src/components/home/Home.js":"1"},{"size":1283,"mtime":1610541864648,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"kizngo","/media/shweta/New Volume/projects/RCE-aasf/remote-code-executor/client/src/components/home/Home.js",[]]
14 changes: 14 additions & 0 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/src/components/code-editor/utils/languages/cpp.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const code =
'#include<iostream.h>\nusing namespace std;\nint main()\n{\n\t//Code\n\tcout<<"Hello World";\n\treturn 0;\n}';
'#include<iostream>\nusing namespace std;\nint main()\n{\n\t//Code\n\tcout<<"Hello World";\n\treturn 0;\n}';

export default code;
206 changes: 206 additions & 0 deletions rce-server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rce-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"dotenv": "^8.2.0",
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.11.12",
"pino": "^6.7.0",
"socket.io": "^3.0.5",
"swagger-express-middleware": "^4.0.2",
Expand Down
29 changes: 26 additions & 3 deletions rce-server/server/api/controllers/Interview/controller.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
import Server from "../../../common/server";
import InterviewService from "../../services/interview.service";
const BASE_URI = process.env.BASE_URI;

export class Controller {
async connect(req, res) {
const uid = req.params.uid;
console.log(uid);
try {
if (!req.user) {
throw {
message: "User must be logged in!!",
};
} else {
const uid = req.params.uid;
const link = `${BASE_URI}/interview/${uid}`;
console.log(uid);
output = await InterviewService.execute(link, user);
if (output) {
res.json({
status: 200,
message: "Connected to interview",
output,
});
}
}
} catch (error) {
res.send({
status: error.status || "500",
message: error.message || "Something Went Wrong",
});
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion rce-server/server/api/controllers/Interview/router.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as express from "express";
import controller from "./controller";
import isLoggedIn from "../../middlewares/isLogged.handler";

export default express.Router().post("/:uid", controller.connect);
export default express.Router().get("/:uid", isLoggedIn, controller.connect);
Loading

0 comments on commit 7931e7b

Please sign in to comment.