diff --git a/.gitignore b/.gitignore
index cf709889..e83349ad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
-**/node_modules
+/node_modules
+
+.DS_Stores
diff --git a/README.md b/README.md
index 63387dea..a0800b85 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,7 @@ Now that we're deployed, it's time to start coding your "personal" api!
- One cool way to do this is to create an endpoint at `/api` that describes all the available endpoints. We've set you up with an example in `server.js`. Make sure to update it to fill it in with your own information!
+ Here's a good example student `/api` endpoint:
-
+
+ See the [Open API Initiative](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#paths-object-example) for what this looks like in practice.
- **A Profile Endpoint** (`/api/profile`) that responds with *hard-coded* data:
diff --git a/controllers/apiController.js b/controllers/apiController.js
new file mode 100644
index 00000000..3fd0d861
--- /dev/null
+++ b/controllers/apiController.js
@@ -0,0 +1,16 @@
+function index(req, res) {
+ res.json({
+ message: "Welcome to my personal api! Here's what you need to know!",
+ documentation_url: "https://github.com/example-username/express-personal-api/README.md",
+ base_url: "localhost:3000",
+ endpoints: [
+ {
+ method: "GET", path: "/api", description: "Describes available endpoints"
+ }
+ ]
+ });
+}
+
+module.exports = {
+ index: index
+}
diff --git a/controllers/index.js b/controllers/index.js
new file mode 100644
index 00000000..677e1708
--- /dev/null
+++ b/controllers/index.js
@@ -0,0 +1,4 @@
+module.exports = {
+ api: require('./apiController'),
+ profile: require('./profileController'),
+}
diff --git a/controllers/profileController.js b/controllers/profileController.js
new file mode 100644
index 00000000..d1562556
--- /dev/null
+++ b/controllers/profileController.js
@@ -0,0 +1,107 @@
+/************
+ * DATABASE *
+ ************/
+
+const db = require('../models');
+
+
+// GET renderSearchResults => on load of the page what to be able to render the search results page which loads the 10 people in the database
+ // append profileSRP from the SRP section
+ // fill in the correct user information
+
+// Function to send back everything
+ // function searchResultsPage(req, res) {
+ // console.log('SRP is getting data')
+ // db.Profile.find({}, function(err, allProfiles) {
+ // res.json(allProfiles)
+ // })
+ // res.status(200)
+ // };
+
+// function that ONLY sends back ones that are NOT marked for delation => used for initial SRP
+function searchResultsPage(req, res) {
+ console.log('SRP is getting data')
+ db.Profile.find({}, function(err, allProfiles) {
+ let arrayOfProfilesToBeShown = [];
+ let arrayOfProfilesMarkedForDeletion = [];
+ allProfiles.forEach(function(profile) {
+ if ( profile.markedForDeletion === false) {
+ arrayOfProfilesToBeShown.push(profile);
+ } else {
+ arrayOfProfilesMarkedForDeletion.push(profile);
+ }
+ });
+ res.json(arrayOfProfilesToBeShown);
+ console.log('DONT SEND BACK', arrayOfProfilesMarkedForDeletion);
+ });
+};
+
+// GET (SEND user ID) and renderProfile need to be able to click on a person, take that id and route them to a profile page
+
+function showOneProfile(req, res) {
+ console.log('showOneProfile Route is getting hit', req.params.profileId);
+ db.Profile.findById(req.params.profileId, function(err, foundProfile) {
+ if (err) {
+ console.log('showOneProfile in controller had an error', err);
+ }
+ // send back the Profile info the DB via json file
+ res.json(foundProfile);
+ });
+
+};
+
+// POST createNewUser => able to create a new user on the SRP and then render that new person
+function createNewProfile(req, res) {
+ console.log('CREATE NEW PROFILE', req.body)
+ db.Profile.create(req.body, function(err, newProfile) {
+ if (err) {
+ console.log('ERROR ON CREATE', err)
+ }
+ res.json(newProfile);
+ console.log('NEW PROFILE INFO SENT BACK', newProfile)
+ })
+};
+
+
+
+// PUT able to update the user on the renderProfile page (able to update each spot individually)
+
+function updateOneProfile(req, res) {
+ console.log('updateOneProfile Route is getting hit!!!', req.body)
+ db.Profile.findByIdAndUpdate(req.params.profileId, {$set: {
+ name: req.body.name,
+ title: req.body.title,
+ workPlace: req.body.workPlace,
+ quote: req.body.quote,
+ image: req.body.image,
+ }}, {new: true}, function(err, saveProfile) {
+ if (err) {
+ console.log('THERE WAS AN ERROR DURING updateOneProfile Save', err);
+ }
+ console.log('updateOneProfile SAVED AND JSON IS SENT BACK', saveProfile);
+ res.json(saveProfile)
+ })
+};
+
+// DELETE / PUT able to 'hit the delete flag' and not show up the user anymore vs actually deleting their information
+
+function removeOneProfile(req, res) {
+ console.log('removeOneProfile IS GETTING HITTT!!!!!', req.body)
+ db.Profile.findByIdAndUpdate(req.params.profileId, {$set: {
+ markedForDeletion: req.body.markedForDeletion}}, {new: true}, function(err, removedProfile) {
+ if (err) {
+ console.log ('THERE WAS AN ERROR DURING removeOneProfile', err);
+ }
+ console.log('removeOneProfile SAVED and removed profile JSON sent back', removedProfile);
+ res.json(removedProfile);
+ });
+
+};
+
+module.exports = {
+ searchResultsPage: searchResultsPage,
+ createNewProfile: createNewProfile,
+ showOneProfile: showOneProfile,
+ updateOneProfile: updateOneProfile,
+ removeOneProfile: removeOneProfile
+};
diff --git a/models/campsite.js.example b/models/campsite.js.example
deleted file mode 100644
index cb9e8ee6..00000000
--- a/models/campsite.js.example
+++ /dev/null
@@ -1,10 +0,0 @@
-// var mongoose = require('mongoose'),
-// Schema = mongoose.Schema;
-
-// var CampsiteSchema = new Schema({
-// description: String
-// });
-
-// var Campsite = mongoose.model('Campsite', CampsiteSchema);
-
-// module.exports = Campsite;
diff --git a/models/index.js b/models/index.js
index 66997fe0..47d23da0 100644
--- a/models/index.js
+++ b/models/index.js
@@ -1,5 +1,10 @@
var mongoose = require("mongoose");
-mongoose.connect( process.env.MONGODB_URI || "mongodb://localhost/personal-api", {useMongoClient: true});
+// mongoose.connect( process.env.MONGODB_URI || "mongodb://localhost/personal-api", {useMongoClient: true});
+mongoose.connect( process.env.MONGODB_URI || 'mongodb://localhost/personal-api' );
+
mongoose.Promise = global.Promise; // use native Promise
-// module.exports.Campsite = require("./campsite.js.example");
+const Profile = require('./profile');
+
+
+module.exports.Profile = require("./profile.js");
diff --git a/models/profile.js b/models/profile.js
new file mode 100644
index 00000000..18d071a1
--- /dev/null
+++ b/models/profile.js
@@ -0,0 +1,19 @@
+const mongoose = require("mongoose");
+const Schema = mongoose.Schema;
+
+const ProfileSchema = new Schema({
+ name: String,
+ userName: String,
+ image: String,
+ title: String,
+ workPlace: String,
+ quote: String,
+ aboutMe: String,
+ socialNetwork: [String],
+ skills: [String],
+ markedForDeletion: Boolean,
+});
+
+const Profile = mongoose.model('Profile', ProfileSchema);
+
+module.exports = Profile;
diff --git a/public/images/assets/edit.svg b/public/images/assets/edit.svg
new file mode 100644
index 00000000..81ea4839
--- /dev/null
+++ b/public/images/assets/edit.svg
@@ -0,0 +1,43 @@
+
+
+
+
diff --git a/public/images/social/github.png b/public/images/social/github.png
new file mode 100644
index 00000000..941ccc00
Binary files /dev/null and b/public/images/social/github.png differ
diff --git a/public/images/social/linkedin.png b/public/images/social/linkedin.png
new file mode 100644
index 00000000..78f029d9
Binary files /dev/null and b/public/images/social/linkedin.png differ
diff --git a/public/images/social/original/github.png b/public/images/social/original/github.png
new file mode 100644
index 00000000..9490ffc6
Binary files /dev/null and b/public/images/social/original/github.png differ
diff --git a/public/images/userimages/anil.jpg b/public/images/userimages/anil.jpg
new file mode 100644
index 00000000..aeb862d8
Binary files /dev/null and b/public/images/userimages/anil.jpg differ
diff --git a/public/images/userimages/carlynn.jpg b/public/images/userimages/carlynn.jpg
new file mode 100644
index 00000000..4ec877b3
Binary files /dev/null and b/public/images/userimages/carlynn.jpg differ
diff --git a/public/images/userimages/connor.jpg b/public/images/userimages/connor.jpg
new file mode 100644
index 00000000..bc4fcaab
Binary files /dev/null and b/public/images/userimages/connor.jpg differ
diff --git a/public/images/userimages/ericchoi.jpg b/public/images/userimages/ericchoi.jpg
new file mode 100644
index 00000000..3969429f
Binary files /dev/null and b/public/images/userimages/ericchoi.jpg differ
diff --git a/public/images/userimages/ganesh.jpg b/public/images/userimages/ganesh.jpg
new file mode 100644
index 00000000..26920d1e
Binary files /dev/null and b/public/images/userimages/ganesh.jpg differ
diff --git a/public/images/userimages/huan.jpg b/public/images/userimages/huan.jpg
new file mode 100644
index 00000000..6ae9ac0e
Binary files /dev/null and b/public/images/userimages/huan.jpg differ
diff --git a/public/images/userimages/jevell.jpg b/public/images/userimages/jevell.jpg
new file mode 100644
index 00000000..90b8d4d7
Binary files /dev/null and b/public/images/userimages/jevell.jpg differ
diff --git a/public/images/userimages/krishna.jpg b/public/images/userimages/krishna.jpg
new file mode 100644
index 00000000..0cb62d12
Binary files /dev/null and b/public/images/userimages/krishna.jpg differ
diff --git a/public/images/userimages/ray.png b/public/images/userimages/ray.png
new file mode 100644
index 00000000..f7489bf8
Binary files /dev/null and b/public/images/userimages/ray.png differ
diff --git a/public/images/userimages/tommy.jpg b/public/images/userimages/tommy.jpg
new file mode 100644
index 00000000..45fa0546
Binary files /dev/null and b/public/images/userimages/tommy.jpg differ
diff --git a/public/scripts/app.js b/public/scripts/app.js
index 00988cd4..dc94da21 100644
--- a/public/scripts/app.js
+++ b/public/scripts/app.js
@@ -2,6 +2,502 @@ console.log("Sanity Check: JS is working!");
$(document).ready(function(){
-// your code
+ // initial ajax call to bring back all profiles to create the SRP // might need to wrap this up into an on click event later down the road
+ $.ajax({
+ method: 'GET',
+ url: '/api/searchpage',
+ })
+ .then(function(allProfileData){
+ renderSearchResults(allProfileData)
+ })
+ .catch(function(err){
+ console.log('ERROR ON INITIAL LOAD', err)
+ });
+ // clicking on a search results card to render the profile
+ $('#search-results').on('click','.search-card-header', renderProfileFromSrp)
+
+ // click on the back to srp span to go back to the srp
+ $('.back-to-srp-span').on('click', reRenderSrp);
+
+ // edit button parent/child association - on the #user-profile, when you click on the it, the .edit-header is selected (which is the pencil) and the editProfileHeader function is called
+ $('#user-profile').on('click', '.edit-input-header', editProfileHeader);
+ // on save (when the save pencil icon is clicked) the user-profile is saved
+ $('#user-profile').on('click', '.edit-save-header', saveProfileHeader);
+
+ // this to for the modal to have a listenser to be opened
+ $('.add-new-user-button').on('click', function() {
+ console.log('modal clicked')
+ $('#add-user').modal();
+ });
+
+ // this runs the functionality for 'creating a new user' - the button is only shown on the SRP
+ $('.save-new-user').on('click', createNewUser);
+
+ $('#user-profile').on('click', '.delete-profile', removeProfile);
});
+
+let createNewUser = function() {
+
+ // go and get each of the value from the input field. The initial value of each field was populated automatically by using the 'value=' in the input tag of the html
+ let newProfileHeaderName = $('.modal-input-for-profile-name').val();
+ let newProfileHeaderTitle = $('.modal-input-for-profile-title').val();
+ let newProfileHeaderWorkpalce = $('.modal-input-for-profile-workPlace').val();
+ let newProfileHeaderQuote = $('.modal-input-for-profile-quote').val();
+ let newProfileHeaderImg ='/images/userimages/' + $('.modal-input-for-file').val().split('\\').pop();
+ // removes the fakepath $('.modal-input-for-file').val().split('\\').pop()
+ let profileImg = ($('.modal-input-for-file').val().split('\\').pop());
+
+ let newProfileHeaderData = {
+ name: newProfileHeaderName,
+ image: newProfileHeaderImg,
+ title: newProfileHeaderTitle,
+ workPlace: newProfileHeaderWorkpalce,
+ quote: newProfileHeaderQuote,
+ markedForDeletion: false,
+ socialNetwork: ['',''],
+ };
+ console.log('THIS IS NEW PROFILE HEADER DATA', newProfileHeaderData);
+
+ $.ajax({
+ method: 'POST',
+ url: `/api/searchpage`,
+ data: newProfileHeaderData,
+ })
+ .then(function(newlyCreatedProfileData) {
+ console.log('DATA returned from createNewUser', newlyCreatedProfileData);
+ // send back the updated data and pass it through a similar render function again. This time will need to use a different function since this time the data is being passed in from the backend vs the front-end SRP page
+ renderProfileAfterEdit(newlyCreatedProfileData);
+ })
+ .catch(function(err) {
+ console.log('ERROR during the createNewUser returned data', err);
+ });
+
+};
+
+// shows the profile that was clicked from the SRP
+let renderProfileFromSrp = function() {
+
+ $('#add-new-user').toggle();
+
+ // get the currentProfileId of the profile that was clicked from the SRP so we can bring that data back to render
+ let currentProfileId
+ currentProfileId = $(this).closest('.search-card-header').attr('data-profile-id');
+ console.log('Profile ID CLICKED FROM SRP', currentProfileId)
+
+
+ $.ajax({
+ method: 'GET',
+ url: `/api/searchpage/${currentProfileId}`
+ })
+ .then(function(currentProfileData) {
+ console.log('THIS IS THE RENDER PROFILE WORKING', currentProfileData.socialNetwork)
+ // fadeOut the SRP page first, bring the back button and then render all the HTML
+ $('.search').fadeOut(300, function() {
+ $(this).remove();
+ });
+ $('.back-to-srp-span').toggle()
+
+ htmlToAppend(currentProfileData);
+
+ });
+
+
+
+};
+
+// render all the search results cards into one page by passing back the initial ajax call and sending each value into the renderOneSearchResultCard function
+let renderSearchResults = function (searchResults) {
+ console.log('renderSearchResults - making all the cards', searchResults);
+ searchResults.forEach(function(searchResult) {
+ renderOneSearchResultCard(searchResult);
+ });
+}
+
+// render one searchResults card - takes one value and appends it to the correct spot in the HTML
+let renderOneSearchResultCard = function (searchResult) {
+ console.log('renderOneSearchResultCard - bring back all profiles', searchResult);
+ let srpCardHtml = `
+
+
+
+
+
+
+
+
${searchResult.name}
+
+
+ ${searchResult.title}
+ at
+ ${searchResult.workPlace}
+
+
+ ${searchResult.quote}
+
+
+
+
+ `
+ // append it with a fadeIn
+ $('#search-results').append(srpCardHtml).hide().fadeIn(100);
+};
+
+// re-render the Search Results page when going from the profile page back to the SRP
+let reRenderSrp = function(){
+ $.ajax({
+ method: 'GET',
+ url: '/api/searchpage',
+ })
+ .then(function(allProfileData){
+ renderSearchResults(allProfileData)
+ $('.profile').remove();
+ });
+ $('.back-to-srp-span').toggle()
+
+ // once the user gets back to the SRP then the add-new-user button show will show up
+ $('#add-new-user').toggle();
+};
+
+// ability to click on the pencil and open up the fields for edit in the header - this ONLY opens them up and shows the hidden fields. does not save yet
+let editProfileHeader = function (e) {
+ console.log('EDIT HEADER-ICON was clicked!');
+ let currentProfileId = $(this).closest('#profile-information').attr('data-profile-id');
+ console.log('EDIT ICON CLICKED AND THIS IS THE PROFILE', currentProfileId)
+
+ // opens up the 4 text fields
+ $('.input-for-profile-header').toggle();
+ // removes the 'at' inbetween Title and workPlace
+ $('.at-span').toggle();
+ // removes the name in the h1
+ $('.h1-name').toggle();
+ // removes all the info from spans that is from the DB
+ $('.profile-header-db-info').toggle();
+ // shows the table under each of the input / text box area
+ $('.label-profile-header').toggle();
+ // hides the edit-header pencil that is currently showing and gets rid of that while showing the new one
+ $('.edit-input-header').toggle();
+ $('.edit-save-header').toggle();
+ // hides the upload file icon
+ $('.modal-input-for-file').toggle();
+
+
+};
+
+// ability save all the edits made to the profile header section and rerender that profile on the SRP
+let saveProfileHeader = function(e) {
+ console.log('SAVE HEADER ICON WAS CLICKED')
+ let currentProfileId = $(this).closest('#profile-information').attr('data-profile-id');
+ console.log('SAVE ICON CLICKED AND THIS IS THE PROFILE ID', currentProfileId)
+
+
+ // get the profileHeader label and once after you get that
+ let editedProfileHeader = $(this).closest('#profile-information');
+
+ // go and get each of the value from the input field. The initial value of each field was populated automatically by using the 'value=' in the input tag of the html
+ let editedProfileHeaderName = editedProfileHeader.find('.input-for-profile-name').val();
+ let editedProfileHeaderTitle = editedProfileHeader.find('.input-for-profile-title').val();
+ let editedProfileHeaderWorkpalce = editedProfileHeader.find('.input-for-profile-workPlace').val();
+ let editedProfileHeaderQuote = editedProfileHeader.find('.textarea-for-profile-quote').val();
+ let editProfileHeaderImg ='/images/userimages/' + $('.input-for-file').val().split('\\').pop();
+ console.log('THIS IS EDIT PROFILE IMAGE',editProfileHeaderImg )
+
+ // create the data object to send back
+ let editedProfileHeaderData = {
+ name: editedProfileHeaderName,
+ title: editedProfileHeaderTitle,
+ image: editProfileHeaderImg,
+ workPlace: editedProfileHeaderWorkpalce,
+ quote: editedProfileHeaderQuote,
+ };
+ console.log('THIS IS THE DATA TO BE SENT BACK AFTER EDIT', editedProfileHeaderData);
+
+ $.ajax({
+ method: 'PUT',
+ url: `/api/searchpage/${currentProfileId}`,
+ data: editedProfileHeaderData,
+ })
+ .then(function(updatedEditedData) {
+ console.log('DATA returned from editedProfileHeaderData', updatedEditedData);
+ // send back the updated data do can pass it through a similar render function again. This time will have another function b/c one is coming from the SRP and the other is coming from the profile page
+ renderProfileAfterEdit(updatedEditedData);
+ })
+ .catch(function(err) {
+ console.log('ERROR during the editedProfileHeaderData returned data', err);
+ });
+ // closes the save icon
+ $('.edit-save-header').toggle();
+
+ // hides the upload file icon
+ $('.modal-input-for-file').toggle();
+
+ // closes the four header icons
+ $('.input-for-profile-header').toggle();
+
+ // put the 'AT' back inbetween Title and workPlace
+ $('.at-span').toggle();
+
+ // put the name back into the h1
+ $('.h1-name').toggle();
+
+ // puts all the info from spans that is from the DB
+ $('.profile-header-db-info').toggle();
+
+ // gets rid of all the labels
+ $('.label-profile-header').toggle();
+
+ // opens the edit icon
+ $('.edit-input-header').toggle();
+
+ // bring back the 'back' span
+ $('.back-to-srp-span').toggle();
+
+
+
+
+
+}
+
+// ability to rerender the profile AFTER edit - this is different because we are passing back the data from edit vs going from the SRP
+let renderProfileAfterEdit = function(updatedEditedData) {
+ let currentProfileId = updatedEditedData._id
+ console.log(updatedEditedData._id)
+ $('.profile').remove()
+ $.ajax({
+ method: 'GET',
+ url: `/api/searchpage/${currentProfileId}`
+ })
+ .then(function(currentProfileData) {
+ console.log('THIS IS THE RENDER PROFILE WORKING', currentProfileData.socialNetwork)
+ // remove the search stuff first with a fadeOut
+ $('.search').fadeOut(300, function() {
+ $(this).remove();
+ });
+
+ // show the back to SRP page
+ $('.back-to-srp-span').toggle();
+ $('.add-new-user-button').toggle();
+ htmlToAppend(currentProfileData);
+ });
+};
+
+
+
+// allows the user to remove their profile
+let removeProfile = function() {
+ // get the current user ID
+ let currentProfileId = $(this).closest('#profile-information').attr('data-profile-id');
+ console.log('DELETE BUTTONS CLICKED AND THIS IS THE PROFILE ID', currentProfileId);
+
+ // send back data that shows they are marked for deletion
+ let removeProfileHeaderData = {
+ markedForDeletion: true,
+ };
+
+ if (confirm('We are sad to see you go... are you sure?')) {
+ $.ajax({
+ method: 'DELETE',
+ url: `/api/searchpage/${currentProfileId}`,
+ data: removeProfileHeaderData,
+ })
+ .then(function(removeProfile){
+ console.log('THIS WAS THE PROFILE REMOVED', removeProfile);
+ alert (`Thank you for using Hub and Co! Hope to see you back!`);
+
+ // redirect them back to the main homepage
+ document.location.href="/";
+ })
+ }
+ else alert('Hope you make more friends!');
+};
+
+// contains profile information to append
+let htmlToAppend = function(currentProfileData) {
+ console.log('HTML TO APPEND EXECUTED')
+ let headerAndAboutMeHtml = `
+
+
+
+
+
+ `
+
+ // appending the social HTML - this is done via a if statement to figure out which socialNetworks the user currently has
+ let socialHtml
+ // console.log(currentProfileData.socialNetwork[0] !== '');
+ if (currentProfileData.socialNetwork[0] !== '' && currentProfileData.socialNetwork[1] !== '') {
+ // let socialWithBothHtml
+ socialHtml = `
+
+
+
+
+
+
+
+
+
+
Social Network
+
+
+
+
+
+
+
+
+
+
+
+ `
+ // if they only have linkedIn
+ } else if ( currentProfileData.socialNetwork[0] !== '' && currentProfileData.socialNetwork[1] === '') {
+
+ // let socialWithJustLinkedInHtml
+ socialHtml = `
+
+
+
+
+
+
+
+
+
+
Social Network
+
+
+
+
+
+
+
+
+
+
+ `
+ // if they only have gitHub
+ } else if ( currentProfileData.socialNetwork[0] === '' && currentProfileData.socialNetwork[1] !== '' ) {
+ socialHtml = `
+
+
+
+
+
+
+
+
+
+
Social Network
+
+
+
+
+
+
+
+
+
+
+ `
+ // if they have none
+ } else {
+ socialHtml = `
+
+
+ `
+
+ // appending each of the html pieces
+ $('#user-profile').append(headerAndAboutMeHtml);
+ $('#social-network').append(socialHtml);
+ $('#delete-user-profile').append(deleteHtml);
+ };
diff --git a/public/styles/styles.css b/public/styles/styles.css
index 57b4da0e..76475da0 100644
--- a/public/styles/styles.css
+++ b/public/styles/styles.css
@@ -1,10 +1,111 @@
+body, footer {
+ font-family: 'Jura', sans-serif;
+ /*font-family: 'Raleway', sans-serif;*/
+}
body {
color: #333;
- font-family: Helvetica, Arial, sans-serif;
- background-color: skyblue; /* Sanity Check! */
+ background-color: rgb(236, 232, 237); /* Sanity Check! */
+ margin: 0 0 100px; /* bottom = footer height => adding marging to just the bottom of the body so it goes up past the footer */
+ /*https://stackoverflow.com/questions/3443606/make-footer-stick-to-bottom-of-page-correctly*/
+}
+footer{
+ bottom: 0;
+ position: fixed;
+ width: 100%;
+ overflow:hidden;
+ z-index: 9999;
+}
+/*navBar*/
+.nav-wrapper{
+ background-color: rgb(213, 154, 226);
+}
+.search{
+ zoom: 110%;
+}
+
+.back-to-srp-span{
+ display: none;
+ font-weight: bold;
+ font-size: 150%;
+ margin: 0;
+}
+/****************SEARCH CARD INFO****************/
+.search-card-span {
+ font-size: 120%;
+ /*background-color: yellow;*/
+}
+.search-card-h1 {
+ font-size: 275%;
}
+/****************PROFILE HEADER ****************/
h1 {
- margin-top: 100px;
- text-align: center;
+ text-align: left;
+ font-size: 300%;
+ margin-bottom: 3%;
+ margin-top: 0;
+ /*padding-bottom: -20%;*/
+}
+
+.profile-header, .search-card-header, .social-info, .about-me{
+ background-color: #FEFEFE;
+}
+.profile-info{
+ /*background-color: lightblue;*/
+}
+.profile-img {
+ /*text-align: center;*/
+ /*background-color: pink;*/
+ max-width: 165px;
+ max-height: 165px;
+ margin: 2%;
+}
+
+.user-info {
+ text-align: left;
+ /*background-color: green;*/
+}
+.profile-header-db-info{
+ font-size: 150%;
+}
+
+/**************** PROFILE ON EDIT ****************/
+.input-for-profile-header, label{
+ display: none;
+}
+
+.at-span {
+ display: visible;
+ font-size: 150%;
+}
+.edit-save-header, .edit-save-about-me, .edit-save-social-network, .input-for-file {
+ display: none;
+}
+
+/***************** ABOUT ME *****************/
+h2 {
+ font-size: 150%;
+ padding: -10%;
+ margin-bottom: 0%;
+ margin-top: 0%;
+}
+
+.social-img {
+ margin-top: 2%;
+ margin-right: 5%;
+ max-width: 40px;
+ max-height: 40px;
+}
+
+.footer-copyright {
+ background-color: rgb(213, 154, 226);
+}
+
+.footer {
+ margin-bottom: 0;
+}
+.edit-icon{
+ max-width: 20px;
+ max-height: 20px;
+ text-align: right;
}
diff --git a/seed.js b/seed.js
index 896dead0..7b0c55df 100644
--- a/seed.js
+++ b/seed.js
@@ -1,15 +1,142 @@
// This file allows us to seed our application with data
// simply run: `node seed.js` from the root of this project folder.
-// var db = require('./models');
+const db = require('./models');
-// var new_campsite = {description: "Sharp rocks. Middle of nowhere."}
+const profileList = [];
+profileList.push({
+ name: 'Ray Choi',
+ userName: 'rc',
+ image: '/images/userimages/ray.png',
+ title: 'Student',
+ workPlace: 'General Assembly',
+ quote: `Don't worry about what you can't control.`,
+ aboutMe: `I am a former Technology Consultant who built internal products leveraging ERP systems, and for a brief period, was also an acting co-owner of a small business. I graduated with an MBA from the Kellogg School of Management and was most recently the Lead Global Product Manager of the Find-A-ProAdvisor Marketplace at Intuit.`,
+ socialNetwork: ['https://www.linkedin.com/in/raybchoi/', 'https://github.com/raybchoi'],
+ skills: ['JavaScript', 'CSS', 'HTML', 'Mongo', 'Mongoose'],
+ markedForDeletion: false,
+})
+profileList.push({
+ name: 'Eric Choi',
+ userName: 'ec',
+ image: '/images/userimages/ericchoi.jpg',
+ title: 'Application Developer',
+ workPlace: 'JPMorgan Chase & Co.',
+ quote: `Live life to the fullest. Enjoy every moment.`,
+ aboutMe: `I'm currently with JPMorgan Chase as an Application Developer for the Commercial Term Lending Division and I was previously on the Digital Media Technology Team as a UI Developer helping to create the new Chase Online website.
-// db.Campsite.create(new_campsite, function(err, campsite){
-// if (err){
-// return console.log("Error:", err);
-// }
+ Prior to JPMorgan Chase, I was a Web Development Teaching Assistant for Coding Dojo. Having gone through the curriculum myself, I was able to relate to the challenges the students faced and being able to help students gain knowledge and confidence in this field has been a very rewarding experience. Progressing my skills as a developer and sharing my knowledge with others is something I look forward to every day.`,
+ socialNetwork: ['https://www.linkedin.com/in/ericchoi35/',''],
+ skills: ['JavaScript', 'CSS', 'HTML', 'Mongo', 'Mongoose', 'Mocha', 'Java'],
+ markedForDeletion: false,
+})
+profileList.push({
+ name: 'Krishna Kolli',
+ userName: 'kirshna',
+ image: '/images/userimages/krishna.jpg',
+ title: 'Software Engineer 2',
+ workPlace: 'Intuit',
+ quote: `I'm here to solve the big problems`,
+ aboutMe: `Full-Stack Engineer. Frontend in React, Redux, Relay. Backend in Java with Spring.`,
+ socialNetwork: ['https://www.linkedin.com/in/kollikrishna/',''],
+ skills: ['JavaScript', 'Redux', 'Rails', 'Node', 'HTML'],
+ markedForDeletion: false,
+})
+profileList.push({
+ name: 'Huan Ming Liao',
+ userName: 'hml',
+ image: '/images/userimages/huan.jpg',
+ title: 'Wed Development Immersive',
+ workPlace: 'General Assembly',
+ quote: `My fingers do all the talking`,
+ aboutMe: `I'm an graduate from UCSC where I studied Technology Management. I have a passion for Web development and excited for the future`,
+ socialNetwork: ['https://www.linkedin.com/in/huan-ming-liao-1a690897/',''],
+ skills: ['JavaScript', 'CSS', 'GitHub', 'React', 'Node'],
+ markedForDeletion: false,
+})
+profileList.push({
+ name: 'Jevell Rollins',
+ userName: 'jevell',
+ image: '/images/userimages/jevell.jpg',
+ title: 'Full Stack Developer Student',
+ workPlace: 'General Assembly',
+ quote: `Always striving.`,
+ aboutMe: `I am result-driven, efficient, adaptable and enthusiastic person who likes to work on challenging projects. Good problem solving ability, and like to take initiative for a given task. I have passion for programming and like to solve challenges. I have strong personal and inter-communication skills.`,
+ socialNetwork: ['https://www.linkedin.com/in/jevell/', 'https://github.com/jkwr'],
+ skills: ['CSS', 'Materialize', 'HTML', 'Mongo', 'Mongoose'],
+ markedForDeletion: false,
+})
+profileList.push({
+ name: 'Connor Martinelli',
+ userName: 'conmart',
+ image: '/images/userimages/connor.jpg',
+ title: 'Web Development Student',
+ workPlace: 'General Assembly',
+ quote: `When something is important enough, you do it even if the odds are not in your favor. - Elon Musk`,
+ aboutMe: `Bay area native, UC Berkeley and Cal Band alumnus, I am now working with an amazingly passionate and driven team at NerdWallet.com to bring much-needed transparency into the world of personal finance, and help consumers find the best financial products for their unique needs.`,
+ socialNetwork: ['https://www.linkedin.com/in/connormartinelli/', 'https://github.com/conmart'],
+ skills: ['CSS', 'Materialize', 'Postman', 'Bootstrap', 'Mongoose'],
+ markedForDeletion: false,
+})
+profileList.push({
+ name: 'Carlynn Espinoza',
+ userName: 'ce',
+ image: '/images/userimages/carlynn.jpg',
+ title: 'WDI Design Student',
+ workPlace: 'General Assembly',
+ quote: `The sun makes everything better`,
+ aboutMe: `Former Civil Engineer who found her true path with coding. As an engineer I always looked for ways to design new and exciting projects. Ultimately, I needed more ways to express my creative nature. The combination of creative and logical problem solving in the technology world was the outlet I had been seeking.`,
+ socialNetwork: ['https://www.linkedin.com/in/carlynn-espinoza/',''],
+ skills: ['JavaScript', 'CSS', 'jQuery', 'In-Design', 'Node'],
+ markedForDeletion: false,
+})
+profileList.push({
+ name: 'Tommy Thai',
+ userName: 'tthai',
+ image: '/images/userimages/tommy.jpg',
+ title: 'Software Developer',
+ workPlace: 'Freelancer',
+ quote: `Coding is life`,
+ aboutMe: `Self-motivated web developer with a strong understanding of web development, great communication skills, and the ability to thrive in a fast-paced environment, looking to work with a fun and creative team to transform good ideas into great products.`,
+ socialNetwork: ['', ''],
+ skills: ['Ruby', 'SQL', 'Angular', 'Bootstrap', 'Mongoose'],
+ markedForDeletion: false,
+})
+profileList.push({
+ name: 'Anil Suryanarayana',
+ userName: 'anilsurya',
+ image: '/images/userimages/anil.jpg',
+ title: 'Engineering lead',
+ workPlace: 'Intuit',
+ quote: `Testing is a way of life.`,
+ aboutMe: `10+ years of experience with product development, program management and data analytics while working at Intuit, Yahoo and Wipro Technologies.`,
+ socialNetwork: ['https://www.linkedin.com/in/anilsurya/', 'https://github.com/tommythai'],
+ skills: ['TDD', 'SQL', 'React', 'Node', 'Mongoose'],
+ markedForDeletion: false,
+})
+profileList.push({
+ name: 'Ganesh Velu Rajendran',
+ userName: 'ganz7',
+ image: '/images/userimages/ganesh.jpg',
+ title: 'Software Engineer 2',
+ workPlace: 'Intuit',
+ quote: `[ software === art ]`,
+ aboutMe: `I love thinking through customer problems and making magic with my hands.`,
+ socialNetwork: ['https://www.linkedin.com/in/ganeshkumarvr/',''],
+ skills: ['JavaScript', 'Ruby', 'Rails', 'Node', 'React'],
+ markedForDeletion: false,
+})
-// console.log("Created new campsite", campsite._id)
-// process.exit(); // we're all done! Exit the program.
-// })
+
+db.Profile.remove({}, function(err, allExistingProfiles){
+
+ db.Profile.create(profileList, function(err, profiles) {
+ if (err) {
+ return console.log('ERROR during seeding', err);
+ }
+ console.log("all profiles created:", profiles);
+ console.log("created", profiles.length, "profiles");
+ process.exit();
+ });
+
+});
diff --git a/server.js b/server.js
index fd366289..8a035e00 100644
--- a/server.js
+++ b/server.js
@@ -1,6 +1,7 @@
-// require express and other modules
-var express = require('express'),
- app = express();
+//require express in our app
+var express = require('express');
+// generate a new express app and call it 'app'
+var app = express();
// parse incoming urlencoded form data
// and populate the req.body object
@@ -15,11 +16,14 @@ app.use(function(req, res, next) {
next();
});
+// manages the controller routes
+var controllers = require('./controllers');
+
/************
* DATABASE *
************/
-// var db = require('./models');
+const db = require('./models');
/**********
* ROUTES *
@@ -41,23 +45,23 @@ app.get('/', function homepage(req, res) {
/*
* JSON API Endpoints
*/
+// render just the API information
+app.get('/api', controllers.api.index);
-app.get('/api', function apiIndex(req, res) {
- // TODO: Document all your api endpoints below as a simple hardcoded JSON object.
- // It would be seriously overkill to save any of this to your database.
- // But you should change almost every line of this response.
- res.json({
- woopsIForgotToDocumentAllMyEndpoints: true, // CHANGE ME ;)
- message: "Welcome to my personal api! Here's what you need to know!",
- documentationUrl: "https://github.com/example-username/express-personal-api/README.md", // CHANGE ME
- baseUrl: "http://YOUR-APP-NAME.herokuapp.com", // CHANGE ME
- endpoints: [
- {method: "GET", path: "/api", description: "Describes all available endpoints"},
- {method: "GET", path: "/api/profile", description: "Data about me"}, // CHANGE ME
- {method: "POST", path: "/api/campsites", description: "E.g. Create a new campsite"} // CHANGE ME
- ]
- })
-});
+// renders the SEARCHRESULTPAGES
+app.get('/api/searchpage', controllers.profile.searchResultsPage);
+
+// renders one user profile
+app.get('/api/searchpage/:profileId', controllers.profile.showOneProfile);
+//
+// // creates and saves one user profile fron the SRP page
+app.post('/api/searchpage', controllers.profile.createNewProfile);
+//
+// //update and save the profile
+app.put('/api/searchpage/:profileId', controllers.profile.updateOneProfile);
+//
+// // able to delete the profile
+app.delete('/api/searchpage/:profileId', controllers.profile.removeOneProfile);
/**********
* SERVER *
diff --git a/views/index.html b/views/index.html
index 48e39ae6..8865d56d 100644
--- a/views/index.html
+++ b/views/index.html
@@ -4,26 +4,212 @@
- Blank
-
-
-
+ Hub and Co
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-