diff --git a/backend/routers/psOne.js b/backend/routers/psOne.js
index 2a33a64..a672c46 100644
--- a/backend/routers/psOne.js
+++ b/backend/routers/psOne.js
@@ -1,11 +1,14 @@
-const express = require('express');
+const express = require("express");
const router = new express.Router();
-const auth = require('../middleware/auth');
-const Station = require('../models/station');
+const auth = require("../middleware/auth");
+const Station = require("../models/station");
// get details of a station for ps1
-router.get('/api/1/:station', async (req, res) => {
- const station = await Station.findOne({ category: { type: 'ps1' }, slug: req.params.station });
+router.get("/api/1/:station", async (req, res) => {
+ const station = await Station.findOne({
+ category: { type: "ps1" },
+ slug: req.params.station,
+ });
if (!station) {
res.status(404).send();
@@ -16,26 +19,28 @@ router.get('/api/1/:station', async (req, res) => {
});
// search the stations by name for ps1
-router.get('/api/1', async (req, res) => {
+router.get("/api/1", async (req, res) => {
const queries = {
- category: { type: 'ps1' }
+ category: { type: "ps1" },
};
if (req.query.name) {
- queries.name = { $regex: new RegExp(req.query.name, 'i') };
+ queries.name = { $regex: new RegExp(req.query.name, "i") };
}
if (req.query.location) {
- queries.location = { $regex: new RegExp(req.query.location, 'i') };
+ queries.location = { $regex: new RegExp(req.query.location, "i") };
}
try {
- const stations = await Station.find(queries,
- 'name category field location cg slug',
+ const stations = await Station.find(
+ queries,
+ "name category field location cg slug",
{
limit: parseInt(req.query.limit),
- skip: parseInt(req.query.skip)
- });
+ skip: parseInt(req.query.skip),
+ }
+ );
res.send(stations);
} catch (e) {
@@ -44,18 +49,21 @@ router.get('/api/1', async (req, res) => {
});
// post a new comment on the opportunity for ps1
-router.post('/api/1/:station/comment', auth, async (req, res) => {
- const station = await Station.findOne({ category: { type: 'ps1' }, slug: req.params.station });
+router.post("/api/1/:station/comment", auth, async (req, res) => {
+ const station = await Station.findOne({
+ category: { type: "ps1" },
+ slug: req.params.station,
+ });
if (!station) {
- return res.status(404).send('Station not found');
+ return res.status(404).send("Station not found");
}
station.discussion.push({
comment: {
user: req.user._id,
- data: req.body.data
- }
+ data: req.body.data,
+ },
});
try {
@@ -68,23 +76,28 @@ router.post('/api/1/:station/comment', auth, async (req, res) => {
});
// post a new reply on a comment for ps1
-router.post('/api/1/:station/:comment/reply', auth, async (req, res) => {
- const station = await Station.findOne({ category: { type: 'ps1' }, slug: req.params.station });
+router.post("/api/1/:station/:comment/reply", auth, async (req, res) => {
+ const station = await Station.findOne({
+ category: { type: "ps1" },
+ slug: req.params.station,
+ });
if (!station) {
- return res.status(404).send('Station not found');
+ return res.status(404).send("Station not found");
}
// eslint-disable-next-line eqeqeq
- const commentIndex = station.discussion.findIndex((comment) => comment._id == req.params.comment);
+ const commentIndex = station.discussion.findIndex(
+ (comment) => comment._id == req.params.comment
+ );
if (commentIndex === -1) {
- return res.status(404).send('Comment not found');
+ return res.status(404).send("Comment not found");
}
station.discussion[commentIndex].comment.replies.push({
user: req.user._id,
- data: req.body.data
+ data: req.body.data,
});
try {
diff --git a/frontend/public/index.html b/frontend/public/index.html
index bdf9cea..ca6aa9a 100644
--- a/frontend/public/index.html
+++ b/frontend/public/index.html
@@ -27,7 +27,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
-
React App
+ BITSandPSes
diff --git a/frontend/src/containers/Choose/chooseComponent.js b/frontend/src/containers/Choose/chooseComponent.js
index d68a49a..8cba5fc 100644
--- a/frontend/src/containers/Choose/chooseComponent.js
+++ b/frontend/src/containers/Choose/chooseComponent.js
@@ -1,84 +1,85 @@
-import React from 'react';
-import './chooser.css';
-import { Link, Redirect } from 'react-router-dom';
+import React from "react";
+import "./chooser.css";
+import { Link, Redirect } from "react-router-dom";
//the website should be navigatable through url sharing. All base url cases will
//be diverted to this component.
-//website has 3 sub-parts. 1 for ps1, 2 for ps2, 3 for electives. If user has ever visited the
+//website has 3 sub-parts. 1 for ps1, 2 for ps2, 3 for electives. If user has ever visited the
//website in past, base url redirects to last used sub-part of the website. Otherwise, chooser helps in selecting them one.
-//user's current sub-part is always stored and updated in the localStorage.
-function Choose () {
- const storedChoice = parseInt(window.localStorage.getItem("stationNo")); //fetch user's last used sub-part of website
- if(storedChoice === 1 || storedChoice === 2 || storedChoice === 3 ) { //validation for redirecting to sub-part's home page
- return(
-
- );
- }
- else { //if not found in localStorage, render Chooser component
- return(
-
-
-
-
- BITS
- and
- PS
- es
+//user's current sub-part is always stored and updated in the localStorage.
+function Choose() {
+ const storedChoice = parseInt(window.localStorage.getItem("stationNo")); //fetch user's last used sub-part of website
+ if (storedChoice === 1 || storedChoice === 2 || storedChoice === 3) {
+ //validation for redirecting to sub-part's home page
+ return ;
+ } else {
+ //if not found in localStorage, render Chooser component
+ return (
+
+
+
+
+ BITS
+ and
+ PS
+ es
-
-
- might save you from the factories
+
+
+ might save you from the factories
-
-
-
-
- PS1
-
-
- if you lost your 60k
-
+
+
+
+
PS1
+
if you lost your 60k
-
PS1
+
PS1
-
-
-
-
- PS2
-
-
+
+
+
+
PS2
+
if you want to redeem your 60k
-
PS2
+
PS2
-
-
-
+
+
+
Electives
-
-
- Made by two lonely guys in their pyjamas, dont shove our throats
- if content on this website turns out to be slightly deviating from actual data. Just like with you,
- BITS Admin was a jerk to us too.
+
+
+ Made by two lonely guys in their pyjamas, dont shove our throats
+ if content on this website turns out to be slightly deviating from
+ actual data. Just like with you, BITS Admin was a jerk to us too.
-
- Choose the left one if you were robbed
- of 60k. Right one if you are looking
- to redeem the 60k.
+
+ Choose the left one if you were robbed of 60k. Right one if you
+ are looking to redeem the 60k.
);
}
-};
+}
-export default Choose;
\ No newline at end of file
+export default Choose;
diff --git a/frontend/src/containers/Home/CourseDisplay/courseDisplayComponent.js b/frontend/src/containers/Home/CourseDisplay/courseDisplayComponent.js
index 2a168c2..7ae6c16 100644
--- a/frontend/src/containers/Home/CourseDisplay/courseDisplayComponent.js
+++ b/frontend/src/containers/Home/CourseDisplay/courseDisplayComponent.js
@@ -1,47 +1,45 @@
-import React, { Component } from 'react';
-import './courseDisplay.css';
-import NotFound from '../../NotFound/notfoundComponent';
-import { FormGroup, Form, Input, Button} from 'reactstrap';
-import axios from 'axios';
-import RenderComment from './courseComments/courseComments'; //component to display each comment with its replies
-import { withRouter } from 'react-router-dom';
-import SearchBar from '../searchCourseNav/searchCourseNavComponent'; //component that allows to search right from course page
-import baseUrl from '../../../baseUrl'; //for directing requests to backend
+import React, { Component } from "react";
+import "./courseDisplay.css";
+import NotFound from "../../NotFound/notfoundComponent";
+import { FormGroup, Form, Input, Button } from "reactstrap";
+import axios from "axios";
+import RenderComment from "./courseComments/courseComments"; //component to display each comment with its replies
+import { withRouter } from "react-router-dom";
+import SearchBar from "../searchCourseNav/searchCourseNavComponent"; //component that allows to search right from course page
+import baseUrl from "../../../baseUrl"; //for directing requests to backend
-function RenderComments ({list, authorlist, courseSlug}) { //to render all comments in discussion container
- if(!list || list.length === 0) {
- return(
-
-
No comments
+function RenderComments({ list, authorlist, courseSlug }) {
+ //to render all comments in discussion container
+ if (!list || list.length === 0) {
+ return (
+