fac-15 / FAC_guidebook

Week 5 - Database using postgreSQL

Home Page:https://facguidebook.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FAC_guidebook πŸ”(v) (vg) (gf)

An app for food and drinks recommendations around Finsbury Park!

Build Status

User Stories πŸ€”

As a user I want to be able to:

  • View existing recommendations for restaurants/cafes/pubs in the area
  • Add my own recommendation for a restaurant/cafe/pub in the area
  • Review/comment on existing recommendations

How to run our project πŸŽ‰

clone this repo

npm i

npm test to see tests if you're into that (this might not work actually because of authentication)

npm start to run server

open localhost:5000

party πŸ‘½

Planning Process:

What we learned: Day 1:

  • How to reference primary keys and foreign keys
USERS TABLE
id SERIAL PRIMARY KEY

POSTS TABLE
user_id INTEGER REFERENCES users(id)
  • When you CREATE DATABASE - it will automatically turn any upper case chars into lower case!!! So you may need to go and change that in your config.env and other places
  • SQL files are grey in Github!

screenshot 2018-12-06 at 10 15 49

What we learned: Day 2:

1.With our real database and our test database, we needed to know how to switch between the two:

"test": "node src/test/test_server.js | tap-spec && NODE_ENV=test node src/test/test_db.js | tap-spec",

An environment variable!

  1. How to add a new column to table. Amended the build.js file

  2. You can't export your dbBuilder function if it has this:

//         console.log("connection closed");
//       });

we think??

Issues Raised: πŸ‘Ί

  1. Usability: Should redirect back to homepage after submitting form.

    How we fixed:

    res.writeHead(302, {
           Location: "http://localhost:5000"
         });
         res.end();
    
  2. Security vulnerability: script injections!

    How we fixed (maybe?):

    <input pattern="^[^<>]+$"......./>
    
  3. Would be nice to display the review of the restaurant to the user?

    How we fixed: Just handled that data. Did the same for image url!

Stretch goals: ⚽

  • Make a call to the Google Maps API when user selects a recommendation and show on map

  • Click and be taken to website/Directly make booking to the specific restaurant/cafe/pub

  • Link SQL tables - use the posts table in order to link between unique restaurants and unique users

  • This would give us loads of amazing functionality - like filtering recommendations by user, or recognising users that already exist or places that have already been submitted, and not creating duplicates in our tables...

About

Week 5 - Database using postgreSQL

https://facguidebook.herokuapp.com/


Languages

Language:JavaScript 58.6%Language:HTML 17.9%Language:CSS 16.2%Language:PLpgSQL 7.4%