Showing
2 changed files
with
8 additions
and
3 deletions
... | @@ -8,8 +8,9 @@ const BottleSchema = new Schema ({ | ... | @@ -8,8 +8,9 @@ const BottleSchema = new Schema ({ |
8 | humidity : { type : Number, default : 0 }, | 8 | humidity : { type : Number, default : 0 }, |
9 | balance : { type : Number, default : 0 }, | 9 | balance : { type : Number, default : 0 }, |
10 | recentOpen : { type : Date, default : Date.now }, | 10 | recentOpen : { type : Date, default : Date.now }, |
11 | - medicineId : Number, | 11 | + medicineId : { type : Number, default : null, }, |
12 | - hubId : Number | 12 | + hubId : Number, |
13 | + dosage : { type : Number, default : 0 } | ||
13 | }) | 14 | }) |
14 | 15 | ||
15 | BottleSchema.statics.findByBottleId = function(bottleId) { | 16 | BottleSchema.statics.findByBottleId = function(bottleId) { |
... | @@ -36,6 +37,10 @@ BottleSchema.methods.getBalance = function() { | ... | @@ -36,6 +37,10 @@ BottleSchema.methods.getBalance = function() { |
36 | return this.balance; | 37 | return this.balance; |
37 | }; | 38 | }; |
38 | 39 | ||
40 | +BottleSchema.methods.getDosage = function() { | ||
41 | + return this.dosage; | ||
42 | +}; | ||
43 | + | ||
39 | BottleSchema.methods.getMedicineId = function() { | 44 | BottleSchema.methods.getMedicineId = function() { |
40 | return this.medicineId; | 45 | return this.medicineId; |
41 | }; | 46 | }; | ... | ... |
... | @@ -5,7 +5,7 @@ const jwt = require('jsonwebtoken'); | ... | @@ -5,7 +5,7 @@ const jwt = require('jsonwebtoken'); |
5 | const Schema = mongoose.Schema; | 5 | const Schema = mongoose.Schema; |
6 | 6 | ||
7 | const UserSchema = new Schema({ | 7 | const UserSchema = new Schema({ |
8 | - userId : { type: String, require : true, unique : true }, | 8 | + userId : { type: String, require : true, unique : true, lowercase : true }, |
9 | hashedPassword : { type : String, default : null } | 9 | hashedPassword : { type : String, default : null } |
10 | }); | 10 | }); |
11 | 11 | ... | ... |
-
Please register or login to post a comment