Code Monkey home page Code Monkey logo

artsy-capstone-server's Introduction

Capstone: Artsy (API)

'Artsy' is an application in which sharing art with your friends and followers is easier than ever. Each user has their own profile containing a timeline of everything they have posted, liked, shared and specific collections they’ve created. They also have their own dashboard feed which shows all of the art posted by the people they follow in chronological order. We want the user to interact with posts by commenting, liking, and sharing!

Designed and Built by: Michaela Bateman, Jerrad Moon, Jonathan Cochran, Sacha Sedriks


1. Working Prototype

You can access a working prototype of the React app at: https://artsy1.vercel.app

API Hosted at: https://serene-brook-48988.herokuapp.com

Corresponding clientside React.js repo at: https://github.com/jcochran206/artsy-capstone-client


2. Technology

  • Front-End: HTML5, CSS3, JavaScript ES6, React
  • Back-End: Node.js, Express.js, Mocha, Chai, RESTful API Endpoints, Postgres, and Cloudinary API (for image storage)
  • Development Environment: Vercel, Heroku, DBeaver

3. Functionality & Views

CLICK to expand to view screenshots

Landing Page / Introduction for the unsigned-in user

landing page


Login /login Demo account available with demo and Passw0rd

login


Register /login

register


Explore Feed /feed/explore Displays all posts from across the community

explore feed


"Home" Feed /feed/home Displays posts by people that the user explicitly follows

home feed


User Comments Touching the comment icon displays all comments associated with a post and the ability to add comments.

comments


Profile: posts (default) /profile/:username User's profile features all their posts, as well as sub-nav to view users they are following and their followers.

profile posts


Profile: followers /profile/:username

profile followers


Add Post /upload & Edit Post /edit/:postId

profile followers



4. Wireframes & User Flows

suite of views


See: 'Greybox' HTML Wireframes

See: User Flows


5. Front-end Structure _ React Components Map

Components are stateless unless otherwise noted as useState.

  • Index.js
    • App.js useState
      • Nav.js
      • Home.js
        • LandingPage.js
      • SignIn.js
        • Login.js useState
        • Register.js useState
      • Feed.js useState
      • SoloPost.js useState
      • UploadPost.js useState
      • EditPost.js useState
      • EditPost.js useState
      • Profile.js useState
        • ProfileFeed.js useState
          • Post.js useState
            • Comments.js useState
        • Followers.js useState
      • Footer.js

6. Back-end Structure - Business Objects

  • Users (database table)

    • id (auto-generated, INT)
    • username (email validation, VARCHAR(50))
    • password (at least 8 chars, at least one alpha and a special character validation)
    • email (VARCHAR(100))
    • bio (VARCHAR(255))
    • date_created (timestamp default now)
  • Posts (database table)

    • id (auto-generated, INT)
    • user_id (foreign key for users, INT)
    • title (VARCHAR(50))
    • pic (VARCHAR(100), url string from cloudinary)
    • desc_post (VARCHAR(144))
    • date_created (timestamp default now)
  • Comments (database table)

    • id (auto-generated, INT)
    • post_id (foreign key from post table, INT)
    • user_id (foreign key from user table, INT)
    • desc_comment (VARCHAR(144))
  • Likes (database table) (descoped from mvp functionality )

    • id (auto-generated, INT)
    • post_id (foreign key from posts, INT)
    • user_id (foreign key for users, INT)
  • Followers (database table)

    • followed_user_id (foreign key for users, INT)
    • follower_user_id (foreign key for users, INT)
    • Unique (followed_user_id, follower_user_id, creates unique index for each)

7. API Documentation

