Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
228 commits
Select commit Hold shift + click to select a range
00c4a15
add jquery
Isams01 Mar 6, 2021
b39ad74
add maps route
Isams01 Mar 6, 2021
d62e6b4
add maps route
Isams01 Mar 6, 2021
bc49354
add request library
Isams01 Mar 6, 2021
95ac078
make get request to google maps api
Isams01 Mar 6, 2021
f557851
fix typo
Isams01 Mar 6, 2021
fb330ea
help me
Isams01 Mar 6, 2021
4a50254
add schema tables
JoshuaRully Mar 6, 2021
591df37
add image property in users schema
JoshuaRully Mar 6, 2021
7e3b93a
map renders
Isams01 Mar 6, 2021
c93fc7a
remove unecessary ajax
Isams01 Mar 6, 2021
7cb1296
Merge branch 'develop' of github.com:Isams01/mappi into develop
JoshuaRully Mar 6, 2021
f8cbe22
fix typo in pins.sql table creation
JoshuaRully Mar 6, 2021
b09e5e6
use ejs template only
Isams01 Mar 6, 2021
016eead
get started on routes
Isams01 Mar 6, 2021
8d7d8f1
Merge branch 'develop' of github.com:Isams01/mappi into schema
JoshuaRully Mar 6, 2021
5f768c0
delete index.html
Isams01 Mar 6, 2021
67fb41c
Merge branch 'develop' of github.com:Isams01/mappi into schema
JoshuaRully Mar 6, 2021
f90d058
Added partial ejs folder and _header.ejs file
angel-sinn Mar 7, 2021
8594348
Added styling for _header.ejs and index.ejs file
angel-sinn Mar 7, 2021
88035b9
Included _header.ejs
angel-sinn Mar 7, 2021
4d974b5
add basic structure for addition of routes
JoshuaRully Mar 7, 2021
615462e
revised basic routes structure slightly ~ still uncertain of specific…
JoshuaRully Mar 7, 2021
ef2bc5d
Added dummy object for user
angel-sinn Mar 7, 2021
a4cd8a2
Updated styling on map
angel-sinn Mar 7, 2021
8b2ca6a
Updated map div
angel-sinn Mar 7, 2021
a1fbb01
Added users.ejs file
angel-sinn Mar 7, 2021
cade991
add test seed for pins
JoshuaRully Mar 7, 2021
155be68
add basic structure for addition of routes
JoshuaRully Mar 7, 2021
e155f51
revised basic routes structure slightly ~ still uncertain of specific…
JoshuaRully Mar 7, 2021
d71cb95
schema modifications for route testing purposes
JoshuaRully Mar 7, 2021
04fee02
routing changes --- unsure why server is failing to fetch info for pins
JoshuaRully Mar 7, 2021
7a3e56a
uncomment portion of GET
JoshuaRully Mar 7, 2021
52e5a0e
uncomment portion of GET
JoshuaRully Mar 7, 2021
3838854
fix pins router
JoshuaRully Mar 8, 2021
a59ab95
refactored seeds format
JoshuaRully Mar 8, 2021
6e243db
add seed test data for maps and favourite_maps ~ nonsensical map-pin …
JoshuaRully Mar 8, 2021
7e65afd
add functional favourite_maps route everything working well
JoshuaRully Mar 8, 2021
3e31f3c
I fixed it
Isams01 Mar 8, 2021
d0bdf00
onclick puts location into an object
Isams01 Mar 8, 2021
16eda53
add and delete markers while updating on board memory
Isams01 Mar 8, 2021
b1c550e
add tutorial on how to check variables in browser
Isams01 Mar 8, 2021
9e820e3
add delete button and edit button
Isams01 Mar 8, 2021
e94aca6
Added form to create a new map
angel-sinn Mar 7, 2021
fa03937
Added styling to create a new map form
angel-sinn Mar 7, 2021
52ced08
Moved app.use(express.static('public')); below app.use('/styles', sas…
angel-sinn Mar 8, 2021
753c25e
Updated Map Description input type to textarea
angel-sinn Mar 8, 2021
d662a23
This is for user's profile page
angel-sinn Mar 8, 2021
988a9fa
Refactored layout.scss file to include color variables and used @exte…
angel-sinn Mar 8, 2021
c997ffb
Added .DS_Store
angel-sinn Mar 8, 2021
9a8f085
Deleted duplicate line for app.use(express.static('public'));
angel-sinn Mar 8, 2021
c2a61e2
Merge branch 'features/map_api' into develop
Isams01 Mar 8, 2021
9c66520
add example routes
Isams01 Mar 8, 2021
ed92627
remove widgets
Isams01 Mar 8, 2021
a6b4739
add example to render map from post to api/maps
Isams01 Mar 8, 2021
569d704
remover widgets
Isams01 Mar 8, 2021
3195404
post to /api/maps
Isams01 Mar 8, 2021
edd86ba
copy paste index.ejs over without form
Isams01 Mar 8, 2021
aa1709d
Updated form action
angel-sinn Mar 8, 2021
7240569
Merge branch 'develop' of github.com:Isams01/mappi into features/ejs_…
angel-sinn Mar 8, 2021
6542d78
Added create mappi form
angel-sinn Mar 8, 2021
a53f7ed
Added box for displaying map info, and box for editting a mappi pin
angel-sinn Mar 8, 2021
782494d
Reformatted styling for index.ejs and map.ejs
angel-sinn Mar 8, 2021
845dfc6
Moved infowindow inline styling to layout.scss
angel-sinn Mar 8, 2021
d1712fb
Added styling to infowindow
angel-sinn Mar 8, 2021
d74713e
add example post request ~ helper functions will be required
JoshuaRully Mar 8, 2021
c5b1684
Added line to focus on pin title textbox when form is displayed
angel-sinn Mar 9, 2021
2435cf2
Updated styling to edit form
angel-sinn Mar 9, 2021
5e89955
variable refactor
JoshuaRully Mar 9, 2021
c73bc19
Changed button to display save pin
angel-sinn Mar 9, 2021
9b5c8cb
Merge branch 'develop' of github.com:Isams01/mappi into features/ejs_…
angel-sinn Mar 9, 2021
a9578cc
add map data to ejs
Isams01 Mar 9, 2021
f245fd0
update options in index ejs
Isams01 Mar 9, 2021
0c5ef72
update pin id on click
Isams01 Mar 9, 2021
152e52b
add example post request ~ helper functions will be required
JoshuaRully Mar 8, 2021
1328203
variable refactor
JoshuaRully Mar 9, 2021
c416525
minor syntax changes
JoshuaRully Mar 9, 2021
d0438ab
add description to maps table
JoshuaRully Mar 9, 2021
f048dea
Merge branch 'features/routes' of github.com:Isams01/mappi into featu…
JoshuaRully Mar 9, 2021
37849fc
Merge branch 'develop' of github.com:Isams01/mappi into features/ejs_…
angel-sinn Mar 9, 2021
316ad2a
change route names
JoshuaRully Mar 9, 2021
fbd9fd2
click creat btn now redirects to /maps/create
JoshuaRully Mar 9, 2021
0cbeb58
create map add data to sql database
Isams01 Mar 9, 2021
4cb0359
add test routes for /maps ~ currently hang due to lack of data use
JoshuaRully Mar 9, 2021
a47dc87
add listener to submit button but its broken
Isams01 Mar 9, 2021
3e3f0c3
Updated form action for Save Mappi form
angel-sinn Mar 9, 2021
ee33bd9
working on editMarker function
Isams01 Mar 9, 2021
c39288a
start PUT, modify POSTs, add janky getPins function
JoshuaRully Mar 9, 2021
9c29534
finish query in PUT
JoshuaRully Mar 9, 2021
805f0cc
add not null value parameters to prevent psql conflicts in PUT query
JoshuaRully Mar 9, 2021
84b8794
PUT successfully INSERTs new data from req.body but needs a separate …
JoshuaRully Mar 9, 2021
bf68794
DELETE and PUT functional
JoshuaRully Mar 9, 2021
bc6e3bb
pin id now saves
Isams01 Mar 9, 2021
b282c4c
fix seed data to correspond with schema requirements
JoshuaRully Mar 9, 2021
27869a9
test modifications
JoshuaRully Mar 9, 2021
9509760
merge conflicts
JoshuaRully Mar 9, 2021
df9d33d
add new update pin button, add savePin function
Isams01 Mar 9, 2021
7c62a27
save pin button saves to local memory and updates infowindow
Isams01 Mar 9, 2021
e37963f
Removed some of the styling no longer needed
angel-sinn Mar 9, 2021
92d4f1c
Added route for /:id page
angel-sinn Mar 9, 2021
39a3f0e
Updated queryString variable
angel-sinn Mar 9, 2021
a4be70d
Removed sample GET ajax
angel-sinn Mar 9, 2021
d3b81e3
Added users' maps
angel-sinn Mar 9, 2021
927b851
Merge branch 'features/ejs_views' of github.com:Isams01/mappi into fe…
angel-sinn Mar 9, 2021
13ae891
Select * instead of just title in query
angel-sinn Mar 9, 2021
ac0d42e
Added href link for corresponding map
angel-sinn Mar 9, 2021
d085eab
Updated styling for user maps
angel-sinn Mar 9, 2021
473f9d2
change seed data to work for map rendering, add helper file
JoshuaRully Mar 10, 2021
11c5232
Updated render to /:id route
angel-sinn Mar 10, 2021
d7fb0e1
Testing if data is passing through correctly
angel-sinn Mar 10, 2021
efff55c
add example routes
Isams01 Mar 10, 2021
e516dd8
add example route
Isams01 Mar 10, 2021
68fbee0
Updated ajax
angel-sinn Mar 10, 2021
843252a
Updated getPins
angel-sinn Mar 10, 2021
3d1cc24
add ajax for map
Isams01 Mar 10, 2021
fda5890
Updated /:id route
angel-sinn Mar 10, 2021
b246675
Added get route for /:id
angel-sinn Mar 10, 2021
6593223
Added addMarkers function
angel-sinn Mar 10, 2021
decfbd1
fix merge:
Isams01 Mar 10, 2021
ca9d902
Merge branch 'features/routes' of github.com:Isams01/mappi into featu…
Isams01 Mar 10, 2021
c982ccb
pins load on map
Isams01 Mar 10, 2021
9a52e4c
remove console.log statements
Isams01 Mar 10, 2021
7e67e85
rename map_test to map_view
Isams01 Mar 10, 2021
5d86332
change to map_view
Isams01 Mar 10, 2021
d0e5275
Merge branch 'develop' of github.com:Isams01/mappi into features/map_api
Isams01 Mar 10, 2021
db2a351
fixed query
Isams01 Mar 10, 2021
c69ffb9
commented out post to /:id
Isams01 Mar 10, 2021
0d9f3b7
comment out ajax for now
Isams01 Mar 10, 2021
e761721
Merge branch 'develop' of github.com:Isams01/mappi into features/map_api
Isams01 Mar 10, 2021
519b8b6
fix merge
Isams01 Mar 10, 2021
5408fce
fix weird get request to /c
Isams01 Mar 10, 2021
cd01962
remove querStr
Isams01 Mar 10, 2021
d0bf535
reference map_id instead of user_id
Isams01 Mar 10, 2021
ab4c6c6
remove unique id seed, let auto-increment
Isams01 Mar 10, 2021
21183e8
add pins to database
Isams01 Mar 10, 2021
1c0ca6d
move maps/create above maps/:id
Isams01 Mar 10, 2021
dc7fca0
send pins to db when click 'save mappi'
Isams01 Mar 10, 2021
711ec39
stuf
JoshuaRully Mar 10, 2021
864579b
not null to pk
JoshuaRully Mar 10, 2021
2819d11
Merge branch 'develop' of github.com:Isams01/mappi into features/ejs_…
angel-sinn Mar 10, 2021
4b065a3
remove hideous monstrsoity of a get request
JoshuaRully Mar 10, 2021
f826c09
Merge branch 'features/routes' of github.com:Isams01/mappi into develop
JoshuaRully Mar 10, 2021
e8a9908
Merge branch 'develop' of github.com:Isams01/mappi into features/ejs_…
angel-sinn Mar 10, 2021
e7a4deb
working state
angel-sinn Mar 10, 2021
832c1db
Updated href for Create Mappi and Dashboard button
angel-sinn Mar 10, 2021
3d53d28
Updated styling for nav buttons
angel-sinn Mar 10, 2021
c1031ca
query responds with location to redirect to, and removed some comment…
Isams01 Mar 10, 2021
e592d83
add redirect to maps/:id
Isams01 Mar 10, 2021
4e5686a
remove console.logs
Isams01 Mar 10, 2021
84539fd
Moved userAlice to global
angel-sinn Mar 10, 2021
456c819
Added user object to header
angel-sinn Mar 10, 2021
27887af
Added user id to userAlice
angel-sinn Mar 10, 2021
a2ed20e
return pins as single object
Isams01 Mar 10, 2021
6d07020
remove console.log statements
Isams01 Mar 10, 2021
4d89f4e
Merge branch 'features/map_api' into develop
Isams01 Mar 10, 2021
6e2eca0
fix merge
Isams01 Mar 10, 2021
ddf41be
Make a nicer prompt :)
Isams01 Mar 10, 2021
21a2122
update pin table and seeds
Isams01 Mar 10, 2021
32bee5b
add id to user
Isams01 Mar 10, 2021
6939b1f
add user_id to query
Isams01 Mar 10, 2021
12e9ca1
add user_id to pins
Isams01 Mar 10, 2021
4e39f1c
Added routes for contributed and faourited maps
angel-sinn Mar 10, 2021
9b42989
Added favourite button and updated id for contributed and favourited …
angel-sinn Mar 10, 2021
bce66f5
Added ajax for contributed and favourited maps
angel-sinn Mar 10, 2021
d2c5ea6
Updated contributed_maps route
angel-sinn Mar 10, 2021
3195773
Updated contributed to contributed_maps
angel-sinn Mar 10, 2021
dfd73bb
Updated class name for the 3 map divs to map-list
angel-sinn Mar 10, 2021
483fe3d
Updated styling for map-list class
angel-sinn Mar 10, 2021
4512a11
changed GET route from /:id/favourite_maps to ...favourited_maps
angel-sinn Mar 10, 2021
db04b33
Changed url from /favourite_maps to /favourited_maps
angel-sinn Mar 10, 2021
bd4e6d2
Added views/homepage.ejs
angel-sinn Mar 10, 2021
feb2d13
Added styling for homepage
angel-sinn Mar 10, 2021
effad0b
Fixed save mappi and save pin button
angel-sinn Mar 10, 2021
f928295
Updated styling for save mappi and save pin button
angel-sinn Mar 10, 2021
c16805c
Updated format of edit form
angel-sinn Mar 10, 2021
bf7b5f6
views/map_view.ejs
angel-sinn Mar 10, 2021
f4bf7f6
Added route for home
angel-sinn Mar 10, 2021
49e5484
Added route for home
angel-sinn Mar 10, 2021
fbd58a9
add image doesn't exit
Isams01 Mar 11, 2021
3953d99
working
Isams01 Mar 11, 2021
3dee2d5
add favourite maps handler
Isams01 Mar 11, 2021
17e94b3
fix map route
Isams01 Mar 11, 2021
b552c11
fixed like duct tape on a sinking boat
Isams01 Mar 11, 2021
e65aaad
original pins separate from new pins
Isams01 Mar 11, 2021
b27b61f
add save map functionality
Isams01 Mar 11, 2021
0991475
fix ajax missing close
Isams01 Mar 11, 2021
3994676
Added query to get all maps
angel-sinn Mar 11, 2021
7869722
Updated navbar height, and added all maps to homepage, and formatted …
angel-sinn Mar 11, 2021
661f877
Updated styling for navbar, boxes to display maps and buttons on map_…
angel-sinn Mar 11, 2021
f71e469
Merge branch 'develop' of github.com:Isams01/mappi into features/ejs_…
angel-sinn Mar 11, 2021
6a9a789
Updated anchor tag stylings so it stays within the div
angel-sinn Mar 11, 2021
e0a7f10
Deleted unused script tag
angel-sinn Mar 11, 2021
2fa0795
Imagine there is a house on top of a mountain of sand, and its fallin…
Isams01 Mar 11, 2021
16dbd3b
Merge branch 'develop' of github.com:Isams01/mappi into features/ejs_…
angel-sinn Mar 11, 2021
487cd4f
Removed duplicate save mappi button
angel-sinn Mar 11, 2021
d0b7b08
fix bug where improper image url saves incorrectly
Isams01 Mar 11, 2021
9f45211
Added more categories and updated hover effects
angel-sinn Mar 11, 2021
a1a9827
Updated styling for button hover effects
angel-sinn Mar 11, 2021
7016fd8
Merge branch 'develop' of github.com:Isams01/mappi into develop
angel-sinn Mar 11, 2021
be2f56e
demo quality seed data changes
JoshuaRully Mar 11, 2021
6f2d59b
Updated styling for delete button in infowindow
angel-sinn Mar 11, 2021
5569e2b
Updated function to auto close infowindow when another pin is clicked…
angel-sinn Mar 11, 2021
4a7ddd3
hardcode zoom for testing
JoshuaRully Mar 11, 2021
337b54a
update map location in db and locally
Isams01 Mar 11, 2021
fba5327
change form. to div.
Isams01 Mar 11, 2021
0b3b244
send mapdata in ajax to map put request
Isams01 Mar 11, 2021
0690cb0
save map location
Isams01 Mar 11, 2021
da312cd
Send 200 after query complete
Isams01 Mar 11, 2021
b19c305
fav mappi button adds to favourites and disables after click
Isams01 Mar 11, 2021
6835d9c
Added type animation to homepage p
angel-sinn Mar 11, 2021
199fefc
Merge branch 'develop' of github.com:Isams01/mappi into refactor/seeds
JoshuaRully Mar 11, 2021
5eaf4c2
incoming merge change
JoshuaRully Mar 11, 2021
30ccc7d
Updated button styling and animation text on homepage
angel-sinn Mar 11, 2021
7d3a1b0
Merge branch 'develop' of github.com:Isams01/mappi into features/ejs_…
angel-sinn Mar 11, 2021
7b0719c
Updated yeahh to yeah
angel-sinn Mar 11, 2021
56db097
Updated homepage animation keyframes
angel-sinn Mar 11, 2021
2685eba
map2 and pins done
JoshuaRully Mar 11, 2021
e2aaa63
map3 favourite map from other user done
JoshuaRully Mar 11, 2021
712a48b
map4 collaborated map from user done
JoshuaRully Mar 11, 2021
5cb4bb2
Added icons to corresponding categories
angel-sinn Mar 11, 2021
4752c17
Updated styling for icons
angel-sinn Mar 11, 2021
38bc9b3
Merge branch 'develop' of github.com:Isams01/mappi into features/ejs_…
angel-sinn Mar 11, 2021
2a95d62
Updated category labeling convention to match db to show icons
angel-sinn Mar 11, 2021
1da8131
Updated title in <head> to display correct title of each page on browser
angel-sinn Mar 11, 2021
db49c9f
Made div boxes in homepage wider
angel-sinn Mar 11, 2021
f7120a3
Updated seed data to feature contributed_maps
angel-sinn Mar 12, 2021
474b94b
Fixed bug in delete button
angel-sinn Mar 12, 2021
d91e3f8
Updated styling for delete button
angel-sinn Mar 12, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ public/styles
.env
*.log
*.sqlite3
.DS_Store
5 changes: 4 additions & 1 deletion db/schema/01_users.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
DROP TABLE IF EXISTS users CASCADE;
CREATE TABLE users (
id SERIAL PRIMARY KEY NOT NULL,
name VARCHAR(255) NOT NULL
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
image VARCHAR (255)
);
13 changes: 13 additions & 0 deletions db/schema/02_maps.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Drop and recreate Maps table (Example)

