add org field in db
This commit is contained in:
parent
c3d665d62e
commit
3729bff2e1
File diff suppressed because it is too large
Load Diff
|
@ -7,7 +7,7 @@ const { OAuth2Client } = require('google-auth-library');
|
||||||
|
|
||||||
router.post("/register", async (req, res) => {
|
router.post("/register", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
let { username,email,phonenumber,password} = req.body;
|
let { username,email,phonenumber,password,organization} = req.body;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ router.post("/register", async (req, res) => {
|
||||||
email,
|
email,
|
||||||
phonenumber,
|
phonenumber,
|
||||||
password: passwordHash,
|
password: passwordHash,
|
||||||
|
organization
|
||||||
});
|
});
|
||||||
const savedUser = await newUser.save();
|
const savedUser = await newUser.save();
|
||||||
res.json(savedUser);
|
res.json(savedUser);
|
||||||
|
@ -112,7 +113,8 @@ router.get("/", auth, async (req, res) => {
|
||||||
id: user._id,
|
id: user._id,
|
||||||
pricing: user.pricing,
|
pricing: user.pricing,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
phonenumber: user.phonenumber
|
phonenumber: user.phonenumber,
|
||||||
|
organization: user.organization
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
router.put("/update", async (req, res) => {
|
router.put("/update", async (req, res) => {
|
||||||
|
@ -183,4 +185,4 @@ router.post("/googlelogin", async (req, res) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
|
@ -26,8 +26,14 @@ const UserSchema = mongoose.Schema({
|
||||||
enum: ['free','basic','intermediate','luxury'],
|
enum: ['free','basic','intermediate','luxury'],
|
||||||
default:'free',
|
default:'free',
|
||||||
required:false
|
required:false
|
||||||
}
|
},
|
||||||
|
organization: {
|
||||||
|
type:String,
|
||||||
|
enum: ['mod','tenant','owner'],
|
||||||
|
default:'mod',
|
||||||
|
required:false
|
||||||
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = User = mongoose.model('user',UserSchema);
|
module.exports = User = mongoose.model('user',UserSchema);
|
||||||
|
|
Loading…
Reference in New Issue