Ability to change data for courses
This commit is contained in:
@@ -15,7 +15,12 @@ userDB = (DB) => {
|
|||||||
DB.updateProfile = async (profileid, profileObj) => {
|
DB.updateProfile = async (profileid, profileObj) => {
|
||||||
let tempProfile = profileObj.toObj();
|
let tempProfile = profileObj.toObj();
|
||||||
const query = {_id: profileid};
|
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) => {
|
let r = await DB.profileCols.updateOne(query, update).catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -220,9 +220,11 @@ DB.getDB.then((DB)=>{
|
|||||||
router.post("/myProfile", async (req, res) => {
|
router.post("/myProfile", async (req, res) => {
|
||||||
let profile = {
|
let profile = {
|
||||||
userid: getUserId(req),
|
userid: getUserId(req),
|
||||||
profile: req.body
|
profile: req.body.profile,
|
||||||
|
data: req.body.data
|
||||||
};
|
};
|
||||||
let profileObj = new Profile(profile); //validates profile
|
let profileObj = new Profile(profile); //validates profile
|
||||||
|
console.log(profileObj)
|
||||||
DB.updateProfile(getProfileId(req), profileObj);
|
DB.updateProfile(getProfileId(req), profileObj);
|
||||||
return res.json({
|
return res.json({
|
||||||
status: "ok"
|
status: "ok"
|
||||||
|
|||||||
Reference in New Issue
Block a user