Skip to content

Commit

Permalink
Get method fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
wreckage0907 committed Feb 19, 2024
1 parent dc6b86a commit de2e23a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions apps/flask/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,17 @@ def add_details():
def get_data_from_firestore():
doc_ref = db.collection('needs_and_gives')
docs = doc_ref.stream()
data_list = []
data_dict = {"need": [], "give": []}

for doc in docs:
data_list.append(doc.to_dict())
doc_data = doc.to_dict()
if "need" in doc_data:
data_dict["need"].append(doc_data["need"])
if "give" in doc_data:
data_dict["give"].append(doc_data["give"])

return jsonify(data_dict), 200


# Accessing dictionaries by index
result = {"need":data_list[1]["need"],"give":data_list[0]["give"]}
Expand All @@ -134,10 +141,6 @@ def add_sub(sub_id,phone):
)
novu = SubscriberApi("https://api.novu.co", NOVU_KEY).create(subscriber)
return 1



novu = SubscriberApi("https://api.novu.co", NOVU_KEY).list()
@app.route('/api/v1/sendtxt', methods=['POST'])
def send_message():
sub = request.form.get('sub')
Expand Down

0 comments on commit de2e23a

Please sign in to comment.