Code Monkey home page Code Monkey logo

labs10-discussion-board's Introduction

Symposium Discussion Board

Symposium is a web application that organizes communication in a way that like-minded people can come together to share and discuss ideas.


Testing


Discussion Schema

Discussions are organized under several Categories. (e.g. Anouncements, Marketing, Development)

Users can create a Discussion (e.g. Our company hit record sales!, We will be off on Monday!) under the Category it is relevant in.

Users can create a Post (e.g. Great Job Everyone!, Shoutout to Marketing!) to a Discussion to further the dialogue.

Users can Reply (e.g. I agree everyone did great!, I disagree I was the best) to a Post to answer/support the dialogue.

Replies to a Reply will be in the same indentation, with the same purpose of answering/supporting the dialogue

Due to some design changes, some technical terms were translated differently from development to production

Categories

Discussions ("Posts") - Discussions are rendered as "Posts" (e.g. "All Posts" page)

Posts ("Comments") - Posts are rendered as "Comments" (e.g. "Comments" section under a post)

Replies
Replies


GIF demonstrates the Discussion Schema

Discussion Schema

Table of Contents

Getting Started

Prerequisites
Starting Server
Folder Structure and Table Schema

Endpoints

Auth Endpoint

  1. Auth Registration
  2. Auth Login
  3. Auth Auth0 Login

Categories Endpoint

  1. POST Categories
  2. GET Categories
  3. SEARCH Categories
  4. GET Categories Icon

Discussions "Posts" Endpoint

  1. GET All Discussions "Posts"
  2. GET Discussions "Posts" By Followed-Category
  3. SEARCH Discussions "Posts"
  4. GET Discussions "Posts" By User ID
  5. GET Discussions "Posts" By Category ID
  6. POST Discussions "Posts"
  7. Discussions "Posts" Follows API
  8. Discussions "Posts" Votes API

Posts Endpoint

  1. GET Posts "Comments"
  2. POST Posts "Comments"
  3. Posts "Comments" Votes API

Replies Endpoint

  1. POST Replies
  2. Replies Votes API

Users Endpoint

  1. GET Users
  2. GET Users By User ID
  3. SEARCH Users
  4. PUT Update Users Info
  5. PUT Update Users E-mail
  6. PUT Update Users Password
  7. DELETE Users
  8. Users Notifications API

Profile Links

Tech Stack

Authors

Carlos Andrade
James Page
Huthman King
David Situ

License


Getting Started

git clone https://github.com/Lambda-School-Labs/labs10-discussion-board.git

cd labs10-discussion-board

Prerequisites

cd frontend to get into the Frontend Folder

yarn to install the Frontend Dependencies

cd .. to exit out of the Frontend Folder

cd backend to get into the Backend Folder

yarn to install the Backend Dependencies

knex migrate:rollback to reset all the migrations (tables)

knex migrate:latest to activate all the migrations (tables)

knex seed:run to activate all the seeds that belong in those migrations

Starting Server

Option 1: Concurrently

While in the Backend Folder use yarn symposium to "concurrently" start the backend and frontend servers

Option 2: Start the servers separately

In the Frontend Folder, use yarn start
In another terminal, in the Backend Folder, use yarn start

Folder Structure and Table Schema

Folder Structure and backend table schema is located in a file called Structures in this Repository.


Endpoints

Auth API

Method Endpoint Requires Description
POST /auth/register username, password explains the importance of this endpoint
POST /auth/login username, password allows user to register a username and password
POST /auth/log-back-in/:user_id username, password allows users to log in
POST /auth/auth0-login email, name, picture User logs in using credentials from accepted platforms
POST /auth/stripe requirement explains the importance of this endpoint

Auth Registration

Method: [Post] /auth/register

On Success: Re-directs user to the All Posts Page with Modal thanking User for registering

Parameters:

Name Type Required Notes
username string yes, unique username used to log in, no 2 of the same
password string yes credentials to log in, in combo with username
status string no gives access to pages not given to other users

Auth Login

Method: [Post] /auth/login

On Success: Redirects the User to the All Posts Page

Parameters:

Name Type Required
username string yes, unique
password string yes

Auth0 Login

Method: [Post] /auth/auth0-login

On Success: Redirects the User to the All Posts Page

Parameters:

Name Type Required
name string yes
email string yes, unique
picture image yes

User uses credentials from an accepted platform to log-in, such as:

  • Facebook
  • Github
  • Google
  • Twitter

Categories API

