add org field in db

This commit is contained in:
Priyatham Sai chand 2022-05-08 22:21:32 +05:30
parent c3d665d62e
commit 3729bff2e1
No known key found for this signature in database
GPG Key ID: C3DFD0A2F6675222
3 changed files with 2421 additions and 15 deletions

2418
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ const { OAuth2Client } = require('google-auth-library');
router.post("/register", async (req, res) => {
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,
phonenumber,
password: passwordHash,
organization
});
const savedUser = await newUser.save();
res.json(savedUser);
@ -112,7 +113,8 @@ router.get("/", auth, async (req, res) => {
id: user._id,
pricing: user.pricing,
email: user.email,
phonenumber: user.phonenumber
phonenumber: user.phonenumber,
organization: user.organization
});
});
router.put("/update", async (req, res) => {

View File

@ -26,7 +26,13 @@ const UserSchema = mongoose.Schema({
enum: ['free','basic','intermediate','luxury'],
default:'free',
required:false
}
},
organization: {
type:String,
enum: ['mod','tenant','owner'],
default:'mod',
required:false
},
});