commit eff25d7c1eacb1131f01df2ec56fa7e9f465803e
Author: Captain_Trojan <sejakm@students.zcu.cz>
Date:   Tue Apr 6 19:23:58 2021 +0200

    Re #8476 - Database FileAnchor utilization.

diff --git a/swagger_server/controllers/certificates_controller.py b/swagger_server/controllers/certificates_controller.py
index 83bdb1b..63e381f 100644
--- a/swagger_server/controllers/certificates_controller.py
+++ b/swagger_server/controllers/certificates_controller.py
@@ -6,8 +6,9 @@ from src.model.subject import Subject
 from src.services.certificate_service import CertificateService
 from src.dao.certificate_repository import CertificateRepository    # TODO not the Controller's responsibility. 1
 from src.services.cryptography import CryptographyService           # TODO not the Controller's responsibility. 2
-from sqlite3 import Connection, Cursor                              # TODO not the Controller's responsibility. 3
-from src.constants import DATABASE_FILE, DICT_USAGES, CA_ID         # TODO DATABASE_FILE - not the Controller's
+from sqlite3 import Connection                                      # TODO not the Controller's responsibility. 3
+from src.constants import DICT_USAGES, CA_ID, \
+    DATABASE_FILE_LOCATION                                          # TODO DATABASE_FILE - not the Controller's
                                                                     #  responsibility. 4
 from src.services.key_service import KeyService
 from swagger_server.models import CertificateRequest
@@ -23,7 +24,7 @@ from swagger_server.models.pem_response import PemResponse  # noqa: E501
 from swagger_server import util
 
 
-_ = Connection("../" + DATABASE_FILE)                                   # TODO not the Controller's responsibility. 5
+# _ = Connection("../" + DATABASE_FILE)                                 # TODO not the Controller's responsibility. 5
 # cursor = _.cursor()                                                   # TODO responsibility of the
                                                                         #  CertificateRepository. It makes no sense to
                                                                         #  supply a different cursor than precisely
@@ -32,12 +33,13 @@ _ = Connection("../" + DATABASE_FILE)                                   # TODO n
                                                                         #  connection instance.
 
 __ = CryptographyService()                                              # TODO not the Controller's responsibility. 6
-CERTIFICATE_SERVICE = CertificateService(__, CertificateRepository(_, _.cursor()))
+CERTIFICATE_SERVICE = CertificateService(__, CertificateRepository(None, None))
                                                                         # TODO open for discussion. Expected:
                                                                         #  CS = CertificateService.get_instance()
                                                                         #  or something like that.
 
-KEY_SERVICE = KeyService(__, PrivateKeyRepository(_, _.cursor()))       # TODO as above
+KEY_SERVICE = KeyService(__, PrivateKeyRepository(None, None))          # TODO as above
+
 
 
 def setup():
@@ -45,7 +47,7 @@ def setup():
     SQLite3 thread issue hack.
     :return:
     """
-    _ = Connection("../" + DATABASE_FILE)
+    _ = Connection(DATABASE_FILE_LOCATION.shortest_relative_path())
     CERTIFICATE_SERVICE.certificate_repository.connection = _
     CERTIFICATE_SERVICE.certificate_repository.cursor = _.cursor()
     KEY_SERVICE.private_key_repository.connection = _
@@ -62,7 +64,7 @@ def create_certificate(body=None):  # noqa: E501
 
     :rtype: CreatedResponse
     """
-    setup()
+    setup()                                                             # TODO remove after issue fixed
 
     if connexion.request.is_json:
         body = CertificateRequest.from_dict(connexion.request.get_json())  # noqa: E501
@@ -171,9 +173,13 @@ def get_certificate_list(filtering=None):  # noqa: E501
 
     :rtype: CertificateListResponse
     """
+    setup()                                                             # TODO remove after issue fixed
+
     if connexion.request.is_json:
+        return 400
         filtering = Filtering.from_dict(connexion.request.get_json())  # noqa: E501
-    return 'do some magic! XD'
+    else:
+        return 400
 
 
 def get_certificate_root_by_id(id):  # noqa: E501
