GithubHelp home page GithubHelp logo

capping2017's Introduction

Capping2017

Senior capping project for Fall 2017.

Helping Hands Social Network

Running the Backend

Main class: com.helpinghands.HelpingHandsApplication

Program arguments: server helping-hands.yml

VM options:

-Ddw.database.url=[DATABASE URL]
-Ddw.database.user=[USER FOR DATABASE]
-Ddw.database.password=[PASSWORD FOR USER]

Front-End Development Environment

The front end is composed of a single page application written in React.

Web Server

It is necessary to host the page on a local web server, otherwise the client-side routing will not work. You can read more about react-router here.

The easiest way to set up a local web server is to use NodeJS. You can check if you are running Node by using the command node -v. If you are not, install node at https://nodejs.org/en/.

Once node is installed, navigate in your terminal to the location containing the index.html file, in this case src/client/app, and run the command

ws --spa index.html

You can then access the site by simply going to localhost:8000/home in a browser.

Setting up Webpack bundling

The bulk of the written project consists of .jsx files, a variant of JavaScript that needs to converted and bundled to be readable by the browser. There are two commands to do so:

npm run build bundles all current .jsx files into a bundle.js file.

npm run dev causes Webpack to constantly watch the project, and rebundle any time it detects any new changes saved.

It is recommended to have both ws --spa index.html and npm run dev running in two terminal windows while developing.

capping2017's People

Contributors

liamrharwood avatar mvitkin avatar pablorp80 avatar

Stargazers

Juan S. Vasquez avatar

Watchers

James Cloos avatar  avatar butts avatar  avatar Juan S. Vasquez avatar  avatar

capping2017's Issues

Vote history

Once we have the vote history set up, can we get it as a {1, 0 ,-1} value when calling /posts?

Something like:

[
    {
        ...
        vote: 0,
        ...
    },
]

To display what posts the user has already voted on.

Community Creation

Added a new create community page that can be accessed via the Your Communities dropdown. Once endpoints are done will build out the rest of the page

Registration

Implement registration functionality to login.jsx

Comment endpoints

New endpoint for commenting!

POST /posts/comments

POST body:

{
postId:
bodyText:
}

To get comments:

GET /posts/comments?post_id=

Community posts endpoint

GET /posts 

Optional Query Params: community_id, call_date, start_num, end_num

# Returns information for post feed.
# If a community id is specified, it returns all posts from that community.
# If not, but basic auth is used, it returns all followed posts for the auth'd user.
# If no basic auth is used, it returns all posts.

[
	{
		userId:
		username:
		title:
		bodyText:
		upvotes:
		downvotes:
		createDate:
		completed:
	},
	{
		...
	}
]

EDIT: Reworking this to just be GET /posts?community_id=

Pagination to come later....

Post display order changes after voting on a post

Strange bug, not too high priority. I load the page once, /posts returns this:

0 : {id: 1, userId: 2, username: "redsea1", score: 2, vote: 1, bodyText: "I need some help. #please",…}
1 : {id: 2, userId: 1, username: "mjoln1r", score: -1, vote: -1,…}
2 : {id: 3, userId: 4, username: "user1", score: 1, vote: 1,…}

Notice post order is id 1, 2, 3. Now I upvote post 2, and refresh the page.

Now /posts returns this:

0 : {id: 1, userId: 2, username: "redsea1", score: 2, vote: 1, bodyText: "I need some help. #please",…}
1 : {id: 3, userId: 4, username: "user1", score: 1, vote: 1,…}
2 : {id: 2, userId: 1, username: "mjoln1r", score: 1, vote: 1,…}

The order 1, 3, 2.

🤔

Other Users' Post and Profile Fetching

Just let me know when this is ready, page is all set to fetch.

Updating endpoint-doc.txt, just add optional user_id query parameters to /posts and /users/profile.

Would be nice if these used username instead of the integer id, similarly to how we discussed with communities, but not necessary immediately.

Get communities for authenticated user

GET /communities

# fetch communities followed by the auth'd user

Response Body:
[
	{
		communityId:
		name:
		description:
		verified:
		createDate:
		banStatus:
	},
	{
		...
	}
]

Search

Built a preliminary search page, and search bar now redirects to this page with search string as url parameter. Once endpoints are done, can finish building out.

reputation system

gather necessary stats for user profile (should all be in db)
create reputation formula

Following and unfollowing users, communities

URLS will probably be:

PUT :
/users/follow?user_id=
/users/unfollow?user_id=
/communities/follow?community_id=
/communities/unfollow?community_id=

also add whether or not auth'd user is following to user and community profiles

Build Settings page

use /users/profile endpoint with no query parameters to fetch auth'd user's profile data.

New post endpoint

POST /posts

# creates a new post 

Request Body:
{
	title:
	userId:
	bodyText:
	imgPath:
	communityIds: [communityId]
}

Create vote endpoint for upvoting / downvoting

POST /vote

# submit or remove a vote from a given post

Request Body:
{
	postId:
	vote: (1 = upvote, 0 = unvote, -1 = downvote)
}

Should this be persistent, with a db table to prevent people from voting multiple times? @mvitkin

Community profile endpoint


GET /communities/profile

# fetch profile data for a given community

Request Body:
{
	communityId:
}

Response Body:
{
	id:
	name:
	description:
	followersCount:
	postCount:
}

EDIT: Communities don't have images, so i took out that field. unless we want them to, in which case the DB will need to change @mvitkin

Build SIngle Community Page

Effectively a copy of the home dashboard, except instead of a profile card, replace the info with the community info. Should pull all posts for a single community.

Refer to last picture in the wireframes pdf (HW 3), but stick to the theme present in Dashboard.

Voting

Is /vote working yet? And if so, can you give me an example of how to correctly structure the query?

Api Token Remember Me

mandatory query paremeter: rm = {true/false}, and API token auth

  1. if the api token hasn’t expire just return OK
  2. if the api token has expire but remember me is false, return an error or whatever
  3. if the token has expired but remember is true, then serve me up a new token so i can keep going

Logging In

Implement authorization via login.jsx

Endpoint changes

in order of priority:

/users/profile: return email if fetching auth'd user's details (no user_id provided)

/posts/updates: return update createDate

/posts?post_id= : return imgPath

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.