Method Endpoint Requires Description
POST /categories/:user_id user_id,name Used to create a new UNIQUE Category
GET /categories/ user_id,name,created_at Used to show all the categories in the api
POST /categories/followed/:user_id user_id Used to allow a user to follow a category
POST /categories/search searchText, order, orderType Used to search category by letter/word
GET /categories/category-icons/:user_id categories_icon, user_id Used to get specific category icon

POST Category

Method: [POST] /categories/:user_id

On Success: The New Category will be rendered in the list of categories, console will return the category ID

Parameters:

Name Type Required Notes
user_id integer no used to choose a name/ no name for story post
name string yes story input
created_at bigInteger yes a UNIX ms timestamp is automatically generated

GET Categories

Method: [GET] /categories/

Parameters:

Name Type Required
user_id integer yes
name string yes
created_at bigInteger yes
icon no

SEARCH Categories

Method: [POST] /categories/search

On Success: The New Category will be rendered in the list of categories, console will return the category ID

Parameters:

Name Type Required
searchText text no
order asc, desc yes
orderType string yes

GET Category Icons

Method: [GET] /categories/category-icons/:user_id

Parameters:

Name Type Required
user_id integer yes
category_icon iamge yes

Discussions ("Posts") API

Discussions are referred to as Posts, and Posts as Comments (Due to last minute design changes)

Method Endpoint Requires Description
GET /discussions/ user_id,category_id,body,created at Gets all discussions
GET /discussions/all-by-followed-categories/:user_id user_id Used to get discussions by followed category
GET /discussions/discussion/:id/:user_id id,user_id Used to get discussion by discussion ID
GET /discussions/search searchText Used to locate discussions for letter/word
GET /discussions/user/:user_id discussion_id,user_id Used to get discussion by user (moderator)
GET /discussions/category/:category_id/:user_id category_id,user_id Used to get discussions by category
POST /discussions/:user_id discussion_id,user_id,body Used to post a new discussion
PUT /discussions/:user_id discussion_id,user_id Used to edit a discussion
DELETE /discussions/:user_id discussion_id,user_id Used to delete a discussion

GET All Discussions ("Posts")

Note: This is rendered under the page "All Posts"

Method: [GET] /discussions//discussions/category/:category_id/:user_id

Parameters:

Name Type Required
user_id integer yes
category_id integer yes
body text yes
created_at bigInteger yes

GET Discussions ("Posts") by Followed Category

Method: [GET] /discussions/all-by-followed-categories/:user_id

Parameters:

Name Type Required
user_id integer yes

SEARCH Discussions ("Posts")

Method: [GET] /discussions/search

Parameters:

Name Type Required
searchText text yes

GET Discussions ("Posts") by User ID (Moderator ID)

Method: [GET] /discussions/user/:user_id

Parameters:

Name Type Required Notes
user_id integer yes this user id refers to the creator of the discussion
discussion_id integer yes

GET Discussions ("Posts") by Category ID

Method: [GET] /discussions/category/:category_id/:user_id

Parameters:

Name Type Required
user_id integer yes
category_id integer yes

POST Discussions ("Posts")

Method: [POST] /discussions/:user_id

On Success: The New Discussion will be rendered in the list of Discussions, console will return the Discussion ID

Parameters:

Name Type Required
discussion_id integer yes
user_id integer yes
body text yes

Discussion ("Posts") Follows API

Method Endpoint Requires Description
POST /discussion-follows/:user_id/:discussion_id discussion_id, user_id Used so users can follow many discussions

Discussion ("Posts") Votes API

Method Endpoint Requires Description
POST /discussion-votes/:user_id discussion_id,type,user_id Used to upvote / downvote a discussion

Posts ("Comments") API

Posts are referred to as "Comments", Due to last minute design changes

Method Endpoint Requires Description
GET /posts/search searchText text to show port and endpoint are up
POST /posts/:user_id discussion_id,body,created_at, user_id Used to create a new post
PUT /posts/:user_id post_id,body Used to edit a post
DELETE /posts/:user_id post_id Used to delete a post

GET Post ("Comments") Search

Method: [GET] /posts/search

Parameters:

Name Type Required
searchText text yes

POST Post ("Comments")

Method: [POST] /posts/:user_id

On Success: The New Comment will be rendered under the Post which "Add Comment" was clicked, console will return the Discussion ID

Parameters:

Name Type Required
discussion_id integer yes
user_id integer yes
body text yes
created_at bigInteger yes

