Git Product home page Git Product logo

masters-information-portal's Introduction

Master's Information Portal

Repository for the Unicode 2019 - 2020 project Master's Information Portal.

File Structure

.
β”œβ”€β”€ .github/                -> CI/CD Workflow hooks of github
β”œβ”€β”€ config/                 -> Configuration settings of various middlewares used like DB, Loggers, etc
β”œβ”€β”€ constants/              -> Values of various constant strings used in notifications etc.
β”œβ”€β”€ controllers/            -> Contains request handling functions of all routes in respective files
β”œβ”€β”€ docs/                   -> Contains generated docs after build scripts
β”œβ”€β”€ infra/                  -> Contains reusable functions related to encryption,authentication etc.
β”œβ”€β”€ middleware/             -> Contains custom middlewares for authentication, file upload etc.
β”œβ”€β”€ models/                 -> Contains DB models
β”œβ”€β”€ routes/                 -> Files exporting respective routers connecting routes to function in controllers
β”œβ”€β”€ test/                   -> Contains Chai and Mocha tests for routes
β”œβ”€β”€ webapp/                 -> Contains Frontend React pages
β”œβ”€β”€ .env.development        -> .env file for development
β”œβ”€β”€ app.js                  -> Sets up express app with routers, middlewares etc and exports it
β”œβ”€β”€ build.sh                -> Shell script for building fonrtend and backend
β”œβ”€β”€ index.js                -> Connects to DB and starts the server, file to be run for starting the app
└── package.json            -> Npm package.json file

Technology Stack

Backend

  • Node.js v12.18.3
  • Express.js v4.17.1
  • Mongoose v5.8.10
  • Multer v1.4.2
  • Socket.io v2.3.0

Frontend

  • HTML5
  • CSS3
  • ReactJs (16.6+)
  • Material-UI (4.9.0)
  • ES6 JavaScript
  • formik (2.1.3)
  • aos (2.3.4)
  • axios (0.19.2)

Features

Sign Up and Authentication

One can Sign up as either MS pursuing Senior or BE pursuing junior. For Seniors, it takes name, email, field of interests, colleges applied for and college studying in, other profile links, etc.

Chats

Seniors and juniors can chat with each other in real time

Forum

One can ask questions that can be seen and answered by any member in forums. Questions and Answers can be pinned,liked, and upvoted.

Notifications

One gets Notifications of various activities such as Chats, questions and answers in forums, etc

Tags

One can follow various tags , and the person can get recommendations based on the tags that they follow. Tags can be of various topics, subjects and universities. Creation of new tags is only allowed to Admins

Screenshots

Homepage:

Homepage

Login:

Login

Signup:

Signup

Signup

Edit Profile:

Edit Profile

Profile Page:

Profile Page

Profile Page

Search Pages:

Search

Search

University Page:

University

Forum Pages:

Forum

Forum

Forum

Chat:

Chat

Add Resource:

Add Resource

Question Reply:

Question Reply

Team

Developers

  • Heth Gala
  • Jay Mehta
  • Naman Dangi
  • Yash Chachad
  • Yashodhan Joshi
  • Nimit Vasavat
  • Himanshu Sanklecha
  • Siddharth Salvi
  • Yatharth Vyas

Mentors

  • Siddharth Sanghavi
  • Vikrant Gajria
  • Shail Shah
  • Ayush Shah

Build Instructions

Run npm run build for building front-end and back-end. Run npm run start for starting the app.

Development Instructions

  1. We have configured the precommit hook for frontend following the eslint airbnb guidelines along with prettier code formatting. So make sure to follow the above guideline otherwise code will not be commited.

LICENSE

MIT License

Copyright (c) 2020 Unicode

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

masters-information-portal's People

Contributors

ayushshah381 avatar heth0218 avatar himan-2000 avatar jaypajji4444 avatar namandangi avatar nimit98 avatar shailshah76 avatar siddinc avatar sidsalvi20 avatar xvjg avatar yash-chad avatar yatharthvyas avatar yjdoc2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

