Git Product home page Git Product logo

project-x's Introduction

Project X

Getting Started

Prerequisites

  • Node 14

  • Yarn v1

    This project is a monorepo, so Yarn was chosen for better dependency management

Setup

  1. Install dependencies

    yarn
  2. Copy packages/api/.env.sample to packages/api/.env.local

    cp packages/api/.env.sample packages/api/.env.local
  3. Run the setup script

    yarn setup

    This script will build any required files so that the two packages (api and web) can work together

  4. Start the development server

    yarn dev

    When you see this success message, open the url to load the site

    ๐Ÿš€ Listening at http://localhost:3000

    The server starts before Next.js finishes compiling, so the first time may take a little bit to load

  5. Start developing

Setting up the Github OAuth

  • Login to github, then at the top right click on the icon and go to settings.

  • Find the developer settings, then click on OAuth Apps, and create a new OAuth app.

  • Name the application, homepage 'URL' should be http://localhost:3000

  • The callback URL should be http://localhost:3000/api/auth/callback/github

  • Next, use the Client Id from the output of the app creation to replace the value of GITHUB_CLIENT_ID within your .env.local

  • Generate a Client Secret ID from GitHub and use it to replace the value of GITHUB_SECRET within your .env.local

Setting up Discord OAuth

  • Go to the Discord Develop Portal and log in.

  • Create a new application and name it, then go to the OAuth2 settings of the application.

  • Specify http://localhost:3000/api/auth/discord/callback as the redirect URL for local development.

  • For production enviornments localhost:3000 should be replaced with the correct host address and port number.

  • Within the OAuth2 URL Generator, select the correct redirect URL. Specify the identify scope, and save your changes.

  • In .env.local:

    1. Copy the Client ID and update the DISCORD_CLIENT_ID value.

    2. Reveal and copy the Client Secret and update the DISCORD_SECRET value.

Setting up Discord Server

  • Go to the Discord App and create a new server.
  • Navigate to "Invite People". This can be found in the dropdown panel next to your server name in the upper-left corner.
  • In the pop-up a link is displayed. The link by default will last for 7 days.
  • To create a permanent link navigate to the "Invite People" window and click on "Edit invite link" at the bottom of the window.
  • Select "Never" for expiration and "No limit" for the number of uses.

Learn More

To learn more about Next.js, take a look at the following resources:

Contributing

Interested in contributing to the project? Check out our Contributing Guidelines.

project-x's People

Contributors

ayushagarwal0316 avatar johnkahn avatar notkevin avatar ntxnick avatar spencerkaiser avatar tevinbeckwith avatar txtonylee avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

project-x's Issues

Allowing editing user profile information on profile page

Pre-requisites

#10 Create a profile page
#18 Create API endpoint that updates user profile information

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

  • Add button on user profile page to edit the editable fields.
  • Display form showing the editable fields and the current values.
  • Send edited data to users patch API.

Describe alternatives you've considered

Additional context

SPIKE: Discord and User linking

Pre-requisites

Is your feature request related to a problem? Please describe.

We need to be able to link a user's account with their Discord account so we can tie a Discord user back to them in our platform.

Describe the solution you'd like

A user should be able to click a button on their profile to go through the Discord OAuth flow and link their accounts.

Describe alternatives you've considered

N/A

Additional context

This is just a spike. You won't have a PR for it by next week, but we will want to go over your findings. Instead of a PR, post your findings in this issue. If you have some code as an example, link to that branch in a comment here so we can check it out.

Create API endpoint that returns user profile information

Dependent On

Is your feature request related to a problem? Please describe.

Need to retrieve user's profile information from the database in order display it on the user's profile page.

Describe the solution you'd like

Request Type: GET
Format: JSON
Parameter: user id (url parameter, /api/users/:userId)

Build Contribution Pull Request Box

Pre-requisites

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

A component needs to be built to format what a single (PR) contribution should look like when used for the Contribution page.
It should have these attributes:

  • title
  • contribution type
  • repository
  • url link to the source object

Describe alternatives you've considered

Additional context

Create Video and Community Database Tables Schema

Multiple database table schema need to be created for videos and community engagement.

  • A table that holds label names need to be created. These labels will be used to tag videos, questions, channels, and other entities.
  • A table that holds discord/slack channel names need to be created. These channels will be used to organized discussion into similar topics.
  • A table that hold video data. This will be used so that we know where to get each video from.
  • A mapping table that holds channel and label mappings. This approach is taken just in case we want to have multiple labels on a channel.
  • A mapping table that holds video and label mappings. This approach is taken just in case we want to have multiple labels on a video.

The label table should be named "Label" and needs the following fields:

  • label_id (auto incremented int)
  • label_name (varchar 50) not null

The channel table should be named "Channel" and needs the following fields:

The video table should be named "Video" and needs the following fields:

  • video_id (auto incremented int)
  • title (varchar 100) not null
  • length (int) not null
  • video_location (varchar max) nullable
  • thumbnail_location (varchar max) nullable

The channel label mapping table should be named "ChannelLabel" and needs the following fields:

  • channel_id (this should be a foreign key from the Channel table) not null
  • label_id (this should be a foreign key from the Label table) not null
    These fields should form a composite key

The video label mapping table should be named "VideoLabel" and needs the following fields:

  • video_id (this should be a foreign key from the Video table) not null
  • label_id (this should be a foreign key from the Label table) not null
    These fields should form a composite key

Anyone should be able to build these tables from the resulting sql/schema file.

Add video search bar to video page

Pre-requisites

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

Eslint/Prettier aren't working as expected

Pre-requisites

Describe the bug

When the app is open as a workspace in VSCode, Prettier and Eslint don't work as expected

To Reproduce

Create linting errors and observe the lack of errors in the UI (and/or run the lint commands)

Expected behavior

Eslint and Prettier will ALWAYS show feedback in the UI (assuming extensions installed) and via the command line when the relevant lint/checkstyle scripts are executed

Contribution Polling CRON Job

Pre-requisites

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

A job needs to periodically be run to fetch the latest contributions for user who haven't had theirs updated in a while.

  • It should look at the user field contributionsLastCheckedAt to determine users who need to be updated
  • It should run every 5? 10? 30? minutes

Describe alternatives you've considered

N/A

Additional context

Update `User` entity with `isAdmin`

Pre-requisites

Is your feature request related to a problem? Please describe.

The User entity should be updated to include a new isAdmin boolean. Creating new users should always default to false and we need to make changes to API endpoints to ensure security.

Any endpoint that allows for the creation/update of a user needs to have the following gates in place:

  • isAdmin is ALWAYS set to false unless the user making the request is already an admin

Create an API endpoint that returns a list of video objects

DEPENDENT ON #2

The videos page will need to have a list of videos to display. To do this it needs an endpoint to call that will return a list of videos.

