[odrs-web] Remove the /all endpoint



commit 3a453e33b43f0556bc237d76ce84b9244f48291a
Author: Richard Hughes <richard hughsie com>
Date:   Wed Mar 16 16:02:15 2022 +0000

    Remove the /all endpoint
    
    There is no way this can work with hundreds of thousands of reviews.
    
    Fixes https://gitlab.gnome.org/Infrastructure/odrs-web/-/issues/7

 app_data/odrs/tests/odrs_test.py | 13 -------------
 app_data/odrs/views_api.py       | 13 -------------
 2 files changed, 26 deletions(-)
---
diff --git a/app_data/odrs/tests/odrs_test.py b/app_data/odrs/tests/odrs_test.py
index 731a3d0..1180f32 100644
--- a/app_data/odrs/tests/odrs_test.py
+++ b/app_data/odrs/tests/odrs_test.py
@@ -328,10 +328,6 @@ class OdrsTest(unittest.TestCase):
         assert b'deleted 1 reviews' in rv.data, rv.data
         self.logout()
 
-        # check review was actually deleted
-        rv = self.app.get('/1.0/reviews/api/all')
-        assert rv.data == b'[]', rv.data
-
         # try to submit another review
         rv = self._review_submit(app_id='gimp.desktop')
         assert b'account has been disabled due to abuse' in rv.data, rv.data
@@ -372,7 +368,6 @@ class OdrsTest(unittest.TestCase):
         # all these are viewable without being logged in
         uris = ['/',
                 '/privacy',
-                #'/1.0/reviews/api/all',
                 ]
         for uri in uris:
             rv = self.app.get(uri, follow_redirects=True)
@@ -431,14 +426,6 @@ class OdrsTest(unittest.TestCase):
         rv = self._review_fetch(app_id='inkscape.desktop')
         assert b'An essential part of my daily workflow' in rv.data, rv.data
 
-    def test_api_dumping_all(self):
-
-        rv = self.app.get('/1.0/reviews/api/all')
-        assert rv.data == b'[]', rv.data
-        self.review_submit()
-        rv = self.app.get('/1.0/reviews/api/all')
-        assert b'Somebody Important' in rv.data, rv.data
-
     def test_api_moderate_locale(self):
 
         rv = self.app.get('/1.0/reviews/api/moderate/{}/en_GB'.format(self.user_hash))
diff --git a/app_data/odrs/views_api.py b/app_data/odrs/views_api.py
index a6f9ed4..90e1c51 100644
--- a/app_data/odrs/views_api.py
+++ b/app_data/odrs/views_api.py
@@ -296,19 +296,6 @@ def api_fetch():
                     status=200, \
                     mimetype='application/json')
 
-@app.route('/1.0/reviews/api/all/<user_hash>')
-@app.route('/1.0/reviews/api/all')
-def api_all(user_hash=None):
-    """
-    Return all the reviews on the server as a JSON object.
-    """
-    reviews = db.session.query(Review).filter(Review.reported < ODRS_REPORTED_CNT).all()
-    items = [review.asdict(user_hash) for review in reviews]
-    dat = json.dumps(items, sort_keys=True, indent=4, separators=(',', ': '))
-    return Response(response=dat,
-                    status=200, \
-                    mimetype='application/json')
-
 @app.route('/1.0/reviews/api/moderate/<user_hash>')
 @app.route('/1.0/reviews/api/moderate/<user_hash>/<locale>')
 def api_moderate(user_hash, locale=None):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]