DROP TABLE IF EXISTS maps CASCADE;
CREATE TABLE maps (
id SERIAL PRIMARY KEY NOT NULL,
user_id INT REFERENCES users(id) ON DELETE CASCADE,
title VARCHAR(255) NOT NULL,
description TEXT NOT NULL,
category VARCHAR(255) NOT NULL,
lat DECIMAL (8,6) NOT NULL,
lng DECIMAL (9,6) NOT NULL,
zoom INT DEFAULT 10
);
15 changes: 15 additions & 0 deletions db/schema/03_pins.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Drop and recreate Pins table (Example)

DROP TABLE IF EXISTS pins CASCADE;
CREATE TABLE pins (
-- NOT NULL below might break things
id SERIAL PRIMARY KEY NOT NULL,
map_id INT REFERENCES maps(id) ON DELETE CASCADE,
user_id INT REFERENCES users(id) ON DELETE CASCADE,
title VARCHAR(255) NOT NULL,
description TEXT,
image_url VARCHAR(255),
lat DECIMAL (8,6),
lng DECIMAL (9,6),
address VARCHAR(255) NOT NULL
);
8 changes: 8 additions & 0 deletions db/schema/04_favourite_maps.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- Drop and recreate Favourite Maps table (Example)

DROP TABLE IF EXISTS favourite_maps CASCADE;
CREATE TABLE favourite_maps (
id SERIAL PRIMARY KEY NOT NULL,
user_id INT REFERENCES users(id) ON DELETE CASCADE,
map_id INT REFERENCES maps(id) ON DELETE CASCADE
);
8 changes: 0 additions & 8 deletions db/schema/05_widgets.sql

