From 820977921430e9bbdb98711b051f2848ce883b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20W=C3=B3jcik?= Date: Wed, 14 Feb 2024 11:23:05 +0100 Subject: [PATCH] Add short documentation for multi tenancy manager --- packages/backend/apps/multitenancy/managers.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/backend/apps/multitenancy/managers.py b/packages/backend/apps/multitenancy/managers.py index 9c734ff22..05becc50d 100644 --- a/packages/backend/apps/multitenancy/managers.py +++ b/packages/backend/apps/multitenancy/managers.py @@ -5,6 +5,15 @@ class TenantManager(models.Manager): def get_or_create_user_sign_up_tenant(self, user): + """ + Description: + Retrieves or creates a tenant for a given user to ensure there is always at least one tenant associated with the user. + Parameters: + - user (User): The user for whom the tenant is retrieved or created. + + Returns: + Tenant: The associated or newly created tenant instance of SIGN_UP type. + """ sign_up_tenant = self.filter(creator=user, type=TenantType.SIGN_UP).order_by('created').first() if sign_up_tenant: return sign_up_tenant, False