def store_description()

in appdev_with_generative_ai/src/genai-app/main.py [0:0]


def store_description(user_id:str, file_id:str, description:str):
    db = firestore.client()
    collection = "users/{}/items".format(user_id)
    print("Adding description to {}/{}".format(collection, file_id))

    doc_ref = db.collection(collection).document(file_id)
    
    # Wait for the document to be created on firestore.
    for _ in range(10):
      doc = doc_ref.get()
      if doc.exists:
        doc_ref.update({"description": description})
        print("Description: {}".format(description))
        break
      time.sleep(3)