API Documentation details:

  • /api/auth Operations for authentification of user

    • POST /api/auth/login To sign-in user and create JWT Token for the session
  • /api/users Operations about user

    • POST /api/users To create a new user via registration
    • GET /api/users To get list of all users (password bcrypted)
    • GET /api/users/:userid To get particular user info
    • PUT /api/users/:userid To update user profile settings
  • /api/followers Operations associated with 'subscribing' to users

    • POST /api/followers/:id To follow user
    • GET /api/followers To get list of...
    • GET /api/followers/followers/:id To get list of users a :userid follows
    • GET /api/followers/following/:id To get list of users that follow :userid
    • DELETE /api/followers/:id To un-follow a user
  • /api/posts Operations for a post

    • POST /api/posts To create a new post
    • GET /api/posts To get all posts
    • GET /api/posts/feed/:id To get all posts by users a :userid follows, including their own
    • GET /api/posts/profile To get all posts created by a :userid (for their personal profile)
    • GET /api/posts/:id To get a particular post
    • PUT /api/posts/:id To update a post
    • DELETE /api/posts/:id To delete a post
  • /api/comments Operations for comments associated with a post

    • POST /api/comments To create a new comment associated with a :postid
    • GET /api/comments To get all comments
    • GET /api/comments/:id To get a comment
    • GET /api/comments/post/:id To get all comments associated with a :postid
    • PATCH /api/comments/:id To update a comment
    • DELETE /api/comments/:id To delete a comment

Development Roadmap (to do later)

This is v1.0 of the app, but future enhancements are expected to include:

  • Personalized avatar image for profile
  • Liking a post (only to save it to your profile, not public)
  • Re-posting someone else's post
  • Pagnination of posts in a feed via an "infinity scroll" mechanic
  • Deletion of images stored in the Cloudinary database thru our server
  • More compelling non-signed experience, especially on the landing page

How to run it

Use command line to navigate into the project folder and run the following in terminal

Local React scripts

  • To install the react project ===> npm install
  • To run react (on port 3000) ===> npm start
  • To run tests ===> npm run test

Local Node scripts

  • To install the node project ===> npm install
  • To migrate the database ===> npm run migrate -- 1
  • To run Node server (on port 8000) ===> npm run dev
  • To run tests ===> npm run test

artsy-capstone-server's People

Contributors

artificialarea avatar bateman001 avatar jcochran206 avatar jerradm85 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

artificialarea

artsy-capstone-server's Issues

Confirm Password

Confirm Password doesn't work. It's possible to register an account without passwords matching.

Heroku fault: Site down!

It's likely that a major stack upgrade by Heroku is the cause.

I will investigate, but the more the merrier. Assigning to all for awareness

Post comment

Post Comment doesn't work idk - reviewed and older version of heroku is deployed and needs latest update push

Userid in local storage missing...

Previously the response from /api/auth/login would provide token, username, and userid that we stored in local storage.

With latest release the userid is coming up undefined.

Screenshot attached...
Screen Shot 2020-11-12 at 19 19 54

api/posts/:id

Need route that returns all posts associated with a certain user

TypeError: postService.getPostsByUserId is not a function

Although everything displays fine when go to URL path /edit/:postId or /posts/:postId

I get this morgan error in the terminal when I make a GET /api/posts/:postId api call

::1 - - [13/Nov/2020:19:16:39 +0000] "GET /api/posts/13 HTTP/1.1" 200 205
TypeError: postService.getPostsByUserId is not a function
    at /Users/sachased/sandbox/thinkful/artsy-capstone-server/src/posts/posts-router.js:112:21
    at Layer.handle [as handle_request] (/Users/sachased/sandbox/thinkful/artsy-capstone-server/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/sachased/sandbox/thinkful/artsy-capstone-server/node_modules/express/lib/router/route.js:137:13)
    at /Users/sachased/sandbox/thinkful/artsy-capstone-server/src/posts/posts-router.js:105:17

POST /api/posts => posts.user_id is null

Not sure if this is a clientside or a serverside issue, but a bug has arisen where the user_id is no longer being registered in the posts db table.

dBeaver screenshot of user_id [NULL]...
Screen Shot 2020-11-12 at 21 41 40
...

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.