JJuOn

Change column of model/challenge and model/session

...@@ -8,7 +8,7 @@ const ChallengeSchema=new Schema({ ...@@ -8,7 +8,7 @@ const ChallengeSchema=new Schema({
8 endDate: {type: Object, required: true}, 8 endDate: {type: Object, required: true},
9 durationPerSession: {type: String, required: true}, // '1d' means one day per session, '2w' means 2 weeks per session, '3m' means 3 months per session. 9 durationPerSession: {type: String, required: true}, // '1d' means one day per session, '2w' means 2 weeks per session, '3m' means 3 months per session.
10 goalPerSession: {type: Number, required:true}, // number of problems for one session 10 goalPerSession: {type: Number, required:true}, // number of problems for one session
11 - isOpen: { type: Boolean } 11 + status: { type: String }
12 },{ 12 },{
13 collection: 'challenge' 13 collection: 'challenge'
14 }); 14 });
...@@ -37,6 +37,10 @@ ChallengeSchema.methods.getGoalPerSession=function(){ ...@@ -37,6 +37,10 @@ ChallengeSchema.methods.getGoalPerSession=function(){
37 return this.goalPerSession; 37 return this.goalPerSession;
38 } 38 }
39 39
40 +ChallengeSchema.methods.getStatus=function(){
41 + return this.status;
42 +}
43 +
40 ChallengeSchema.methods.serialize=function(){ 44 ChallengeSchema.methods.serialize=function(){
41 return this.toJSON(); 45 return this.toJSON();
42 } 46 }
......
...@@ -6,7 +6,7 @@ const SessionSchema = new Schema({ ...@@ -6,7 +6,7 @@ const SessionSchema = new Schema({
6 challengeId: { type: Schema.Types.ObjectId, ref: 'Challenge' }, 6 challengeId: { type: Schema.Types.ObjectId, ref: 'Challenge' },
7 sessionStartDate: { type: Object }, 7 sessionStartDate: { type: Object },
8 sessionEndDate: { type: Object }, 8 sessionEndDate: { type: Object },
9 - isOpen: { type: Boolean } 9 + status: { type: String }
10 },{ 10 },{
11 collection: 'session' 11 collection: 'session'
12 }); 12 });
...@@ -23,8 +23,8 @@ SessionSchema.methods.getSessionEndDate=function(){ ...@@ -23,8 +23,8 @@ SessionSchema.methods.getSessionEndDate=function(){
23 return this.sessionEndDate; 23 return this.sessionEndDate;
24 } 24 }
25 25
26 -SessionSchema.methods.getIsOpen=function(){ 26 +SessionSchema.methods.getStatus=function(){
27 - return this.isOpen; 27 + return this.status;
28 } 28 }
29 29
30 SessionSchema.methods.serialize=function(){ 30 SessionSchema.methods.serialize=function(){
......