Skip to content

Commit

Permalink
changed verification endpoint to pull an image based on status #8
Browse files Browse the repository at this point in the history
  • Loading branch information
zachale committed Jul 6, 2024
1 parent f9b827a commit 1c61987
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions demo/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flask import Flask, render_template, redirect, make_response, request
from flask import Flask, render_template, redirect, make_response, request, jsonify
from dotenv import load_dotenv
from pymongo import MongoClient
import gridfs
Expand Down Expand Up @@ -53,7 +53,7 @@ def read(filename):

@app.route("/image/verification-portal", methods=["GET"])
def verification_portal():
obj = list(db['fs.files'].aggregate([{ '$sample': { 'size': 1 } }]))[0] #TODO: MAKE IT BASED ON STATUS
obj = db['fs.files'].find_one({'status':'unverified'})
print(obj)
if obj:
grid_out = fs.find_one({"_id":obj['_id']})
Expand All @@ -71,13 +71,13 @@ def update_status():
db['fs.files'].find_one_and_update(query_filter, update_operation)
else:
return "new status not recieved",400
return "status updated",200
return "status updated"

@app.route("/image/delete_rejected", methods=["DELETE"])
@app.route("/image/delete-rejected", methods=["DELETE"])
def delete_rejected():
filter = {"status":"rejected"}
results = db["fs.files"].delete_many(filter)
return results, 200
return jsonify(results)

if __name__ == "__main__":
app.run()

0 comments on commit 1c61987

Please sign in to comment.