
def printSnapshot(doc):
  print(u'Created {} => {}'.format(doc.id, doc.to_dict()))

def queryUsers(db):
  users_ref = db.collection(u'users')
  docs = users_ref.get()
  docList = list()
  for doc in docs:
    docList.append(doc)
  return docList

def queryRequests(db):
  requests_ref = db.collection(u'requests')
  docs = requests_ref.get()
  docList = list()
  for doc in docs:
    docList.append(doc)
  return docList

def getUser(userId, users):
  for user in users:
    if user.id == userId:
      return user
  return None

def printSnapshot(doc):
  print(u'Created {} => {}'.format(doc.id, doc.to_dict()))

def queryUsers(db):
  users_ref = db.collection(u'users')
  docs = users_ref.get()
  docList = list()
  for doc in docs:
    docList.append(doc)
  return docList

def queryRequests(db):
  requests_ref = db.collection(u'requests')
  docs = requests_ref.get()
  docList = list()
  for doc in docs:
    docList.append(doc)
  return docList

def queryMessages(db):
  messages_ref = db.collection(u'messages')
  docs = messages_ref.get()
  docList = list()
  for doc in docs:
    docList.append(doc)
  return docList

def getUser(userId, users):
  for user in users:
    if user.id == userId:
      return user
  return None
Add script to clean the message table
Add script to clean the message table

  
  def printSnapshot(doc):
    print(u'Created {} => {}'.format(doc.id, doc.to_dict()))
  
  def queryUsers(db):
    users_ref = db.collection(u'users')
    docs = users_ref.get()
    docList = list()
    for doc in docs:
      docList.append(doc)
    return docList
  
  def queryRequests(db):
    requests_ref = db.collection(u'requests')
    docs = requests_ref.get()
    docList = list()
    for doc in docs:
      docList.append(doc)
    return docList
  
+ def queryMessages(db):
+   messages_ref = db.collection(u'messages')
+   docs = messages_ref.get()
+   docList = list()
+   for doc in docs:
+     docList.append(doc)
+   return docList
+ 
  def getUser(userId, users):
    for user in users:
      if user.id == userId:
        return user
    return None
Add script to clean the message table
## Code Before:

def printSnapshot(doc):
  print(u'Created {} => {}'.format(doc.id, doc.to_dict()))

def queryUsers(db):
  users_ref = db.collection(u'users')
  docs = users_ref.get()
  docList = list()
  for doc in docs:
    docList.append(doc)
  return docList

def queryRequests(db):
  requests_ref = db.collection(u'requests')
  docs = requests_ref.get()
  docList = list()
  for doc in docs:
    docList.append(doc)
  return docList

def getUser(userId, users):
  for user in users:
    if user.id == userId:
      return user
  return None
## Instruction:
Add script to clean the message table
## Code After:

def printSnapshot(doc):
  print(u'Created {} => {}'.format(doc.id, doc.to_dict()))

def queryUsers(db):
  users_ref = db.collection(u'users')
  docs = users_ref.get()
  docList = list()
  for doc in docs:
    docList.append(doc)
  return docList

def queryRequests(db):
  requests_ref = db.collection(u'requests')
  docs = requests_ref.get()
  docList = list()
  for doc in docs:
    docList.append(doc)
  return docList

def queryMessages(db):
  messages_ref = db.collection(u'messages')
  docs = messages_ref.get()
  docList = list()
  for doc in docs:
    docList.append(doc)
  return docList

def getUser(userId, users):
  for user in users:
    if user.id == userId:
      return user
  return None