Giter Club home page Giter Club logo

database-project's Introduction

database-project

To View Our Site

  • Clone our repo
  • Do npm install in your terminal
  • Do run devStart, once the server is running...
  • Go to localhost:8000 on your browser

To login try using: email: [email protected] || [email protected] || [email protected] || [email protected] password: name123 (the name of the user)

Objective

Build a platform for writing and sharing reviews of coding resources.

User stories:

  • I can log in.
  • I can see a list of recent reviews.
  • I can see a list of reviewed resources.
  • I can create, edit and view my own reviews.
  • I can see a list of reviews of a particular resource.
  • I can click on a listed review to read it.
  • (optional extra) I can see a list of reviews by a particular user.

Focus on getting this functionality rather than making the frontend look good. Build your endpoints first.

Endpoints

  • I can log in. (/login)
  • I can see a list of recent reviews. (/reviews/recent on the landing page)
  • I can see a list of reviewed resources. (/resources?reviewed=true)
  • I can create, (edit) and view my own reviews. (/reviews)
  • I can see a list of reviews of a particular resource. (resources/{resource_id})
  • I can click on a listed review to read it. (/resources/{resource_id})

Database

Table 1: Users

name value type
user_id 1 PRIMARY KEY
first_name Jo string
last_name Bloggs string
email [email protected] string
password h3Llo string

Table 2: Resources

name type
resource_id PRIMARY KEY
url string
title string
img string
intro string varchar(100)

Table 3: Reviews

name type
review_id PRIMARY KEY
title string
rating integer
content string
created_at time stamp
modified_at time stamp

Table 4 User Reviews:

name type
ur_id PRIMARY KEY
review_id FOREIGN KEY
user_id FOREIGN KEY
resource_id FOREIGN KEY

Stretch Goals

  • Create new users
  • Add nice styling to the frontend
  • Nightwatch testing

database-project's People

Contributors

skibinska avatar cleop avatar rhodespeter avatar

Watchers

James Cloos avatar Tom Johnson avatar  avatar

Forkers

cleop skibinska

database-project's Issues

CSS

Create some CSS

Refine file structure?

Could our project do with some refining of the file structure? We have files like reviews.js, user_reviews.js an users.js that may be better in a file?

Storing passwords

Just made this comment on another repo and I know you might not have covered this yet. However:

Looks like you're storing passwords in plain text and then just comparing the user input to what you have in the database when the user logs in.

This is pretty bad practice because if someone steals your database they will have all the user passwords. To prevent this you should hash and salt your passwords and never store the actual plain text password, ever.

Don't really expect you to fix this in a couple of hours code review, but maybe check out how this group did it here:
https://github.com/FAC9/the-badgerer/blob/master/src/handlers/loginHandler.js
and here:
https://github.com/FAC9/the-badgerer/blob/master/src/handlers/newUserHandler.js

No Tests! :'(

Just as I've emphasised with the other teams, TESTS are just unbelievably important. Please grab me if you would like to know why.

Comments

Some comments.

  • This should be POST. See here.
  • Use template literals to construct multiline strings e.g. here.
  • Can you do this with one query? If not, please make an issue explaining why.
  • Apply this filter in the query.
  • This should be one query (see e.g. here).

Looks really good!

Things we love about your project

  • Your fonts ๐Ÿ˜„
  • Filtering by reviewed resources in the main page
  • Using TIMESTAMP and defaulting to CURRENT_TIMESTAMP in your SQL statements
  • Modularising your JS code for getting and manipulating reviews
  • Deploying an online database
  • Showing a message when a guest user tries to access the 'My Reviews' page but he is not logged in.

Testing

These are optional until we have out minimal viable product up and running:

  • Tape

  • QUnit

  • Nightwatch

  • Code Climate

  • CodeCov

  • Travis

  • Istanbul

Handlebars Views

These are rendered on the server, so don't need to/shouldn't be in the public folder

Control/filter database results through SQL queries rathen than using JS

  • Better practice to limit database results when you query because of size and time required to make the query and then filter the results using JS.
  • Instead of slicing here you could add LIMIT 8 at the end of your sql query.
  • You could query the database for a specific user_id instead of filtering after you've got a big database set.
  • Nice modularised structure of your JS code to get reviews and filter them though ๐Ÿ‘

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.