List Format

  • The list should be in json format
  • each video object in the list should have keys for the fields found in the video table(See: #2)

Key Features

  • The call should be a GET
  • The API call should accept an optional list of query params for labels. Ex: "api/videos?labels=java,backend"
  • If the labels param is provided then it should only return videos with ALL labels in the list
  • If the labels param is not provided then it should return all videos

Test should be written for this endpoint as well.

Permissions

Pre-requisites

Is your feature request related to a problem? Please describe.

Setup permissions

Describe the solution you'd like

A way to say who can do what API endpoint

Describe alternatives you've considered

Wild west ๐Ÿค 

Additional context

Passport middleware for Discord

Pre-requisites

Is your feature request related to a problem? Please describe.

Allow a user to connect and authenticate their Discord account using passport-discord.

Describe the solution you'd like

Protect all routes prefixed /app/community from being accessed unless user has linked Discord to their account and accepted community guidelines.

FLOWS:
Handle Logged In: Continue to whatever route the user was headed to
Session Expired: Redirect to Discord login
Not Authorized: Redirect to Discord login

Email checking when creating a new user

Pre-requisites

Is your feature request related to a problem? Please describe.

Need to check the email of the users to make sure they are students when they first make their account (If they have a ".edu" email).

Describe the solution you'd like

You will use

  • Node fetch
  • https://api.github.com/user/emails (use accessToken to get the emails of the user)
  • Check if it is verified and look for a ".edu" email.
  • Save the ".edu" email into the database.
  • Procced with signing the user up.

Describe alternatives you've considered

Additional context

Return to login page/ Login page

Pre-requisites

  • Login button
  • Logout button

Describe the solution you'd like

If the user is not login, display username and password space for typing in the credential.
A login button is required.

Describe alternatives you've considered

If the user is already login, the logout button #9 is required to return to the login page.
After the user clicks on the logout button, a login page will be displayed for the user to type in the login credential again.

Additional context

Dependent on #8
Dependent on #9

SPIKE: Contribution Tracking

Pre-requisites

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

We need to find a effective solution to keep track of user contributions.

Methods to investigate:

  • Database Schema for storing contrabution data
  • Contribution tracking utilities, endpoints, filters, queries, files.

Describe alternatives you've considered

Additional context

Database table for User Profile Information

Dependent On

  • #6 for User's ID column

Describe the solution you'd like

(put in user login table)
Columns:

  • Name: text
  • Pronouns: text
  • Location: text
  • Is Looking for Job status: boolean
  • Reason for joining: text
  • School_Name: text
  • Major: text
  • Graduation Date (month/yr): date

Describe alternatives you've considered

Additional context

Create a Basic VideoListItem Component

When a user is looking at the videos page we will need to show a list of available videos to them. We need a reusable UI component that will make the list look clean.

The component needs the following features:

  • a spot to store a thumbnail
  • a spot for the video title
  • a spot for the video length
  • a spot for the video date (optional, if the component is too cluttered with it)

examples of similar components:
Spotify
image

Crunchyroll
image

Reddit
image

Add discord Id check to community page

Pre-requisites

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

The page should check the passport session (or browser cookies) to get the current user, and then query the data base for that user's Discord ID

If the user has not registered display the Join Discord button. If they have, show a "go to discord" button.

Describe alternatives you've considered

Additional context

Create a Profile page

Pre-requisites

  • Create a Registration page using Github Oath

A Profile page will be automatically generated by the information retrieved from the Registration page.

Describe the solution you'd like

The profile page will show the public information such as name, email, phone numbers, etc...

Additional context

Dependent on #7

Link Discord button on Profile Page

Pre-requisites

Is your feature request related to a problem? Please describe.

Need a button on profile page to initiate discord account connection.

Describe the solution you'd like

Button on profile page to redirect to Discord for authentication.

If account connected, show checkmark or success message.

Additional context

Related to #42

Create initial Repositories page

A blank repository contribution page needs to to be built for the contribution portion of the app. This will be where users can view all the possible repositories to contribute to and sort them based on different parameters.

Web Page

  • a new repositories.tsx file should be created in the web/src/pages/app folder. This file should render a blank or basic (can copy the web/src/pages/app/index.tsx style of just a heading) page.
  • a new repositories.test.tsx file should be created in the web/tests/pages/app folder. This file should test that the page was successfully rendered.

Routing

  • The page should be accessible from a browser at "/app/repositories"
  • Testing for this route should be added

Want final page to look like:
image

Create Initial Video Page

Pre-requisites

A video page needs to to be built as a starting point for the videos section.

Web Page

  • A new videos.tsx file should be created in the web/src/pages/app folder. This file should render a basic (can copy the web/src/pages/app/index.tsx style of just a heading) page.
  • The page should call the "api/videos" endpoint on load to get all videos.
  • The page should have a table in the center that shows a row for each video returned.
  • If no videos are returned the table show say "No videos found".
  • A new videos.test.tsx file should be created in the web/tests/pages/app folder. This file should test that the page was successfully renderd.

Routing

  • The page should be accessible from a browser at "/app/videos"
  • Testing for this route should be added

Create NavBar for App Navigation

Pre-requisites

Is your feature request related to a problem? Please describe.

The user needs to be able to find pages easily

Describe the solution you'd like

A navigation bar needs to be added to the App Layout that goes to the needed pages. For those pages that don't exist, have them be placeholder routes for now (with no href)

Describe alternatives you've considered

Additional context

Getting current user api

Pre-requisites

Is your feature request related to a problem? Please describe.

Currently cannot get current logged in user for front end

Describe the solution you'd like

API that just retrieves the current logged in user.

Describe alternatives you've considered

Additional context

Contribution Page

Pre-requisites

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

A page to display contributions should be created. This page should use the component created in #66

Describe alternatives you've considered

N/A

Additional context

Create a Registration flow using Github Oauth

Pre-requisites

Describe the solution you'd like

Link the "Login with Github" button so that it links to the GitHub OAuth for the user to sign in or register to the website. Once they click the button they should be sent to the Github OAuth page to sign in.

  • You'll need to configure your local setup using ngrok
  • Modify app to direct the user to login. Replace the "go to app" button with a login button.
  • Create the github app.
  • add documentation for the readme on how to set up the github app
  • Check the URL and make sure it does not include error or anything similar; you will see a 404 on the page though

Describe alternatives you've considered

Make a registration page without the GitHub OAuth and just take their email and a password. Then later in the setup, we can use GitHub OAuth to link their GitHub account.

Create a Database for user login information

Describe the solution you'd like

Create a Database to store users' information once they log in to the site through Github.
The database should have fields for Email, and Username.

Email should be (varchar 50) non-null, also check if the email ends in ".edu".

Username should be (varchar 20) non-null.

Additional context

If possible, we should implement a regex scheme in the email field of the database so that we can filter for .edu.

Contribution GET API endpoint

Pre-requisites

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

A GET endpoint needs to be built that returns the contributions for the current user.

Describe alternatives you've considered

N/A

Additional context

Add Database integration with Discord ID

Pre-requisites

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

The User table and User entity need to have a field for a Discord ID to allow us to link their account.
This field should be nullable.

The Discord login flow should add the returned user ID to the user row and redirect to the community page and indicate success in some way (change the button to indicate user has already linked their Discord).

Describe alternatives you've considered

N/A

Additional context

Build repository data object

Pre-requisites

  • Understand GitHub API JSON response

Describe the solution you'd like

  • Create data type for repository information.

Basic repository data type

  • id (int)
  • owner (string) //(type githubAccount?)
  • name (string)
  • full_name (string)
  • html_url (string)
  • description (string)
  • api_url (string)
  • forks_url(string)
  • forks_count (int)
  • issues_url (string)
  • open_issues_count (int)
  • pulls_url (string)
  • topics (list)

Additional context

  • May need githubAccount object

Add user store for app

Pre-requisites

Describe the solution you'd like

We should create a UserStore to eliminate the need for multiple pages/components to retrieve the info for a signed in user

We should also verify that this information is not better stored in local storage or already available via the cookie

Upon implementing this, we should go through and clean up all uses of the api/users/me endpoint in favor of this

Create API endpoint that updates user profile information

Dependent On

Is your feature request related to a problem? Please describe.

Need to be able to update the user's information if they need to change anything.

Describe the solution you'd like

Request Type: POST
Input: JSON string made up of every column from tables 1-4 (User Identification, Student Information, User Skills, and User Certifications tables) from #6

  • Check if the user has information stored in Tables 1-4 from #6 by checking the user id. If they do, UPDATE the tables with the passed in information; otherwise, INSERT INTO the new data into Tables 1-4.

Additional context

Questions / Concerns:

  • At what point should checking that the passed in user id belongs to the currently logged in user?

Making the NavBar more reactive

Pre-requisites

Describe the bug

Navbar only allows for redirects if you click on the text rather than the entire box

To Reproduce

Steps to reproduce the behavior:

  1. Log in to the App
  2. Click on the profile icon in the top right
  3. Then click on the blank space next to some text such as the blank space next to "log out"
  4. This will just close the nav bar without actually going to the link.

Expected behavior

When you click on the white space next to the text, you should still be logged out

Picture:
NavBar

Create a login Button

Describe the solution you'd like

Create a button that says "Login with Github". This should preferably be on every page so that the user can login at anytime no matter what they are doing.

Additional context

Just a button that will later be linked to the GitHub OAuth

Logout Button

Pre-requisites

  • login button created, and GitHub OAuth login available

Describe the solution you'd like

Create a "Log out" button that appears after the user logs into their account. This should replace the "Login with GitHub" button.

Create Community Page

Pre-requisites

Describe the solution you'd like

Add a community landing page at /app/community with basic community guidelines and a link to the Preflight discord server.
Will require Discord account connection to be accessible.

  • The navbar should link to the page
  • The link should be a permanent link
  • Anyone can join the server, but they will not have any permissions to do or see anything

Additional context

Related to #2, #42

Add Action step for merge

Pre-requisites

Is your feature request related to a problem? Please describe.

Our only build step is within the build-and-release Action, which doesn't run for Pull Requests. As a result, we cannot check for that as a PR gate.

Describe the solution you'd like

Either duplicate the build step elsewhere or split it from that action and create an artifact which can be used within build-and-release. Once this is done, we need add it to our required status checks for main branch protection.

Create Video Table

Pre-requisites

Table
A table that hold video data needs to be created. The video table should be named "Video" and needs the following fields:

  • video_id (auto incremented int)
  • title (text) not null
  • durationInSeconds (int) not null
  • url (text)

API
An api endpoint needs to be created that gets video rows from the database.

  • a get request that returns all video rows as json at /api/videos
  • a get request that returns a video row as json at /api/videos/{video_id}

Entity
A video entity needs to be created to allow for video data to be used in the web package

  • an entity with all fields from the table

Tests
Tests for the api call need to be created.

Contribution Tracking Database Updates

Pre-requisites

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Database modifications need to be made below to allow for the storage of contribution data.

User Table Updates

  • new contributionsLastCheckedAt timestamp field (nullable)

New table contribution

  • nodeId int field
  • description text field
  • type text field
  • score int field
  • contributedAt timestamp field

Describe alternatives you've considered

N/A

Additional context

Passport Middleware

Pre-requisites

Is your feature request related to a problem? Please describe.

We need middleware to make sure users who hit anything with a base URL of /app are authenticated

Describe the solution you'd like

Any routes prefixed with /app should be protected by middleware which uses passport-github2 to validate whether the user has a current, valid session.

  • Implement a callback route handler which accepts requests from GitHub
  • FLOWS:
    • Logged In: Continue to whatever route the user was headed to (invoke next())
    • Session Expired: Redirect to GitHub login
    • Not Authed: Redirect to GitHub login
  • Check the DB to see if a corresponding User exists
    • If not; redirect to the Onboarding page
    • If they do; continue

Add a Link discord account button to the profile page

Pre-requisites

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

A button to link the users discord profile needs to be added to the profile page

Describe alternatives you've considered

Additional context

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.