diff --git a/.env.example b/.env.example deleted file mode 100644 index 0bde88a..0000000 --- a/.env.example +++ /dev/null @@ -1,2 +0,0 @@ -SESSION_SECRET=??????? -LOCALDB_URL=mysql://user:password@localhost:3306/Project2Dev \ No newline at end of file diff --git a/README.md b/README.md index 38aaa39..c764349 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,10 @@ LOCALDB_URL=mysql://root:dbpassword@localhost:3306/Project2Dev ### Autofix linting errors where pssible (Note: this will not necessarily fix all of them) npm run fix - ### Associated Links (requires you to be logged into github): [Project Requirements](https://github.com/the-Coding-Boot-Camp-at-UT/UTA-AUS-FSF-FT-06-2020-U-C/blob/master/01-Class-Content/15-Project-2/02-Homework/README.md [Deployment w/ Sequelize](https://github.com/the-Coding-Boot-Camp-at-UT/UTA-AUS-FSF-FT-06-2020-U-C/blob/master/01-Class-Content/14-Full-Stack/04-Supplemental/SequelizeHerokuDeploymentProcess.md) -testing123 \ No newline at end of file +testing............` \ No newline at end of file diff --git a/config/config.json b/config/config.json index 2e2db25..af3e473 100644 --- a/config/config.json +++ b/config/config.json @@ -1,11 +1,12 @@ { "development": { - "use_env_variable": "LOCALDB_URL" + "use_env_variable": "LOCALDB_URL", + "dialect": "mysql" }, "test": { "username": "root", "password": null, - "database": "database_test", + "database": "fmf", "host": "127.0.0.1", "dialect": "mysql" }, diff --git a/db/schema.sql b/db/schema.sql index b03afda..f05151e 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -1,2 +1,28 @@ -DROP DATABASE IF EXISTS Project2Dev; -CREATE DATABASE Project2Dev; \ No newline at end of file +DROP DATABASE IF EXISTS fmf; +CREATE DATABASE fmf; +USE fmf; + +CREATE TABLE trucks ( + id INT NOT NULL AUTO_INCREMENT, + name VARCHAR(45) NULL, + cuisine VARCHAR (45), + neighborhood VARCHAR (45), + createdAt DATE, + updatedAt DATE, + PRIMARY KEY (id) +); + +INSERT INTO trucks (name, cuisine, neighborhood, createdAt, UpdatedAt) +VALUES ("Veracruz All Natural", "Mexican", "4208 Manchaca Rd. 78704", now(), now()), +("Gordoughs Big Fat Donuts", "American", "1503 South First Street 78704", now(), now()), +("Con Madre Kitchen", "Mexican", "628 E Oltorf St", now(), now()), +("Pueblo Viejo Taco Truck", "Mexican", "121 Pickle Rd", now(), now()), +("Mama Mal's Italian Cuisine Food Truck", "Southern Italian", "1320 S Lamar Blvd", now(), now()), +("Tamale Addiction", "Mexican", "2340 S Lamar Blvd", now(), now()), +("IL Saporis Italian", "Italian", "603 W Live Oak St", now(), now()), +("Luke's Inside Out", "Sandwich", "1109 S Lamar Blvd", now(), now()), +("Pitalicious", "Mediterranean", "1503 S Congress Ave", now(), now()), +("Cannone Cucina Italiana", "Italian", "1720 Barton Springs Rd", now(), now()); +SELECT * FROM fmf.trucks; + + diff --git a/db/schemaV1.sql b/db/schemaV1.sql new file mode 100644 index 0000000..e69de29 diff --git a/models/truck.js b/models/truck.js new file mode 100644 index 0000000..751e5f5 --- /dev/null +++ b/models/truck.js @@ -0,0 +1,24 @@ +// Creating our User model +module.exports = function(sequelize, DataTypes) { + var Truck = sequelize.define("Truck", { + // The email cannot be null, and must be a proper email before creation + name: { + type: DataTypes.STRING + }, + cuisine: { + type: DataTypes.STRING + }, + neighborhood: { + type: DataTypes.STRING + }, + latitude: { + type: DataTypes.FLOAT + }, + longitude: { + type: DataTypes.FLOAT + } + }); + + return Truck; +}; + diff --git a/package.json b/package.json index 927bfa8..759f820 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "test": "npm run lint", "start": "node server.js", + "dev": "nodemon server.js", "lint": "eslint --quiet .", "fix": "eslint --fix .", "watch": "nodemon server.js" @@ -14,11 +15,12 @@ "author": "", "license": "ISC", "dependencies": { + "@ciar4n/izmir": "^1.0.1", "bcryptjs": "2.4.3", "dotenv": "^8.2.0", "express": "^4.17.0", "express-session": "^1.16.1", - "mysql2": "^1.6.5", + "mysql2": "^1.7.0", "passport": "^0.4.0", "passport-local": "^1.0.0", "sequelize": "^5.8.6" diff --git a/public/find_Or_Post.html b/public/find_Or_Post.html new file mode 100644 index 0000000..2201294 --- /dev/null +++ b/public/find_Or_Post.html @@ -0,0 +1,96 @@ + + + +
+ + + + +Id | +Truck Name | +Cuisine Type | +Neighborhood | +
---|
'); + let neighborhoodEl = $('
'); + + resBox.attr('class',"card") + nameEl.text(qryResults[i].name); + nameEl.attr("class","title"); + cuisineEl.text(qryResults[i].cuisine); + cuisineEl.attr("class","subtitle"); + neighborhoodEl.text(qryResults[i].neighborhood); + neighborhoodEl.attr("class","card-footer"); + + + resBox.append(nameEl); + resBox.append(cuisineEl); + resBox.append(neighborhoodEl); + + $('.table').find('tbody').append(resBox); + } + } + + + $("#view_all").on("click", function(){ + qryAllRecords(); + + + }) + + + function qryAllRecords() { + $.ajax({ url: "/api/trucks", method: "GET" }) + // .then (renderTable) + .then(function(qryResults){ + // renderResults(qryResults); + renderTable(qryResults); + + + }); + } + + + + + // WORKS FINE + addTruckForm.on("submit", function(event) { + event.preventDefault(); + + var addUserData = { + name: addTruckNameInput.val().trim(), + cuisine: addCuisineTypeInput.val().trim(), + neighborhood: addLocationInput.val().trim(), + latitude: addLatitude.val().trim(), + longitude: addLongitude.val().trim() + }; + + $.post("/api/trucks", addUserData).then(function(data) { + console.log(data); + }); + }); +}); + diff --git a/public/js/members.js b/public/js/members.js index 0d65799..6efec41 100644 --- a/public/js/members.js +++ b/public/js/members.js @@ -5,3 +5,46 @@ $(document).ready(function() { $(".member-name").text(data.email); }); }); + + +const triggers=document.querySelectorAll('.cool > li'); +const background=document.querySelector('.dropdownBackground'); +const nav=document.querySelector('.top'); + + +function handleEnter() { + this.classList.add('trigger-enter'); + setTimeout(() => { + if(this.classList.contains('trigger-enter')) { + this.classList.add('trigger-enter-active') + } + },150); + background.classList.add('open'); + const dropdown=this.querySelector('.dropdown'); + const dropdownCoords=dropdown.getBoundingClientRect(); + const navCoords=nav.getBoundingClientRect(); + + const coords={ + height: dropdownCoords.height, + width: dropdownCoords.width, + top: dropdownCoords.top-navCoords.top, + left: dropdownCoords.left-navCoords.left, + } + + background.style.setProperty('width',`${coords.width}px`); + background.style.setProperty('height',`${coords.height}px`); + background.style.setProperty('transform',`translate(${coords.left}px, ${coords.top}px)`); + +} + + +function handleLeave() { + this.classList.remove('trigger-enter','trigger-enter-active'); + background.classList.remove('open'); + + const dropdown=this.querySelector('.dropdown'); +} + + +triggers.forEach(trigger => trigger.addEventListener('mouseenter',handleEnter)); +triggers.forEach(trigger => trigger.addEventListener('mouseleave',handleLeave)); diff --git a/public/login.html b/public/login.html index bf53ede..68bea8c 100644 --- a/public/login.html +++ b/public/login.html @@ -7,32 +7,37 @@ + +
- @@ -43,3 +48,4 @@