diff --git a/SE_API/MessageRoutes.py b/SE_API/MessageRoutes.py
index 8a18726..a181620 100644
--- a/SE_API/MessageRoutes.py
+++ b/SE_API/MessageRoutes.py
@@ -155,7 +155,8 @@ def getMessagesByGroup(token, groupId):
'campuses_id_list': [43243532532,5325325325,532532342],
'courses_id_list': [53523,43432423,432432432432]
'id': 1234567890
- }
+ },
+ 'group': {The Group Object Project OR Campus (according to isProject)}
}
diff --git a/models/Message.py b/models/Message.py
index 8563174..67906f9 100644
--- a/models/Message.py
+++ b/models/Message.py
@@ -3,6 +3,8 @@ import json
__author__ = 'Aran'
from google.appengine.ext import db
from models.User import User
+from models.Project import Project
+from models.Course import Course
class Message(db.Model):
groupId = db.IntegerProperty(required=True)
@@ -13,6 +15,10 @@ class Message(db.Model):
def to_JSON(self):
user = User.get_by_id(self.master_id)
+ if self.isProject:
+ group = Project.get_by_id(self.groupId)
+ else:
+ group = Course.get_by_id(self.groupId)
data = {
'groupId' : self.groupId,
'message' : self.message,
@@ -26,6 +32,7 @@ class Message(db.Model):
'id' : self.key().id(),
'master_id' : self.master_id,
'isProject' : self.isProject,
- 'user': json.loads(user.to_JSON())
+ 'user': json.loads(user.to_JSON()),
+ 'group': json.loads(group.to_JSON())
}
return json.dumps(data)