def GetUserListByPhoneNumber(self, phone_number): user_list_response = self.dynamodb.query( TableName=self._GetUserTableName(), IndexName='phone_number_index', KeyConditionExpression='phone_number = :phone_number', ExpressionAttributeValues={':phone_number': dynamodb_util.SimpleToField(phone_number)}) user_list = [fase.User.FromSimple(dynamodb_util.ItemToSimple(user_item)) for user_item in user_list_response['Items']] return user_list
def GetNote(self, note_id): note_response = self.dynamodb.get_item( TableName=self._GetNotesTableName(), Key={ 'note_id': dynamodb_util.SimpleToField(note_id), }) if 'Item' not in note_response: return None note = notes_model.Note.FromSimple( dynamodb_util.ItemToSimple(note_response['Item'])) return note
def GetUser(self, user_id): user_response = self.dynamodb.get_item( TableName=self._GetUserTableName(), Key={ 'user_id': dynamodb_util.SimpleToField(user_id), } ) if 'Item' not in user_response: return None user = fase.User.FromSimple(dynamodb_util.ItemToSimple(user_response['Item'])) return user
def GetScreenProg(self, session_id): screen_prog_response = self.dynamodb.get_item( TableName=self._GetScreenProgTableName(), Key={ 'session_id': dynamodb_util.SimpleToField(session_id), } ) if 'Item' not in screen_prog_response: return None screen_prog = fase_model.ScreenProg.FromSimple(dynamodb_util.ItemToSimple(screen_prog_response['Item'])) return screen_prog
def GetUserNotes(self, user_id): notes_response = self.dynamodb.query( TableName=self._GetNotesTableName(), IndexName='user_id_datetime_index', KeyConditionExpression='user_id = :user_id', ExpressionAttributeValues={ ':user_id': dynamodb_util.SimpleToField(user_id) }) notes = [ notes_model.Note.FromSimple(dynamodb_util.ItemToSimple(note_item)) for note_item in notes_response['Items'] ] return notes