This file was deleted.

8 changes: 5 additions & 3 deletions db/seeds/01_users.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Users table seeds here (Example)
INSERT INTO users (name) VALUES ('Alice');
INSERT INTO users (name) VALUES ('Kira');
-- Test data below

INSERT INTO users (id, name, email, password) VALUES
(1, 'Alice', '[email protected]', 'password'),
(2, 'Kira', '[email protected]', 'password');
9 changes: 9 additions & 0 deletions db/seeds/02_maps.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
INSERT INTO maps (user_id, title, description, category, lat, lng, zoom) VALUES
-- user 1 maps ALICE ~ grumpy cat 😾
(1, 'Vancouver Restaurants', 'Interesting restaurants around Vancouver', 'Restaurants', 49.2827, -123.1207, 12),

(2, 'Toronto Cafes', 'Hipster cafes around Toronto', 'Cafes', 43.6532, -79.3832, 12),
-- user 2 maps KIRA
(2, 'Calgary Parks', 'Sweet parks to visit with friends', 'Parks', 51.0447, -114.0719, 11),

(2, 'BC Sightseeing', 'Popular spots and obscure gems', 'Sightseeing', 53.7267, -127.6476, 6);
22 changes: 22 additions & 0 deletions db/seeds/03_pins.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- TEST DATA BELOW
INSERT INTO pins (map_id, user_id, title, description, image_url, lat, lng, address) VALUES
-- Map 1
(1, 1, 'Cardero Restaurant', 'Fine Dining Marina Restaurant', 'https://media-cdn.tripadvisor.com/media/photo-s/12/ab/ad/61/photo0jpg.jpg', 49.291674, -123.127480, '1583 Coal Harbour Quay, Vancouver, BC V6G 3E7'),
(1, 1, 'Black Frog Eatery','Cozy and comfy eatery', 'https://ssmscdn.yp.ca/image/resize/e9814e29-da35-49cb-8a91-af766f7b0b7a/ypui-d-mp-pic-gal-lg/black-frog-eatery-2.jpg', 49.285227, -123.108532, '108 Cambie St, Vancouver, BC V6B 2M8'),
(1, 2, 'Dark Table', 'Blind servers dining experience', 'https://s3-media0.fl.yelpcdn.com/bphoto/6ngjBBEeA6V3qXX3BEusww/o.jpg', 49.268591, -123.164907, '2611 W 4th Ave, Vancouver, BC V6K 1P8'),
(1, 2, 'Gyu-Kaku Japanese BBQ', 'Japanese BBQ chain', 'https://d1ralsognjng37.cloudfront.net/d6a34492-0be9-4ffe-a5fd-32fc90428a43.jpeg', 49.263429, -123.125686, '950 W Broadway #201, Vancouver, BC V5Z 1K7'),
-- Map 2 ~ pins from two users
(2, 2, 'LEspresso Bar Mercurio', 'Modern Italian Cafe', 'https://media-cdn.tripadvisor.com/media/photo-s/1a/35/64/93/main-dining-room.jpg', 43.667611, -79.399141, '321 Bloor St W, Toronto, ON M5S 1S5'),
(2, 2, 'Quantum Coffee', 'Hipster cafe for nerds','http://dailycoffeenews.com/wp-content/uploads/2015/12/Quantum-Espresso-Bar-620x415.jpg', 43.645620, -79.395342, '460 King St W, Toronto, ON M5V 1L7'),
(2, 2, 'JetFuel Coffee Shop', 'Indie espresso joint', 'https://torontoist.com/attachments/toronto_david/villain_jetfuel.jpg', 43.665482, -79.368235, '519 Parliament St, Toronto, ON M4X 1P3'),
(2, 2, 'Liberty Village Market & Cafe', 'Unfussy cafe outlet', 'https://s3-media0.fl.yelpcdn.com/bphoto/hMRTh3EiHHwOf1DtVScSPQ/o.jpg', 43.638169, -79.421348, '65 Jefferson Ave, Toronto, ON M6K 1Y3'),
-- Map 3 ~ Favourited Map from other user
(3, 2, 'South Glenmore Park', 'Waterfront green space with biking and hiking', 'https://media.chatterblock.com/cache/4e/91/4e9161e01f730ff5dca466be2b77c570.jpg', 50.973261, -114.119102, '24 St SW, Calgary, AB T2V 3N8'),
(3, 2, 'Fish Creek Provincial Park', 'Expansive park','https://www.dalhousiecalgary.ca/wp-content/uploads/2020/07/fish-creek-park.jpg', 50.914949, -114.010757, 'Calgary, AB'),
(3, 2, 'Nose Hill Park', 'Tranquil, spacious park with abundant wildlife', 'https://i.redd.it/o4hj9azfud411.jpg', 51.110487, -114.108844, '5620 14 St NW, Calgary, AB T3K 2P6'),
(3, 2, 'Bowness Park', 'Serene spot with a lagoon and winter ice skating', 'https://upload.wikimedia.org/wikipedia/commons/3/37/Bowness_Park_lagoon.jpg', 51.097463, -114.217076, '8900 48 Ave NW, Calgary, AB T3B 2B2'),
-- Map 4 ~ Collaborated Map from other user
(4, 2, 'Bergeron Falls', 'Hidden falls are a satisfying reward after the approach', 'https://s2.wklcdn.com/image_11/340586/20764032/12995222Master.jpg', 55.204234, -120.976821, 'Tumbler Ridge, BC V0C 2W0'),
(4, 2, 'Mount Tantalus', 'Beautiful mountain, part of an amazing surrounding range','https://peakvisor.com/img/news/Tantalus-Range.jpg', 49.819521, -123.329358, 'Sunshine Coast B, BC V0N 1H0'),
(4, 2, 'Mackenzie', 'Quaint town with plenty nature to explore just outside', 'https://upload.wikimedia.org/wikipedia/commons/d/dc/MackenziefromMorfeeMountain.jpg', 55.354453, -123.087940, 'Mackenzie, BC'),
(4, 1, 'Clearwater', 'Municipality featuring the Clearwater River-Thompson River tributary', 'https://dynamic-media-cdn.tripadvisor.com/media/photo-o/01/7d/95/6f/helmcken-falls.jpg?w=500&h=300&s=1', 51.652008, -120.037911, 'Clearwater, BC');
2 changes: 2 additions & 0 deletions db/seeds/04_favourite_maps.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO favourite_maps (user_id, map_id) VALUES
(1, 3), (2, 1), (2, 2);
4 changes: 0 additions & 4 deletions db/seeds/05_widgets.sql

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"morgan": "^1.10.0",
"node-sass-middleware": "^0.11.0",
"pg": "^6.4.2",
"pg-native": "^3.0.0"
"pg-native": "^3.0.0",
"request": "^2.88.2"
},
"devDependencies": {
"nodemon": "^1.19.4"
Expand Down
11 changes: 0 additions & 11 deletions public/index.html

This file was deleted.

10 changes: 4 additions & 6 deletions public/scripts/app.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
$(() => {
$.ajax({
method: "GET",
url: "/api/users"
}).done((users) => {
for(user of users) {
$("<div>").text(user.name).appendTo($("body"));
}
});;
url: `/pins/${mapId}`
}).done((res) => {
addMarkers(res);
})
});
26 changes: 26 additions & 0 deletions public/scripts/getUserMaps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
$(() => {
$.ajax({
method: "GET",
url: `/users/${currentUser.id}/contributed_maps`
}).done((res) => {
console.log(res);
for (let map of res) {
let mapLine = `<a href="/maps/${map.map_id}"><div>${map.title}</div></a>`;
$('#contributed-maps').append(mapLine);
}
})

$.ajax({
method: "GET",
url: `/users/${currentUser.id}/favourite_maps`
}).done((res) => {
console.log(res);
for (let map of res) {
let mapLine = `<a href="/maps/${map.map_id}"><div>${map.map_title}</div></a>`;
$('#favourite-maps').append(mapLine);
}
})

});


