Beispiel #1
0
 def DeleteScreenProg(self, session_id):
   self.dynamodb.delete_item(
       TableName=self._GetScreenProgTableName(),
       Key={
           'session_id': dynamodb_util.SimpleToField(session_id),
           }
   )
Beispiel #2
0
 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
Beispiel #3
0
 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
Beispiel #4
0
 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
Beispiel #5
0
 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
Beispiel #6
0
 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
Beispiel #7
0
 def DeleteNote(self, note_id):
     self.dynamodb.delete_item(TableName=self._GetNotesTableName(),
                               Key={
                                   'note_id':
                                   dynamodb_util.SimpleToField(note_id),
                               })