From 5f5a2297952c1f91ff1a1fed6e3fad83e51222a5 Mon Sep 17 00:00:00 2001 From: Albert Sola Date: Wed, 10 Dec 2025 09:21:57 +0000 Subject: [PATCH] MPT-16304 Ensure correct model is used in services --- mpt_api_client/resources/accounts/account.py | 20 +++++++++---------- mpt_api_client/resources/accounts/buyers.py | 20 +++++++++---------- .../resources/accounts/licensees.py | 12 +++++------ mpt_api_client/resources/accounts/modules.py | 2 +- seed/accounts/buyer.py | 2 +- seed/accounts/licensee.py | 2 +- seed/accounts/module.py | 2 +- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/mpt_api_client/resources/accounts/account.py b/mpt_api_client/resources/accounts/account.py index 9a5da385..87563ead 100644 --- a/mpt_api_client/resources/accounts/account.py +++ b/mpt_api_client/resources/accounts/account.py @@ -39,11 +39,11 @@ class AccountsServiceConfig: class AccountsService( - CreateFileMixin[Model], - UpdateFileMixin[Model], - ActivatableMixin[Model], - EnablableMixin[Model], - ValidateMixin[Model], + CreateFileMixin[Account], + UpdateFileMixin[Account], + ActivatableMixin[Account], + EnablableMixin[Account], + ValidateMixin[Account], GetMixin[Account], CollectionMixin[Account], Service[Account], @@ -59,11 +59,11 @@ def users(self, account_id: str) -> AccountsUsersService: class AsyncAccountsService( - AsyncCreateFileMixin[Model], - AsyncUpdateFileMixin[Model], - AsyncActivatableMixin[Model], - AsyncEnablableMixin[Model], - AsyncValidateMixin[Model], + AsyncCreateFileMixin[Account], + AsyncUpdateFileMixin[Account], + AsyncActivatableMixin[Account], + AsyncEnablableMixin[Account], + AsyncValidateMixin[Account], AsyncGetMixin[Account], AsyncCollectionMixin[Account], AsyncService[Account], diff --git a/mpt_api_client/resources/accounts/buyers.py b/mpt_api_client/resources/accounts/buyers.py index 0b770167..3368a66a 100644 --- a/mpt_api_client/resources/accounts/buyers.py +++ b/mpt_api_client/resources/accounts/buyers.py @@ -38,11 +38,11 @@ class BuyersServiceConfig: class BuyersService( - CreateFileMixin[Model], - UpdateFileMixin[Model], - ActivatableMixin[Model], - EnablableMixin[Model], - ValidateMixin[Model], + CreateFileMixin[Buyer], + UpdateFileMixin[Buyer], + ActivatableMixin[Buyer], + EnablableMixin[Buyer], + ValidateMixin[Buyer], GetMixin[Buyer], DeleteMixin, CollectionMixin[Buyer], @@ -71,11 +71,11 @@ def transfer(self, resource_id: str, resource_data: ResourceData | None = None) class AsyncBuyersService( - AsyncCreateFileMixin[Model], - AsyncUpdateFileMixin[Model], - AsyncActivatableMixin[Model], - AsyncEnablableMixin[Model], - AsyncValidateMixin[Model], + AsyncCreateFileMixin[Buyer], + AsyncUpdateFileMixin[Buyer], + AsyncActivatableMixin[Buyer], + AsyncEnablableMixin[Buyer], + AsyncValidateMixin[Buyer], AsyncGetMixin[Buyer], AsyncDeleteMixin, AsyncCollectionMixin[Buyer], diff --git a/mpt_api_client/resources/accounts/licensees.py b/mpt_api_client/resources/accounts/licensees.py index 3f8da979..9a057c1f 100644 --- a/mpt_api_client/resources/accounts/licensees.py +++ b/mpt_api_client/resources/accounts/licensees.py @@ -33,9 +33,9 @@ class LicenseesServiceConfig: class LicenseesService( - CreateFileMixin[Model], - UpdateFileMixin[Model], - EnablableMixin[Model], + CreateFileMixin[Licensee], + UpdateFileMixin[Licensee], + EnablableMixin[Licensee], GetMixin[Licensee], DeleteMixin, CollectionMixin[Licensee], @@ -46,9 +46,9 @@ class LicenseesService( class AsyncLicenseesService( - AsyncCreateFileMixin[Model], - AsyncUpdateFileMixin[Model], - AsyncEnablableMixin[Model], + AsyncCreateFileMixin[Licensee], + AsyncUpdateFileMixin[Licensee], + AsyncEnablableMixin[Licensee], AsyncGetMixin[Licensee], AsyncDeleteMixin, AsyncCollectionMixin[Licensee], diff --git a/mpt_api_client/resources/accounts/modules.py b/mpt_api_client/resources/accounts/modules.py index 5c761415..92c848a7 100644 --- a/mpt_api_client/resources/accounts/modules.py +++ b/mpt_api_client/resources/accounts/modules.py @@ -27,6 +27,6 @@ class ModulesService( class AsyncModulesService( - AsyncGetMixin[Module], AsyncCollectionMixin[Model], AsyncService[Module], ModulesServiceConfig + AsyncGetMixin[Module], AsyncCollectionMixin[Module], AsyncService[Module], ModulesServiceConfig ): """Asynchronous Modules Service.""" diff --git a/seed/accounts/buyer.py b/seed/accounts/buyer.py index c45294a8..d3840e60 100644 --- a/seed/accounts/buyer.py +++ b/seed/accounts/buyer.py @@ -78,7 +78,7 @@ async def init_buyer( context["accounts.buyer.id"] = created.id logger.info("Buyer created: %s", created.id) return created - logger.warning("Buyer creation failed") + logger.warning("Buyer creation failed") # type: ignore[unreachable] raise ValueError("Buyer creation failed") logger.info("Buyer found: %s", buyer.id) return buyer diff --git a/seed/accounts/licensee.py b/seed/accounts/licensee.py index 56c0f5e5..b8a8274d 100644 --- a/seed/accounts/licensee.py +++ b/seed/accounts/licensee.py @@ -89,7 +89,7 @@ async def init_licensee( context["accounts.licensee.id"] = created.id logger.info("Licensee created: %s", created.id) return created - logger.warning("Licensee creation failed") + logger.warning("Licensee creation failed") # type: ignore[unreachable] raise ValueError("Licensee creation failed") logger.info("Licensee found: %s", licensee.id) return licensee diff --git a/seed/accounts/module.py b/seed/accounts/module.py index 2c0cd8d0..5c9efa3c 100644 --- a/seed/accounts/module.py +++ b/seed/accounts/module.py @@ -50,7 +50,7 @@ async def refresh_module( context["accounts.module.id"] = first_module.id context.set_resource("accounts.module", first_module) return first_module - logger.warning("First module is not a Module instance.") + logger.warning("First module is not a Module instance.") # type: ignore[unreachable] return None logger.warning("Module 'Access Management' not found.") return None