diff --git a/dbTools/profile.js b/dbTools/profile.js index 628ed60..4e25975 100644 --- a/dbTools/profile.js +++ b/dbTools/profile.js @@ -15,7 +15,12 @@ userDB = (DB) => { DB.updateProfile = async (profileid, profileObj) => { let tempProfile = profileObj.toObj(); const query = {_id: profileid}; - const update = {$set: {profile: tempProfile.profile}}; + const update = { + $set: { + profile: tempProfile.profile, + data: tempProfile.data + } + }; let r = await DB.profileCols.updateOne(query, update).catch((err) => { console.log(err); return false; diff --git a/routes/profile.js b/routes/profile.js index 7fb525f..cc7dd7c 100644 --- a/routes/profile.js +++ b/routes/profile.js @@ -220,9 +220,11 @@ DB.getDB.then((DB)=>{ router.post("/myProfile", async (req, res) => { let profile = { userid: getUserId(req), - profile: req.body + profile: req.body.profile, + data: req.body.data }; let profileObj = new Profile(profile); //validates profile + console.log(profileObj) DB.updateProfile(getProfileId(req), profileObj); return res.json({ status: "ok"