masters-information-portal's Issues

Revamp Forum model for answers referencing

  • Remove answers from the forum schema and add two fields: isAnswer (Boolean) and parentId(object_id)
  • This logic treats a question and answer as being objects from the same schema. The only difference between a question and answer are isAnswer which will be true for and answer and false otherwise.
  • if isAnswer == true then set parentId as questions object_id
    else if isAnswer == false then set parentId as null
  • Make a mongoose pre-hook implementing the aforementioned logic (throw validation_error if not question/answer object is in an invalid format)

Problems with tag slugs

  • Currently if you put "name": "Manchester United" it gets converted into "manchesterunited". Slug should replace space with dash (-). Maybe install Lodash package and use _.kebabCase() function., it'll solve the issue.

  • Slug should be unique.

Add University Page

The page should contain the following components:

  1. Navbar and Search components
  2. Main section including University details such as location, GRE,TOEFL,IELTS scores required,average fees, recent admits, etc.

Refer the design link for further reference.
Use reusable components for navbar/searchbar and wherever applicable.

Add and serve apiDoc documentation (for Forum)

Github: apiDoc

Documentation can include the following annotations:

  • @api for method, route, and 1 line description
  • @apiName for naming a route
  • @apiDescription, if required, for special routes or special notes.
  • @apiGroup for each resource (Forum)
  • @apiParam for the fields which can be passed in body or filter.
  • @apiPermission, first use @apiDefine in auth middleware to define the user permission model, then use that in authRequired routes.
  • @apiSuccessto define the fields in response document.

Avoid @apiError and @apiHeader for now.

Add roles to user model

  • Add roles for user: 'Admin' (if roles array is empty, it means he/she is a normal user)
  • Add user role authorization middleware to be used in routes
  • middleware should be of the format eg:
    hasRoles(listRoles) {
    return function(req, res, next) {...};
    }
  • add this middleware in routes for eg:
    routes.get('/', loginRequired, hasRoles(['Admin']))
  • Also add roles as a key in JWT having value as an array of roles for that particular user

Add User Feed Page

The following Page should have

  1. Search bar
  2. Navbar
  3. A component dealing with the questions
  4. Filtering options like Trending, by University etc

Refer the Design template for further reference.

Use reusable components for navbar/searchbar and wherever applicable.

Add and serve apiDoc documentation (for User)

Github: apiDoc

Documentation can include the following annotations:

  • @api for method, route, and 1 line description
  • @apiName for naming a route
  • @apiDescription, if required, for special routes or special notes.
  • @apiGroup for each resource (User)
  • @apiParam for the fields which can be passed in body or filter.
  • @apiPermission, first use @apiDefine in auth middleware to define the user permission model, then use that in authRequired routes.
  • @apiSuccessto define the fields in response document.

Avoid @apiError and @apiHeader for now.

Add Profile Page

The page should have the components:

  1. Navbar and Search component
  2. Header section including Profile Pic, Personal Details, Social links, etc.
  3. The main section should have 3 options:
    a] Profile
    b] University Applications
    c] Questions
  4. Hence, 3 different pages required.

Refer the design link for further reference.
Use reusable components for navbar/searchbar and wherever applicable.

Add Forum model and routes

Schema would be this for now (subject to change in the future)

  • question
    • titile: String
    • text: String
    • poster: ObjectId>User
    • createdAt: Date
    • updatedAt: Date
    • upvoters: [ObjectId>User]
    • downvotes: [ObjectId>User]
  • answers: [Array of the following schema]
    • text: String
    • poster: ObjectId>User
    • createdAt: Date
    • updatedAt: Date
    • upvoters: [ObjectId>User]
    • downvotes: [ObjectId>User]
    • pinned: Boolean (default: false)

Add User model and authentication support

You'll have to add support as well. This includes the "auth required" middleware which will be used by others.

