def update(self, meeting_id, meeting_name=None, meeting_notes=None): meeting = MeetingModel.get_by_id(meeting_id) if meeting_name: meeting.name = meeting_name if meeting_notes: meeting.notes = meeting_notes meeting.put()
def get(self, meeting_id): logging.debug('getting meeting %s' % meeting_id) meeting_model = MeetingModel.get_by_id(int(meeting_id)) logging.debug('meeting model: %s' % meeting_model) if not meeting_model: logging.exception('no meeting with the given ID was found') raise Exception("meeting %s not found" % meeting_id) return Meeting.deserialize(meeting_model)
def update(self, request): authorise(request.person, request.token) mm = Meeting.get_by_id(request.id) if not mm: message = 'No meeting with the id "%s" exists.' % request.id raise endpoints.NotFoundException(message) mm.title = request.title mm.startTime = request.startTime mm.put() res = MeetingMsg(id=mm.put().id(), title=mm.title, startTime=mm.startTime) return res
def delete(self, request): authorise(request.person, request.token) try: meeting = Meeting.get_by_id(request.id) if meeting.originator == request.person: persons = Person.query(Person.parentId==request.id).fetch() for person in persons: roles = Role.query(Role.parentId==person.key.id()).fetch() for role in roles: role.key.delete() person.key.delete() meeting.key.delete() else: # just remove the person from the meeting persons = Person.query(Person.parentId==request.id).fetch() for person in persons: if(person.email == request.person): roles = Role.query(Role.parentId==person.key.id()).fetch() for role in roles: role.key.delete() person.key.delete() return message_types.VoidMessage() except (IndexError, TypeError): raise endpoints.NotFoundException('Role %s not found.' % (request.id,))
def end_meeting(self, meeting_id): meeting = MeetingModel.get_by_id(meeting_id) meeting.current = False meeting.put()
def add_note(self, meeting_id, note_id): meeting = MeetingModel.get_by_id(meeting_id) meeting.notes = meeting.notes or list() meeting.notes.append(note_id) meeting.put()