From 09f11cb6b08c2f89a8be3d5c06166722df2b2c43 Mon Sep 17 00:00:00 2001
From: Sven Heidemann <sven.heidemann@sh-edraft.de>
Date: Sat, 15 Mar 2025 10:49:27 +0100
Subject: [PATCH] Fixed api key edit

---
 api/src/api_graphql/mutations/api_key_mutation.py         | 2 +-
 api/src/data/schemas/administration/api_key.py            | 2 +-
 api/src/data/schemas/permission/api_key_permission_dao.py | 8 ++++----
 api/src/data/seeder/permission_seeder.py                  | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/api/src/api_graphql/mutations/api_key_mutation.py b/api/src/api_graphql/mutations/api_key_mutation.py
index ff5fb06..b3bcf5f 100644
--- a/api/src/api_graphql/mutations/api_key_mutation.py
+++ b/api/src/api_graphql/mutations/api_key_mutation.py
@@ -63,7 +63,7 @@ class APIKeyMutation(MutationABC):
 
         if obj.permissions is not None:
             permissions = [
-                x for x in await apiKeyPermissionDao.get_by_role_id(api_key.id)
+                x for x in await apiKeyPermissionDao.find_by_api_key_id(api_key.id)
             ]
 
             to_delete = (
diff --git a/api/src/data/schemas/administration/api_key.py b/api/src/data/schemas/administration/api_key.py
index 944f844..3e3d9a2 100644
--- a/api/src/data/schemas/administration/api_key.py
+++ b/api/src/data/schemas/administration/api_key.py
@@ -40,7 +40,7 @@ class ApiKey(DbModelABC):
 
         return [
             await x.permission
-            for x in await apiKeyPermissionDao.get_by_api_key_id(self.id)
+            for x in await apiKeyPermissionDao.find_by_api_key_id(self.id)
         ]
 
     async def has_permission(self, permission: Permissions) -> bool:
diff --git a/api/src/data/schemas/permission/api_key_permission_dao.py b/api/src/data/schemas/permission/api_key_permission_dao.py
index 77da9bb..0852c24 100644
--- a/api/src/data/schemas/permission/api_key_permission_dao.py
+++ b/api/src/data/schemas/permission/api_key_permission_dao.py
@@ -15,23 +15,23 @@ class ApiKeyPermissionDao(DbModelDaoABC[ApiKeyPermission]):
         self.attribute(ApiKeyPermission.api_key_id, int)
         self.attribute(ApiKeyPermission.permission_id, int)
 
-    async def get_by_api_key_id(
+    async def find_by_api_key_id(
         self, api_key_id: int, with_deleted=False
     ) -> list[ApiKeyPermission]:
         f = [{ApiKeyPermission.api_key_id: api_key_id}]
         if not with_deleted:
             f.append({ApiKeyPermission.deleted: False})
 
-        return await self.get_by(f)
+        return await self.find_by(f)
 
-    async def get_by_permission_id(
+    async def find_by_permission_id(
         self, permission_id: int, with_deleted=False
     ) -> list[ApiKeyPermission]:
         f = [{ApiKeyPermission.permission_id: permission_id}]
         if not with_deleted:
             f.append({ApiKeyPermission.deleted: False})
 
-        return await self.get_by(f)
+        return await self.find_by(f)
 
 
 apiKeyPermissionDao = ApiKeyPermissionDao()
diff --git a/api/src/data/seeder/permission_seeder.py b/api/src/data/seeder/permission_seeder.py
index 9fabe4f..72ec6e8 100644
--- a/api/src/data/seeder/permission_seeder.py
+++ b/api/src/data/seeder/permission_seeder.py
@@ -71,7 +71,7 @@ class PermissionSeeder(DataSeederABC):
         if admin_api_key is None:
             return
 
-        admin_permissions = await apiKeyPermissionDao.get_by_api_key_id(
+        admin_permissions = await apiKeyPermissionDao.find_by_api_key_id(
             admin_api_key.id, with_deleted=True
         )
         to_assign = [