diff --git a/bookswap/bookswap_client/src/components/Home/Profile.js b/bookswap/bookswap_client/src/components/Home/Profile.js index 98611cc..a658c99 100644 --- a/bookswap/bookswap_client/src/components/Home/Profile.js +++ b/bookswap/bookswap_client/src/components/Home/Profile.js @@ -78,7 +78,8 @@ class Profile extends Component { userAboutMe:this.state.userAboutMe||this.state.user_profile.aboutMe, userContactNumber:this.state.userContactNumber||this.state.user_profile.contactNumber, userCity:this.state.userCity||this.state.user_profile.city, - userState:this.state.userState||this.state.user_profile.state, + userStateName:this.state.userState||this.state.user_profile.stateName, + userZipcode:this.state.userZipcode||this.state.user_profile.zipcode, userCountry:this.state.userCountry||this.state.user_profile.country } @@ -149,9 +150,15 @@ class Profile extends Component { userCity: e.target.value }); }; - stateChange = (e) => { + + zipcodeChange = (e) => { + this.setState({ + userZipcode: e.target.value + }); +}; + stateNameChange = (e) => { this.setState({ - userState: e.target.value + userStateName: e.target.value }); }; countryChange = (e) => { @@ -248,7 +255,8 @@ await this.getSwapBook();
{this.state.user_profile.aboutme}
{this.state.user_profile.contactNumber}
{this.state.user_profile.city}
-
{this.state.user_profile.state}
+
{this.state.user_profile.stateName}
+
{this.state.user_profile.zipcode}
{this.state.user_profile.country}
@@ -329,8 +337,16 @@ await this.getSwapBook();
State
- + + + +
+
+ ZipCode +
+
+
Country diff --git a/bookswap/bookswap_client/src/components/Login/Signup.js b/bookswap/bookswap_client/src/components/Login/Signup.js index 12ceee3..e3df6ac 100644 --- a/bookswap/bookswap_client/src/components/Login/Signup.js +++ b/bookswap/bookswap_client/src/components/Login/Signup.js @@ -16,6 +16,10 @@ class Signup extends Component{ userEmail : "", password : "", name :"", + address:"", + city:"", + stateName:"", + zipcode:"", errorMessage : "", successFlag :false } @@ -40,7 +44,34 @@ class Signup extends Component{ name : e.target.value }) } - + + //name change handler to update state variable with the text entered by the user + addressChangeHandler = (e) => { + this.setState({ + address : e.target.value + }) + } + + //name change handler to update state variable with the text entered by the user + zipcodeChangeHandler = (e) => { + this.setState({ + zipcode : e.target.value + }) + } + + //name change handler to update state variable with the text entered by the user + stateNameChangeHandler = (e) => { + this.setState({ + stateName : e.target.value + }) + } + + //name change handler to update state variable with the text entered by the user + cityChangeHandler = (e) => { + this.setState({ + city : e.target.value + }) + } //submit Login handler to send a request to the node backend @@ -52,6 +83,10 @@ class Signup extends Component{ userEmail : this.state.userEmail, password : this.state.password, name : this.state.name, + address: this.state.address, + city: this.state.city, + stateName: this.state.stateName, + zipcode: this.state.zipcode } console.log(data); //set the with credentials to true @@ -112,6 +147,22 @@ class Signup extends Component{
+
+ + +
+
+ + +
+
+ + +
+
+ + +
diff --git a/bookswap/bookswap_ml/jupyter_notebook/Process_data.ipynb b/bookswap/bookswap_ml/jupyter_notebook/Process_data.ipynb index f85ca21..a162dcb 100644 --- a/bookswap/bookswap_ml/jupyter_notebook/Process_data.ipynb +++ b/bookswap/bookswap_ml/jupyter_notebook/Process_data.ipynb @@ -215,7 +215,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.3" + "version": "3.7.6" } }, "nbformat": 4, diff --git a/bookswap/bookswap_ml/jupyter_notebook/data_clean.ipynb b/bookswap/bookswap_ml/jupyter_notebook/data_clean.ipynb index f85ca21..a162dcb 100644 --- a/bookswap/bookswap_ml/jupyter_notebook/data_clean.ipynb +++ b/bookswap/bookswap_ml/jupyter_notebook/data_clean.ipynb @@ -215,7 +215,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.3" + "version": "3.7.6" } }, "nbformat": 4, diff --git a/bookswap/bookswap_server/models/users.js b/bookswap/bookswap_server/models/users.js index 76673de..a41399c 100644 --- a/bookswap/bookswap_server/models/users.js +++ b/bookswap/bookswap_server/models/users.js @@ -5,11 +5,14 @@ var usersSchema = new Schema({ name: {type: String, required: true}, password: {type: String, required: true}, emailId:{type:String,required:true}, + address:{type:String,required:true}, + city:{type:String,required:true}, + stateName:{type:String,required:true}, + zipcode:{type:String,required:true}, + country:{type:String,required:false}, aboutme:{type:String,required:false}, contactNumber:{type:String,required:false}, - city:{type:String,required:false}, - state:{type:String,required:false}, - country:{type:String,required:false}, + image:{type:String,required:false}, }, diff --git a/bookswap/bookswap_server/routes/profile.js b/bookswap/bookswap_server/routes/profile.js index 7ab0325..e530f2e 100644 --- a/bookswap/bookswap_server/routes/profile.js +++ b/bookswap/bookswap_server/routes/profile.js @@ -26,7 +26,8 @@ Users.findOne({ _id: req.body.userId}, (err, user) => { aboutme:user.aboutme, contactNumber:user.contactNumber, city:user.city, - state:user.state, + stateName:user.stateName, + zipcode:user.zipcode, country:user.country, image:user.image, @@ -56,7 +57,8 @@ Users.findOne({ _id: req.body.userId}, (err, user) => { aboutme:req.body.userAboutMe, contactNumber:req.body.userContactNumber, city:req.body.userCity, - state:req.body.userState, + stateName:req.body.userStateName, + zipcode:req.body.userZipcode, country:req.body.userCountry }, { diff --git a/bookswap/bookswap_server/routes/signup.js b/bookswap/bookswap_server/routes/signup.js index c928767..7c3b274 100644 --- a/bookswap/bookswap_server/routes/signup.js +++ b/bookswap/bookswap_server/routes/signup.js @@ -11,8 +11,13 @@ var newUser = new Users({ emailId: req.body.userEmail, password: req.body.password, name: req.body.name, + address: req.body.address, + city: req.body.city, + stateName:req.body.stateName, + zipcode: req.body.zipcode }); + console.log(newUser) Users.findOne({ emailId: req.body.userEmail}, (err, user) => { if (err) { res.status(500).end("System Error"); diff --git a/bookswap/package-lock.json b/bookswap/package-lock.json new file mode 100644 index 0000000..48e341a --- /dev/null +++ b/bookswap/package-lock.json @@ -0,0 +1,3 @@ +{ + "lockfileVersion": 1 +}