From d36a85bc0d10a701e7ba6ecbd44d0543e6db8b93 Mon Sep 17 00:00:00 2001
From: thomaswoehlke <thomas.woehlke@gmail.com>
Date: Thu, 27 May 2021 01:27:48 +0200
Subject: [PATCH] Refactoring: vaccination

---
 src/flask_covid19/blueprints/data_rki/rki_model.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/flask_covid19/blueprints/data_rki/rki_model.py b/src/flask_covid19/blueprints/data_rki/rki_model.py
index 95a7666a..51b89124 100644
--- a/src/flask_covid19/blueprints/data_rki/rki_model.py
+++ b/src/flask_covid19/blueprints/data_rki/rki_model.py
@@ -283,3 +283,17 @@ class RkiData(BlueprintFactTable):
         db.session.query(cls).delete()
         db.session.commit()
         return None
+
+    @classmethod
+    def get_by_location(cls, location: RkiLandkreis, page: int):
+        return db.session.query(cls).filter(cls.location == location).paginate(page, per_page=ITEMS_PER_PAGE)
+
+    @classmethod
+    def find_by_location(cls, location: RkiLandkreis):
+        return db.session.query(cls).filter(cls.location == location).all()
+
+    @classmethod
+    def get_by_date_reported_and_location(cls, date_reported: RkiMeldedatum, location: RkiLandkreis):
+        return db.session.query(cls)\
+            .filter(and_((cls.date_reported == date_reported), (cls.location == location)))\
+            .all()
-- 
GitLab