17 changes: 17 additions & 0 deletions public/scripts/helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// helper functions below
module.exports = (db) => {

return getPins = function(map_id) {
const queryStr = `
SELECT pins.*
FROM maps
JOIN pins ON maps.id = map_id
WHERE map_id = $1;
`;
return db.query(queryStr, [map_id])
.then(res => res.rows)
.catch(err => (console.log(err.stack)));
};
}


43 changes: 43 additions & 0 deletions routes/favourite_maps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// All routes for Favourite Maps are defined here

const express = require('express');
const router = express.Router();

// GETs below

module.exports = (db) => {
router.get("/", (req, res) => {
console.log('inside get request');
let query = "SELECT * FROM favourite_maps;";
db.query(query)
.then(data => {
const favourite_maps = data.rows;
res.json({ favourite_maps });
})
.catch(err => {
res
.status(500)
.json({ error: err.message });
});
});

router.post("/", (req, res) => {

let query = `
INSERT INTO favourite_maps (user_id, map_id)
VALUES ($1, $2);
`;
return db.query(query, [parseInt(req.body.user_id), parseInt(req.body.map_id)])
.then(data => {
res.sendStatus(200);
})
.catch(err => {
res
.status(500)
.json({ error: err.message });
});
});
return router;
};

// POSTs below
30 changes: 30 additions & 0 deletions routes/home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const express = require('express');
const router = express.Router();

// GETs below

module.exports = (db) => {

const userAlice = {
id: 1,
name: 'Alice',
email: '[email protected]',
password: 'password',
image: 'https://images.unsplash.com/photo-1513245543132-31f507417b26?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=675&q=80',
}

router.get("/", (req, res) => {

let query = `SELECT * FROM maps;`;
return db.query(query)
.then(response => {
const templateVars = {
user: userAlice,
mapData: response.rows
}
res.render("homepage", templateVars);
})
});
return router;
};

Loading