Schema would be this for now (subject to change in the future)

  • email: String
  • password: String
  • biography: String
  • graduationYear: Number
  • socialLinks: [Array of the following schema]
  • currentSchool: [ObjectId>Tag]
  • accepts: [ObjectId>Tag]
  • rejects: [ObjectId>Tag]
  • pinnedQuestions: [ObjectId>Forum]

Add { new: true } to all update routes

To return the updated docs, we have to add this option:

const user = await User.findByIdAndUpdate(req.user._id,req.body,{
    new : true
});

Add this to PUT request of Tags and Forum as well.

Add actions to Forum routes

/:id/upvote -> Append request user to upvoters
/:id/downvote -> Append request user to downvoters
/:id/pin -> If owner, add to user's pinned posts

Add followers support to tags and users

Model Changes

Many to many relationship:

  • Add followers: [ObjectID->User] to Tag model
  • Add tagFollows: [ObjectID->Tags] to User model

Route Changes

/:slug/follow -> Adds tag._id to user's tagFollows, and user._id to tag's followers.
/:slug/unfollow -> Removes tag._id from user's tagFollows, and user._id from tag's followers.

Add Chat model and routes

Schema would be this for now (subject to change in the future)

  • persons: [ObjectId>User]
  • messages: [Array of the following schema]
    • text: String
    • timestamp: Date
    • sender: [ObjectId>User]

Add supporting libraries

For now add the following:

  • Winston for logging, we need a good logging framework and pipeline. All logs should go on terminal as well as a file.
  • Dotenv for environment variables. Make two dotenv files: .env and .env.development for when NODE_ENV=development.
  • A pipeline for deploying using one command. Basically, a script file build.sh which would build react, and start the backend server.
  • Add COR to express, only allow localhost:3000 for react.

Add and serve apiDoc documentation (for Tags)

Github: apiDoc

  • Add a package.json script docs which will generate the documentation into a folder, docs/
  • Serve the docs in express at route /api/docs
  • Document Tag route first, then we can decide how to document the whole project.

Documentation can include the following annotations:

  • @api for method, route, and 1 line description
  • @apiName for naming a route (GetTagList, GetTagBySlug)
  • @apiDescription, if required, for special routes or special notes.
  • @apiGroup for each resource (Tag)
  • @apiParam for the fields which can be passed in body or filter.
  • @apiPermission, first use @apiDefine in auth middleware to define the user permission model, then use that in authRequired routes.
  • @apiSuccessto define the fields in response document.

Avoid @apiError and @apiHeader for now.

Add Tag model and routes

Instead of having random strings as "tags" we can have tags which are monitored. So if there's a University or a Domain that becomes a tag for a question or a user. This would make managing the website much more easier with a single model, plus you have good support for autocomplete if you have a fixed database of tags.

Schema would be this for now (subject to change in the future)

  • name: String
  • isSchool: Boolean (default: false)

Add tests

Using Mocha and Chai, test

  • All HTTP endpoints
  • SocketIO

Searching forum posts and filter by tag slugs

  • We should be able to fuzz search through an endpoint.
    See: https://fusejs.io or any other library which may be better.

It should fuzzy search through all of post's question attributes, and tags. Answers you can skip.

  • Add Tags to Forum model. Forum post can have an array of Tags as objectID refs.

  • Add special handling of filtering by tags in GET / of posts. Discuss this with us before implementing.

Add and serve apiDoc documentation (for Chat)

Github: apiDoc

Documentation can include the following annotations:

  • @api for method, route, and 1 line description
  • @apiName for naming a route
  • @apiDescription, if required, for special routes or special notes.
  • @apiGroup for each resource (Chat)
  • @apiParam for the fields which can be passed in body or filter.
  • @apiPermission, first use @apiDefine in auth middleware to define the user permission model, then use that in authRequired routes.
  • @apiSuccessto define the fields in response document.

Avoid @apiError and @apiHeader for now.

JWT token refresh

Since the token expires in 1day, client should refresh the expired token without having to re-send the username/ password.

Make a route for this in user controllers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.