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..290306f
--- /dev/null
+++ b/models/truck.js
@@ -0,0 +1,18 @@
+// 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
+ }
+ });
+
+ 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..0fbd536
--- /dev/null
+++ b/public/find_Or_Post.html
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+ Test Area
+
+
+
+
+
+
+
+
+
+
+ Id |
+ Truck Name |
+ Cuisine Type |
+ Neighborhood |
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/images/truck.jpg b/public/images/truck.jpg
new file mode 100644
index 0000000..ebda42b
Binary files /dev/null and b/public/images/truck.jpg differ
diff --git a/public/js/find_Or_Post.js b/public/js/find_Or_Post.js
new file mode 100644
index 0000000..4eef25d
--- /dev/null
+++ b/public/js/find_Or_Post.js
@@ -0,0 +1,172 @@
+$(document).ready(function() {
+ // Getting references to our form and inputs
+ var findTruckForm = $("form.find");
+ var truckNameInput = $("input#truck_name");
+ var locationInput = $("input#location");
+ var cuisineTypeInput = $("input#cuisine_type");
+
+ var addTruckForm = $("form.add");
+ var addTruckNameInput = $("input#add_truck_name");
+ var addLocationInput = $("input#add_location");
+ var addCuisineTypeInput = $("input#add_cuisine_type");
+
+ var tableList = $("#tableList");
+ var tableBody = $("#tableBody");
+
+ findTruckForm.on("submit", function(event) {
+ event.preventDefault();
+
+ var findUserData = {
+ name: truckNameInput.val().trim(),
+ cuisine: cuisineTypeInput.val().trim(),
+ neighborhood: locationInput.val().trim()
+ };
+
+ // tableList.empty();
+ $(".table")
+ .find("tbody")
+ .empty();
+
+ // var userData = {
+ // name: truckNameInput.val().trim(),
+ // cuisine: cuisineTypeInput.val().trim(),
+ // neighborhood: locationInput.val().trim()
+
+ // }
+
+ // $.get("/api/trucks", function (data) {
+ // console.log(data);
+ // });
+ $.post("/api/trucks/search", findUserData).then(function(data) {
+
+ console.log(data);
+ console.log("------------------------------------");
+
+ for (var i = 0; i < data.length; i++) {
+ $(".table")
+ .find("tbody")
+ // .append($('').append($('').append($('').attr('src', 'img.png').text('Image cell'))))
+ .append(
+ $(" |
")
+ // .append($('').text(data[i].id))
+ .append($(' | ').text(data[i].id))
+ .append($(" | ").text(data[i].name))
+ .append($(" | ").text(data[i].cuisine))
+ .append($(" | ").text(data[i].neighborhood))
+ );
+ }
+ });
+ });
+$(document).ready(function () {
+ // Getting references to our form and inputs
+ var findTruckForm = $("form.find");
+ var truckNameInput = $("input#truck_name");
+ var cuisineTypeInput = $("input#cuisine_type");
+ var locationInput = $("input#location");
+
+ var addTruckForm = $("form.add");
+ var addTruckNameInput = $("input#add_truck_name");
+ var addLocationInput = $("input#add_location");
+ var addCuisineTypeInput = $("input#add_cuisine_type");
+
+ findTruckForm.on("submit", function (event) {
+ event.preventDefault();
+ clearTable();
+
+ var searchBy = {
+ name: truckNameInput.val().trim(),
+ cuisine: cuisineTypeInput.val().trim(),
+ neighborhood: locationInput.val().trim()
+ }
+
+ // Make sure atleast one field has been filled
+ if (!searchBy.name && !searchBy.cuisine && !searchBy.neighborhood) {
+ console.log("PLEASE SELECT ATLEAST ONE ITEM TO SEARCH FOR");
+
+ tstQry();
+ // Search by name, cuisine, neighborhood
+ } else if (searchBy.name && searchBy.cuisine && searchBy.neighborhood) {
+ console.log("search by ALL 3");
+
+ // Search by name only
+ } else if (searchBy.name && !searchBy.cuisine && !searchBy.neighborhood) {
+ queryByName(searchBy);
+
+ // Search by cuisine
+ } else if (!searchBy.name && searchBy.cuisine && !searchBy.neighborhood) {
+ console.log("search by CUISINE");
+ queryByCuisine(searchBy);
+
+ // Search by location
+ } else if (!searchBy.name && !searchBy.cuisine && searchBy.neighborhood) {
+ console.log("search by LOCATION");
+
+ // Search by name and cuisine
+ } else if (searchBy.name && searchBy.cuisine && !searchBy.neighborhood) {
+ console.log("search by NAME & CUISINE");
+
+ // Search by name and location
+ } else if (searchBy.name && !searchBy.cuisine && searchBy.neighborhood) {
+ console.log("search by NAME & LOCATION");
+
+ // Search by cuisine and location
+ } else if (!searchBy.name && searchBy.cuisine && searchBy.neighborhood) {
+ console.log("search by CUISINE & LOCATION");
+ }
+ });
+
+ function tstQry(){
+ $.ajax({ url: "/api/trucks", method: "GET" })
+ .then(renderTable);
+ }
+
+
+
+ function queryByName(searchBy){
+ console.log(searchBy);
+ $.get("/api/trucks/" + searchBy.name, function(qryResults){
+ renderTable(qryResults);
+ });
+ }
+
+ function queryByCuisine(searchBy){
+ $.get("/api/trucks/cuisine/" + searchBy.cuisine, function(qryResults){
+ renderTable(qryResults);
+ });
+ }
+
+
+
+
+
+
+ function clearTable(){
+ $(".table").find('tbody').empty();
+ }
+
+ function renderTable(qryResults) {
+ for (var i = 0; i < qryResults.length; i++) {
+
+ $(".table").find('tbody')
+ .append($(' |
')
+ .append($('').text(qryResults[i].id))
+ .append($(' | ').text(qryResults[i].name))
+ .append($(' | ').text(qryResults[i].cuisine))
+ .append($(' | ').text(qryResults[i].neighborhood)));
+ }
+ }
+
+ addTruckForm.on("submit", function(event) {
+ event.preventDefault();
+
+ var addUserData = {
+ name: addTruckNameInput.val().trim(),
+ cuisine: addCuisineTypeInput.val().trim(),
+ neighborhood: addLocationInput.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/members.html b/public/members.html
index 392a23c..544f54f 100644
--- a/public/members.html
+++ b/public/members.html
@@ -5,12 +5,15 @@
Passport Authentication
-
+
+
+
+
- |