Note: PUT Post ("Comments") created for future developers to utilize

Note: DELETE Post ("Comments") created for future developers to utilize


Post ("Comments") Votes API

Method Endpoint Requires Description
POST /post-votes post_id,type,user_id Used to upvote / downvote a post

Replies API

Method Endpoint Requires Description
POST /replies/:user_id body,created_at,post_id,user_id Used to reply to post
PUT /replies/:user_id body,reply_id Used to edit a reply
DELETE /replies/:user_id reply_id Used to delete a created reply

POST Reply

Method: [POST] /replies/:user_id

On Success: The New Reply will be rendered under the Post/Reply it is replying to, a message will notify you the reply is successful Parameters:

Name Type Required
post_id integer yes
user_id integer yes
body text yes
created_at bigInteger yes

Reply Votes API

Method Endpoint Requires Description
POST /reply-votes/:user_id reply_id,type,user_id Used to upvote / downvote a Reply

Users API

Method Endpoint Requires Description
GET /users api running Used to get all users
GET /users/discussions/:user_id user_id Used to get a list of discussions created by the user
GET /users/user/:user_id user_id Used to get user by their ID
GET /users/username/:username n/a Used to return true if username is already in the database
GET /users/email/:email Used to return true if email is in the database
POST /users/confirm-email email_confirm_token Used to confirm a user's email
POST /users/send-reset-pw-email email,clientIP Used to send a reset-pw email to user
PUT /users/reset-password id,password Used to reset password
PUT /users/edit-signature/:user_id user_id,signature,user_type Used to change signature
GET /users/token-info id, username, email Used to get info from reset-pw-token
GET /users/search-all searchText Used to search for letter/words through whole website
PUT /users/user/:user_id user_id,username,oldPassword,newPassword,email Used to update user info
PUT /users/password/:user_id user_id, oldPassword,newPassword Used to update password
PUT /users/update-email/:user_id user_id, email, clientIP Used to update user's email
PUT /users/type/:user_id user_id, user_type Used to change the user_type of a user
PUT /users/avatar/:user_id user_id, avatarData Used to update a user's avatar
PUT /users/avatar-url/:user_id user_id, avatarURL Used to update a user's avatar via URL
PUT /users/last-login/:user_id user_id Used to update last login
DELETE /users/:user_id user_id Used to delete a user

GET All Discussions ("Posts") created by User ID

Method: [GET] /user/discussions/:user_id

Parameters:

Name Type Required Notes
user_id integer yes this user id refers to the creator of the discussion

GET User by User ID

Method: [GET] /users/user/:user_id

Parameters:

Name Type Required Notes
user_id integer yes this user id refers to the creator of the discussion

SEARCH Users

Method: [GET] /users/search-all

Parameters:

Name Type Required
searchText text yes

PUT Update User Info

Method: [PUT] /users/user/:user_id

Parameters:

Name Type Required
user_id integer yes
username string yes
oldPassword string yes
newPassword string yes
email email string yes

PUT Update Email

Method: [PUT] /users/password/:user_id

Parameters:

Name Type Required
user_id integer yes
username string yes
oldPassword string yes
newPassword string yes

PUT Update Password

Method: [PUT] /users/update-email/:user_id

Parameters:

Name Type Required
user_id integer yes
email email string yes
clientIP string yes

A new email confirmation is sent to the client's new email

Delete User

Method: [Delete] `/users/:user_id

Requires Login

On Success: Message: "User has been deleted"

Name Type Required
/users/:user_id endpoint yes

Users Notifications API

Method Endpoint Requires Description
GET /user-notifications/user/:user_id user_id Used to get notification by what user has followed
DELETE /user-notifications/:id/:user_id id,user_id Used to delete notification from what user followed

Project Links

Lambda School Labs Guidelines for Discussion Board

Guidelines for Lambda Labs - https://docs.google.com/document/d/1KBLXucApsCGYJ2p1jIRjf7sgpsJKtFQhmnBK3LK3w6c/edit

Backend Deployment Using Heroku

Frontend Deployment Using Netlify

Planning and Documentation

Communication

Built With (Tech Stack)

Backend

Frontend

Authors

Carlos Vargas

James Page

Huthman King


David Situ

License

Copyright 2019 © Symposium Discussion Board

labs10-discussion-board's People

Contributors

cornielleandres avatar kinghuthman avatar codechiha avatar jamespagedev avatar lucasbeemer avatar kelajatu avatar abravebee avatar

Stargazers

 avatar

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.