Fixed api key edit
All checks were successful
Build on push / prepare (push) Successful in 5s
Build on push / build-redirector (push) Successful in 32s
Build on push / build-api (push) Successful in 33s
Build on push / build-web (push) Successful in 55s

This commit is contained in:
Sven Heidemann 2025-03-15 10:49:27 +01:00
parent 9fb7bfc2d8
commit 40e364bb30
4 changed files with 7 additions and 7 deletions

View File

@ -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 = (

View File

@ -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:

View File

@ -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()

View File

@ -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 = [